inch 0.6.4 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +13 -1
- data/README.md +2 -1
- data/bin/inch +2 -1
- data/lib/inch/cli/command/base.rb +10 -0
- data/lib/inch/cli/command/suggest.rb +9 -1
- data/lib/inch/cli/command_parser.rb +1 -0
- data/lib/inch/language/elixir/code_object/function_parameter_object.rb +10 -3
- data/lib/inch/language/javascript/provider/jsdoc/object.rb +3 -3
- data/lib/inch/language/javascript/provider/jsdoc/object/base.rb +3 -1
- data/lib/inch/language/javascript/provider/jsdoc/parser.rb +1 -1
- data/lib/inch/version.rb +1 -1
- data/test/fixtures/javascript/inch_test/all.json +198 -27
- data/test/integration/cli/command/console_test.rb +6 -0
- data/test/integration/cli/command/diff_test.rb +6 -0
- data/test/integration/cli/command/inspect_test.rb +7 -0
- data/test/integration/cli/command/list_test.rb +6 -0
- data/test/integration/cli/command/show_test.rb +7 -0
- data/test/integration/cli/command/stats_test.rb +6 -0
- data/test/integration/cli/command/suggest_test.rb +13 -0
- data/test/unit/language/javascript/code_object/function_object_test.rb +14 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f5e51a1fb3956e91d0e804c28cbfb8c21dc1ef9
|
4
|
+
data.tar.gz: fb07a2be558122b91bcb674381a3dbac81ab49e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6708035951911b83cecfec2ff1c885e7b9cfd73b148c36e48d827ac63ba520ff6159f4be9c73880e7bdfe7d17079bfbdc10251dc76b7e4b243abbb7fc3c644b
|
7
|
+
data.tar.gz: 4c22485a4a3afa60aacaccc3be699737e34329c9ec168715547457131e29fc9fba881f99105bbe9db24f748f16cdd8319a13d3524615075009776d8a7454ecd1
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.1.
|
1
|
+
ruby-2.1.6
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.7.0
|
4
|
+
|
5
|
+
BREAKING CHANGE:
|
6
|
+
|
7
|
+
- CLI: Uses an exit status different from zero in case of suggestions. This might break workflows based on `&&` (e.g. `rake && inch && ...`).
|
8
|
+
|
9
|
+
Improvements:
|
10
|
+
|
11
|
+
- Elixir: Skip analysis for function parameters starting with '_'
|
12
|
+
- JavaScript: Add support for @ignore and istanbul ignore comments
|
13
|
+
- JavaScript: Add support for @also (multiple signatures)
|
14
|
+
|
3
15
|
## 0.6.4
|
4
16
|
|
5
17
|
- Ruby: Skip analysis for method parameters named '_'
|
@@ -8,7 +20,7 @@
|
|
8
20
|
## 0.6.3
|
9
21
|
|
10
22
|
- Elixir: Recognize callbacks and macros
|
11
|
-
-
|
23
|
+
- JavaScript: Improve param type detection
|
12
24
|
|
13
25
|
## 0.6.2
|
14
26
|
|
data/README.md
CHANGED
@@ -260,7 +260,8 @@ It comes with four sub-commands: `suggest`, `stats`, `show`, and `list`
|
|
260
260
|
|
261
261
|
### inch suggest
|
262
262
|
|
263
|
-
Suggests places where a codebase suffers a lack of documentation.
|
263
|
+
Suggests places where a codebase suffers a lack of documentation. The command
|
264
|
+
line exit status will be above zero when suggestions are found.
|
264
265
|
|
265
266
|
$ inch suggest
|
266
267
|
|
data/bin/inch
CHANGED
@@ -36,6 +36,8 @@ module Inch
|
|
36
36
|
# @note This was adapted from YARD
|
37
37
|
# https://github.com/lsegal/yard/blob/master/lib/yard/cli/command.rb
|
38
38
|
class Base
|
39
|
+
EXIT_STATUS_SUCCESS = 0
|
40
|
+
|
39
41
|
include TraceHelper
|
40
42
|
|
41
43
|
attr_reader :codebase # @return [Codebase::Proxy]
|
@@ -72,6 +74,14 @@ module Inch
|
|
72
74
|
''
|
73
75
|
end
|
74
76
|
|
77
|
+
# Returns the exit status of the running command.
|
78
|
+
# This can be overridden to customize exit statusses.
|
79
|
+
#
|
80
|
+
# @return [Fixnum] zero (by default)
|
81
|
+
def exit_status
|
82
|
+
EXIT_STATUS_SUCCESS
|
83
|
+
end
|
84
|
+
|
75
85
|
# Returns the name of the command by which it is referenced
|
76
86
|
# in the command list
|
77
87
|
#
|
@@ -7,6 +7,8 @@ module Inch
|
|
7
7
|
class Suggest < List
|
8
8
|
register_command_as :suggest, true
|
9
9
|
|
10
|
+
EXIT_CODE_PENDING_SUGGESTIONS = 10
|
11
|
+
|
10
12
|
def description
|
11
13
|
'Suggests some objects to be documented (better)'
|
12
14
|
end
|
@@ -23,13 +25,19 @@ module Inch
|
|
23
25
|
def run(*args)
|
24
26
|
prepare_codebase(*args)
|
25
27
|
context = API::Suggest.new(codebase, @options)
|
28
|
+
self.objects = context.objects
|
26
29
|
if @options.format == Options::Suggest::FORMAT_TEXT
|
27
|
-
Output::Suggest.new(@options, context.all_objects,
|
30
|
+
Output::Suggest.new(@options, context.all_objects, objects,
|
28
31
|
context.grade_lists, context.files)
|
29
32
|
else
|
30
33
|
Output::Stats.new(@options, context.all_objects, context.grade_lists)
|
31
34
|
end
|
32
35
|
end
|
36
|
+
|
37
|
+
# @return [Fixnum] 10 if suggestions were found, zero otherwise
|
38
|
+
def exit_status
|
39
|
+
objects.empty? ? super : EXIT_CODE_PENDING_SUGGESTIONS
|
40
|
+
end
|
33
41
|
end
|
34
42
|
end
|
35
43
|
end
|
@@ -12,6 +12,7 @@ module Inch
|
|
12
12
|
@attributes[key]
|
13
13
|
end
|
14
14
|
|
15
|
+
IGNORE_NAME_PREFIX = "_"
|
15
16
|
BAD_NAME_EXCEPTIONS = %w(id)
|
16
17
|
BAD_NAME_THRESHOLD = 3
|
17
18
|
|
@@ -29,12 +30,12 @@ module Inch
|
|
29
30
|
|
30
31
|
# @return [Boolean] +true+ if an additional description given?
|
31
32
|
def described?
|
32
|
-
self[:described?]
|
33
|
+
self[:described?] || ignore?
|
33
34
|
end
|
34
35
|
|
35
36
|
# @return [Boolean] +true+ if the parameter is mentioned in the docs
|
36
37
|
def mentioned?
|
37
|
-
self[:mentioned?]
|
38
|
+
self[:mentioned?] || ignore?
|
38
39
|
end
|
39
40
|
|
40
41
|
def name
|
@@ -49,7 +50,7 @@ module Inch
|
|
49
50
|
|
50
51
|
# @return [Boolean] +true+ if the type of the parameter is defined
|
51
52
|
def typed?
|
52
|
-
self[:typed?]
|
53
|
+
self[:typed?] || ignore?
|
53
54
|
end
|
54
55
|
|
55
56
|
def unnamed?
|
@@ -61,6 +62,12 @@ module Inch
|
|
61
62
|
def wrongly_mentioned?
|
62
63
|
self[:wrongly_mentioned?]
|
63
64
|
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def ignore?
|
69
|
+
name.start_with?(IGNORE_NAME_PREFIX)
|
70
|
+
end
|
64
71
|
end
|
65
72
|
end
|
66
73
|
end
|
@@ -23,11 +23,11 @@ module Inch
|
|
23
23
|
# @return [Provider::JSDoc::Object]
|
24
24
|
def for(jsdoc_object)
|
25
25
|
@cache ||= {}
|
26
|
-
|
26
|
+
key = cache_key(jsdoc_object)
|
27
|
+
if proxy_object = @cache[key]
|
27
28
|
proxy_object
|
28
29
|
else
|
29
|
-
@cache[
|
30
|
-
class_for(jsdoc_object).new(jsdoc_object)
|
30
|
+
@cache[key] = class_for(jsdoc_object).new(jsdoc_object)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
data/lib/inch/version.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"args": [],
|
3
3
|
"branch_name": "master",
|
4
4
|
"client_name": "inchjs",
|
5
|
-
"client_version": "0.
|
5
|
+
"client_version": "0.4.0",
|
6
6
|
"git_repo_url": "git@github.com:inch-ci/Hello-World-NodeJS.git",
|
7
7
|
"language": "javascript",
|
8
8
|
"objects": [
|
@@ -74,11 +74,11 @@
|
|
74
74
|
"value": "function"
|
75
75
|
},
|
76
76
|
"filename": "inch_test.js",
|
77
|
-
"lineno":
|
77
|
+
"lineno": 14,
|
78
78
|
"path": "/src",
|
79
79
|
"range": [
|
80
|
-
|
81
|
-
|
80
|
+
166,
|
81
|
+
235
|
82
82
|
]
|
83
83
|
},
|
84
84
|
"name": "generate_docs",
|
@@ -108,6 +108,54 @@
|
|
108
108
|
"scope": "static",
|
109
109
|
"undocumented": true
|
110
110
|
},
|
111
|
+
{
|
112
|
+
"comment": "/*\n* @ignore\n*/",
|
113
|
+
"kind": "function",
|
114
|
+
"longname": "InchTest.Docs.Formatter.nodoc_ignore",
|
115
|
+
"memberof": "InchTest.Docs.Formatter",
|
116
|
+
"meta": {
|
117
|
+
"code": {
|
118
|
+
"id": "astnode100000050",
|
119
|
+
"name": "nodoc_ignore",
|
120
|
+
"type": "FunctionExpression",
|
121
|
+
"value": "function"
|
122
|
+
},
|
123
|
+
"filename": "inch_test.js",
|
124
|
+
"lineno": 25,
|
125
|
+
"path": "/src",
|
126
|
+
"range": [
|
127
|
+
434,
|
128
|
+
463
|
129
|
+
]
|
130
|
+
},
|
131
|
+
"name": "nodoc_ignore",
|
132
|
+
"scope": "static",
|
133
|
+
"undocumented": true
|
134
|
+
},
|
135
|
+
{
|
136
|
+
"comment": "/* istanbul ignore next */",
|
137
|
+
"kind": "function",
|
138
|
+
"longname": "InchTest.Docs.Formatter.nodoc_istanbul",
|
139
|
+
"memberof": "InchTest.Docs.Formatter",
|
140
|
+
"meta": {
|
141
|
+
"code": {
|
142
|
+
"id": "astnode100000053",
|
143
|
+
"name": "nodoc_istanbul",
|
144
|
+
"type": "FunctionExpression",
|
145
|
+
"value": "function"
|
146
|
+
},
|
147
|
+
"filename": "inch_test.js",
|
148
|
+
"lineno": 27,
|
149
|
+
"path": "/src",
|
150
|
+
"range": [
|
151
|
+
500,
|
152
|
+
531
|
153
|
+
]
|
154
|
+
},
|
155
|
+
"name": "nodoc_istanbul",
|
156
|
+
"scope": "static",
|
157
|
+
"undocumented": true
|
158
|
+
},
|
111
159
|
{
|
112
160
|
"comment": "/**\n*\n* This function takes `param1` and `param2` as arguments.\n*\n* @param {Number} param1 A number from 0 to 26 that will result in a letter a-z\n* @param {String} param2 A text\n* @return {String} A character from a-z based on the input number n\n*\n* Examples:\n*\n* > InchTest.Naming.resource_name(MyApp.User)\n* \"user\"\n* > InchTest.Naming.resource_name(MyApp.UserView, \"View\")\n* \"user\"\n*/",
|
113
161
|
"description": "This function takes `param1` and `param2` as arguments.",
|
@@ -116,7 +164,7 @@
|
|
116
164
|
"memberof": "InchTest.Functions",
|
117
165
|
"meta": {
|
118
166
|
"code": {
|
119
|
-
"id": "
|
167
|
+
"id": "astnode100000063",
|
120
168
|
"name": "InchTest.Functions.full_doc",
|
121
169
|
"paramnames": [
|
122
170
|
"param1",
|
@@ -126,11 +174,11 @@
|
|
126
174
|
"value": "function"
|
127
175
|
},
|
128
176
|
"filename": "inch_test.js",
|
129
|
-
"lineno":
|
177
|
+
"lineno": 47,
|
130
178
|
"path": "/src",
|
131
179
|
"range": [
|
132
|
-
|
133
|
-
|
180
|
+
974,
|
181
|
+
1047
|
134
182
|
]
|
135
183
|
},
|
136
184
|
"name": "full_doc",
|
@@ -174,7 +222,7 @@
|
|
174
222
|
"memberof": "InchTest.Functions",
|
175
223
|
"meta": {
|
176
224
|
"code": {
|
177
|
-
"id": "
|
225
|
+
"id": "astnode100000076",
|
178
226
|
"name": "InchTest.Functions.full_doc_second_parameter_unnamed",
|
179
227
|
"paramnames": [
|
180
228
|
"param1",
|
@@ -184,16 +232,146 @@
|
|
184
232
|
"value": "function"
|
185
233
|
},
|
186
234
|
"filename": "inch_test.js",
|
187
|
-
"lineno":
|
235
|
+
"lineno": 63,
|
188
236
|
"path": "/src",
|
189
237
|
"range": [
|
190
|
-
|
191
|
-
|
238
|
+
1404,
|
239
|
+
1497
|
192
240
|
]
|
193
241
|
},
|
194
242
|
"name": "full_doc_second_parameter_unnamed",
|
195
243
|
"scope": "static"
|
196
244
|
},
|
245
|
+
{
|
246
|
+
"access": "public",
|
247
|
+
"comment": "/**\n* Creates and returns a new MultiRedisClient instance.\n*\n* @function\n* @memberof! MultiRedisClient\n* @public\n* @param {redis|Array} clients - The redis client/s\n* @returns {MultiRedisClient} The multiple redis client instance\n* @example\n* ```js\n* //create multiple redis clients\n* var redis = require('redis');\n* var client1 = redis.createClient(...);\n* var client2 = redis.createClient(...);\n*\n* //create the wrapper client\n* var MultipleRedis = require('multiple-redis');\n* var multiClient = MultipleRedis.createClient([client1, client2]);\n*\n* //run any command on the multi client instead of the original clients\n* multiClient.set('string key', 'string val', callback);\n* ```\n*\n*",
|
248
|
+
"description": "Creates and returns a new MultiRedisClient instance.",
|
249
|
+
"examples": [
|
250
|
+
"```js\n//create multiple redis clients\nvar redis = require('redis');\nvar client1 = redis.createClient(...);\nvar client2 = redis.createClient(...);\n\n//create the wrapper client\nvar MultipleRedis = require('multiple-redis');\nvar multiClient = MultipleRedis.createClient([client1, client2]);\n\n//run any command on the multi client instead of the original clients\nmultiClient.set('string key', 'string val', callback);\n```"
|
251
|
+
],
|
252
|
+
"forceMemberof": true,
|
253
|
+
"kind": "function",
|
254
|
+
"longname": "MultiRedisClient.InchTest.Functions.multiple_signatures",
|
255
|
+
"memberof": "MultiRedisClient",
|
256
|
+
"meta": {
|
257
|
+
"code": {
|
258
|
+
"id": "astnode100000089",
|
259
|
+
"name": "InchTest.Functions.multiple_signatures",
|
260
|
+
"paramnames": [],
|
261
|
+
"type": "FunctionExpression",
|
262
|
+
"value": "function"
|
263
|
+
},
|
264
|
+
"filename": "inch_test.js",
|
265
|
+
"lineno": 115,
|
266
|
+
"path": "/src",
|
267
|
+
"range": [
|
268
|
+
3015,
|
269
|
+
3082
|
270
|
+
]
|
271
|
+
},
|
272
|
+
"name": "InchTest.Functions.multiple_signatures",
|
273
|
+
"params": [
|
274
|
+
{
|
275
|
+
"description": "The redis client/s",
|
276
|
+
"name": "clients",
|
277
|
+
"type": {
|
278
|
+
"names": [
|
279
|
+
"redis",
|
280
|
+
"Array"
|
281
|
+
]
|
282
|
+
}
|
283
|
+
}
|
284
|
+
],
|
285
|
+
"returns": [
|
286
|
+
{
|
287
|
+
"description": "The multiple redis client instance",
|
288
|
+
"type": {
|
289
|
+
"names": [
|
290
|
+
"MultiRedisClient"
|
291
|
+
]
|
292
|
+
}
|
293
|
+
}
|
294
|
+
],
|
295
|
+
"scope": "static"
|
296
|
+
},
|
297
|
+
{
|
298
|
+
"access": "public",
|
299
|
+
"comment": "\n*\n* @function\n* @memberof! MultiRedisClient\n* @public\n* @param {Array} connectionInfo - The redis client/s connection info\n* @param {string} connectionInfo.host - The redis host\n* @param {number} connectionInfo.post - The redis port\n* @param {Array} [options] - Used when this client creates the redis clients\n* @returns {MultiRedisClient} The multiple redis client instance\n* @example\n* ```js\n* //create the wrapper client with connection info\n* var MultipleRedis = require('multiple-redis');\n* var multiClient = MultipleRedis.createClient([{\n* host: 'host1',\n* port: 6379\n* }, {\n* host: 'host2',\n* port: 6379\n* }], options);\n*\n* //run any command on the multi client instead of the original clients\n* multiClient.set('string key', 'string val', callback);\n* ```\n*/",
|
300
|
+
"examples": [
|
301
|
+
"```js\n//create the wrapper client with connection info\nvar MultipleRedis = require('multiple-redis');\nvar multiClient = MultipleRedis.createClient([{\n host: 'host1',\n port: 6379\n}, {\n host: 'host2',\n port: 6379\n}], options);\n\n//run any command on the multi client instead of the original clients\nmultiClient.set('string key', 'string val', callback);\n```"
|
302
|
+
],
|
303
|
+
"forceMemberof": true,
|
304
|
+
"kind": "function",
|
305
|
+
"longname": "MultiRedisClient.InchTest.Functions.multiple_signatures",
|
306
|
+
"memberof": "MultiRedisClient",
|
307
|
+
"meta": {
|
308
|
+
"code": {
|
309
|
+
"id": "astnode100000089",
|
310
|
+
"name": "InchTest.Functions.multiple_signatures",
|
311
|
+
"paramnames": [],
|
312
|
+
"type": "FunctionExpression",
|
313
|
+
"value": "function"
|
314
|
+
},
|
315
|
+
"filename": "inch_test.js",
|
316
|
+
"lineno": 115,
|
317
|
+
"path": "/src",
|
318
|
+
"range": [
|
319
|
+
3015,
|
320
|
+
3082
|
321
|
+
]
|
322
|
+
},
|
323
|
+
"name": "InchTest.Functions.multiple_signatures",
|
324
|
+
"params": [
|
325
|
+
{
|
326
|
+
"description": "The redis client/s connection info",
|
327
|
+
"name": "connectionInfo",
|
328
|
+
"type": {
|
329
|
+
"names": [
|
330
|
+
"Array"
|
331
|
+
]
|
332
|
+
}
|
333
|
+
},
|
334
|
+
{
|
335
|
+
"description": "The redis host",
|
336
|
+
"name": "connectionInfo.host",
|
337
|
+
"type": {
|
338
|
+
"names": [
|
339
|
+
"string"
|
340
|
+
]
|
341
|
+
}
|
342
|
+
},
|
343
|
+
{
|
344
|
+
"description": "The redis port",
|
345
|
+
"name": "connectionInfo.post",
|
346
|
+
"type": {
|
347
|
+
"names": [
|
348
|
+
"number"
|
349
|
+
]
|
350
|
+
}
|
351
|
+
},
|
352
|
+
{
|
353
|
+
"description": "Used when this client creates the redis clients",
|
354
|
+
"name": "options",
|
355
|
+
"optional": true,
|
356
|
+
"type": {
|
357
|
+
"names": [
|
358
|
+
"Array"
|
359
|
+
]
|
360
|
+
}
|
361
|
+
}
|
362
|
+
],
|
363
|
+
"returns": [
|
364
|
+
{
|
365
|
+
"description": "The multiple redis client instance",
|
366
|
+
"type": {
|
367
|
+
"names": [
|
368
|
+
"MultiRedisClient"
|
369
|
+
]
|
370
|
+
}
|
371
|
+
}
|
372
|
+
],
|
373
|
+
"scope": "static"
|
374
|
+
},
|
197
375
|
{
|
198
376
|
"comment": "/**\n*\n* This function takes no arguments.\n*\n* Examples:\n*\n* > InchTest.Naming.resource_name(MyApp.User)\n* \"user\"\n* > InchTest.Naming.resource_name(MyApp.UserView, \"View\")\n* \"user\"\n*/",
|
199
377
|
"description": "This function takes no arguments.\n\nExamples:\n\n > InchTest.Naming.resource_name(MyApp.User)\n \"user\"\n > InchTest.Naming.resource_name(MyApp.UserView, \"View\")\n \"user\"",
|
@@ -202,17 +380,17 @@
|
|
202
380
|
"memberof": "InchTest.CodeExamples",
|
203
381
|
"meta": {
|
204
382
|
"code": {
|
205
|
-
"id": "
|
383
|
+
"id": "astnode100000104",
|
206
384
|
"name": "single_code_example",
|
207
385
|
"type": "FunctionExpression",
|
208
386
|
"value": "function"
|
209
387
|
},
|
210
388
|
"filename": "inch_test.js",
|
211
|
-
"lineno":
|
389
|
+
"lineno": 129,
|
212
390
|
"path": "/src",
|
213
391
|
"range": [
|
214
|
-
|
215
|
-
|
392
|
+
3325,
|
393
|
+
3381
|
216
394
|
]
|
217
395
|
},
|
218
396
|
"name": "single_code_example",
|
@@ -226,28 +404,21 @@
|
|
226
404
|
"memberof": "InchTest.CodeExamples",
|
227
405
|
"meta": {
|
228
406
|
"code": {
|
229
|
-
"id": "
|
407
|
+
"id": "astnode100000109",
|
230
408
|
"name": "multiple_code_examples",
|
231
409
|
"type": "FunctionExpression",
|
232
410
|
"value": "function"
|
233
411
|
},
|
234
412
|
"filename": "inch_test.js",
|
235
|
-
"lineno":
|
413
|
+
"lineno": 150,
|
236
414
|
"path": "/src",
|
237
415
|
"range": [
|
238
|
-
|
239
|
-
|
416
|
+
3810,
|
417
|
+
3869
|
240
418
|
]
|
241
419
|
},
|
242
420
|
"name": "multiple_code_examples",
|
243
421
|
"scope": "static"
|
244
|
-
},
|
245
|
-
{
|
246
|
-
"files": [
|
247
|
-
"/home/rf/devel/Hello-World-NodeJS/src/inch_test.js"
|
248
|
-
],
|
249
|
-
"kind": "package",
|
250
|
-
"longname": "package:undefined"
|
251
422
|
}
|
252
423
|
]
|
253
424
|
}
|
@@ -12,6 +12,12 @@ describe ::Inch::CLI::Command::Console do
|
|
12
12
|
@command = ::Inch::CLI::Command::Console
|
13
13
|
end
|
14
14
|
|
15
|
+
it 'should run with exit status' do
|
16
|
+
_out, _err = capture_io do
|
17
|
+
assert_equal @command.run.exit_status, @command::EXIT_STATUS_SUCCESS
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
15
21
|
it 'should output info when run with --help' do
|
16
22
|
out, err = capture_io do
|
17
23
|
assert_raises(SystemExit) { @command.run('--help') }
|
@@ -23,6 +23,12 @@ describe ::Inch::CLI::Command::Diff do
|
|
23
23
|
FileUtils.rm_rf @tmp_dir
|
24
24
|
end
|
25
25
|
|
26
|
+
it 'should run with exit status' do
|
27
|
+
_out, _err = capture_io do
|
28
|
+
assert_equal @command.run.exit_status, @command::EXIT_STATUS_SUCCESS
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
26
32
|
it 'should not show any changes' do
|
27
33
|
# this runs `inch diff` on a freshly cloned repo
|
28
34
|
# should not show any changes
|
@@ -6,6 +6,13 @@ describe ::Inch::CLI::Command::Inspect do
|
|
6
6
|
@command = ::Inch::CLI::Command::Inspect
|
7
7
|
end
|
8
8
|
|
9
|
+
it 'should run with exit status' do
|
10
|
+
_out, _err = capture_io do
|
11
|
+
cmd = @command.run('Foo::Bar#', '--no-color')
|
12
|
+
assert_equal cmd.exit_status, @command::EXIT_STATUS_SUCCESS
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
9
16
|
it 'should warn and exit when run without args' do
|
10
17
|
out, err = capture_io do
|
11
18
|
assert_raises(SystemExit) { @command.run }
|
@@ -9,6 +9,12 @@ describe ::Inch::CLI::Command::List do
|
|
9
9
|
|
10
10
|
include Shared::BaseList
|
11
11
|
|
12
|
+
it 'should run with exit status' do
|
13
|
+
_out, _err = capture_io do
|
14
|
+
assert_equal @command.run.exit_status, @command::EXIT_STATUS_SUCCESS
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
12
18
|
it 'should run without args' do
|
13
19
|
out, err = capture_io do
|
14
20
|
@command.run
|
@@ -6,6 +6,13 @@ describe ::Inch::CLI::Command::Show do
|
|
6
6
|
@command = ::Inch::CLI::Command::Show
|
7
7
|
end
|
8
8
|
|
9
|
+
it 'should run with exit status' do
|
10
|
+
_out, _err = capture_io do
|
11
|
+
cmd = @command.run('Foo::Bar#', '--no-color')
|
12
|
+
assert_equal cmd.exit_status, @command::EXIT_STATUS_SUCCESS
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
9
16
|
it 'should warn and exit when run without args' do
|
10
17
|
out, err = capture_io do
|
11
18
|
assert_raises(SystemExit) { @command.run }
|
@@ -6,6 +6,12 @@ describe ::Inch::CLI::Command::Stats do
|
|
6
6
|
@command = ::Inch::CLI::Command::Stats
|
7
7
|
end
|
8
8
|
|
9
|
+
it 'should run with exit status' do
|
10
|
+
_out, _err = capture_io do
|
11
|
+
assert_equal @command.run.exit_status, @command::EXIT_STATUS_SUCCESS
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
9
15
|
it 'should run without args' do
|
10
16
|
out, err = capture_io do
|
11
17
|
@command.run
|
@@ -7,6 +7,12 @@ describe ::Inch::CLI::Command::Suggest do
|
|
7
7
|
@command = ::Inch::CLI::Command::Suggest
|
8
8
|
end
|
9
9
|
|
10
|
+
it 'should run with exit status' do
|
11
|
+
_out, _err = capture_io do
|
12
|
+
assert_equal @command.run.exit_status, @command::EXIT_CODE_PENDING_SUGGESTIONS
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
10
16
|
it 'should run without args' do
|
11
17
|
out, err = capture_io do
|
12
18
|
@command.run
|
@@ -93,6 +99,13 @@ describe ::Inch::CLI::Command::Suggest do
|
|
93
99
|
|
94
100
|
# Edge case: Really good codebase
|
95
101
|
|
102
|
+
it 'should return EXIT_STATUS_SUCCESS when no suggestions' do
|
103
|
+
Dir.chdir fixture_path(:ruby, :really_good)
|
104
|
+
_out, _err = capture_io do
|
105
|
+
assert_equal @command.run.exit_status, @command::EXIT_STATUS_SUCCESS
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
96
109
|
it 'should run without args on really good fixture' do
|
97
110
|
out, err = capture_io do
|
98
111
|
Dir.chdir fixture_path(:ruby, :really_good)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../../../../test_helper')
|
2
2
|
|
3
|
-
describe ::Inch::Language::
|
3
|
+
describe ::Inch::Language::JavaScript::CodeObject::FunctionObject do
|
4
4
|
before do
|
5
5
|
@codebase = fresh_codebase(:javascript, :inch_test, 'all.json')
|
6
6
|
@objects = @codebase.objects
|
@@ -56,4 +56,17 @@ describe ::Inch::Language::Elixir::CodeObject::FunctionObject do
|
|
56
56
|
assert m.has_code_example?
|
57
57
|
assert m.has_multiple_code_examples?
|
58
58
|
end
|
59
|
+
|
60
|
+
it 'should recognize nodoc' do
|
61
|
+
m = @objects.find('InchTest.Docs.Formatter.nodoc_ignore')
|
62
|
+
assert m.nodoc?
|
63
|
+
|
64
|
+
m = @objects.find('InchTest.Docs.Formatter.nodoc_istanbul')
|
65
|
+
assert m.nodoc?
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'should recognize @also' do
|
69
|
+
list = @objects.to_a.map(&:fullname)
|
70
|
+
assert list.size == list.uniq.size, "There should be no duplicate fullnames."
|
71
|
+
end
|
59
72
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- René Föhring
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|