inch 0.3.1.rc3 → 0.3.1.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/inch/cli/command/output/suggest.rb +3 -3
- data/lib/inch/code_object/converter.rb +1 -1
- data/lib/inch/code_object/provider/yard/docstring.rb +16 -4
- data/lib/inch/code_object/provider/yard/object/base.rb +13 -11
- data/lib/inch/code_object/proxy/base.rb +2 -2
- data/lib/inch/evaluation/proxy/base.rb +1 -1
- data/lib/inch/evaluation/role/object.rb +3 -3
- data/lib/inch/version.rb +1 -1
- data/test/fixtures/simple/lib/role_methods.rb +8 -0
- data/test/inch/code_object/provider/yard/docstring_test.rb +2 -1
- data/test/inch/code_object/proxy/method_object_test.rb +8 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0e0ac12145f490c8344decf540c18bfde47cd80
|
4
|
+
data.tar.gz: 9bcb872f479818b9feac08c5d2db80303aee6ef5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65f3ce04102ade8753d5b1b7d0db2620f7a8087df58949fd9efe21c41ac54c27c82a4031885d913acbc9cd48353333ef36b1147d848f462a033cbb22162fcae1
|
7
|
+
data.tar.gz: acfdb32fe9cfb3a2301feef2110eedbf39ccfe6e4f78eb8e07dc2dffba2dd8f4e43601630c96b463b493a1c3a1453c2240c0072fb18b25bdedf27c2b133a9bfe
|
@@ -103,9 +103,9 @@ module Inch
|
|
103
103
|
end
|
104
104
|
|
105
105
|
def priority_arrows_gte(min_priority)
|
106
|
-
Evaluation::PriorityRange.all.
|
107
|
-
|
108
|
-
end
|
106
|
+
Evaluation::PriorityRange.all.select do |priority_range|
|
107
|
+
priority_range.priorities.min >= min_priority
|
108
|
+
end
|
109
109
|
end
|
110
110
|
|
111
111
|
def grade_list(grade_symbol)
|
@@ -7,6 +7,10 @@ module Inch
|
|
7
7
|
@text = text.to_s
|
8
8
|
end
|
9
9
|
|
10
|
+
def describes_internal_api?
|
11
|
+
first_line =~ /^Internal\:\ .+/
|
12
|
+
end
|
13
|
+
|
10
14
|
def empty?
|
11
15
|
@text.strip.empty?
|
12
16
|
end
|
@@ -32,11 +36,21 @@ module Inch
|
|
32
36
|
end
|
33
37
|
|
34
38
|
def mentions_return?
|
35
|
-
|
39
|
+
last_line =~ /^Returns\ /
|
36
40
|
end
|
37
41
|
|
38
42
|
def describes_return?
|
39
|
-
|
43
|
+
last_line =~ /^Returns\ (\w+\s){2,}/
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def first_line
|
49
|
+
@first_line ||= @text.lines.to_a.first
|
50
|
+
end
|
51
|
+
|
52
|
+
def last_line
|
53
|
+
@last_line ||= @text.lines.to_a.last
|
40
54
|
end
|
41
55
|
|
42
56
|
def parse_code_examples
|
@@ -57,8 +71,6 @@ module Inch
|
|
57
71
|
code_examples.delete_if(&:empty?).map(&:join)
|
58
72
|
end
|
59
73
|
|
60
|
-
private
|
61
|
-
|
62
74
|
def mention_parameter_patterns(name)
|
63
75
|
[
|
64
76
|
"+#{name}+",
|
@@ -68,15 +68,9 @@ module Inch
|
|
68
68
|
end
|
69
69
|
|
70
70
|
# Returns all files declaring the object in the form of an Array of
|
71
|
-
# Arrays containing the
|
72
|
-
# declaration.
|
71
|
+
# Arrays containing the location of their declaration.
|
73
72
|
#
|
74
|
-
# @
|
75
|
-
# files # => [["lib/inch.rb", 3],
|
76
|
-
# ["lib/inch/cli.rb", 1],
|
77
|
-
# ["lib/inch/version.rb", 1],
|
78
|
-
#
|
79
|
-
# @return [Array<Array(String, Fixnum)>]
|
73
|
+
# @return [Array<CodeLocation>]
|
80
74
|
def files
|
81
75
|
object.files.map do |(filename, line_no)|
|
82
76
|
CodeLocation.new(base_dir, filename, line_no)
|
@@ -202,8 +196,8 @@ module Inch
|
|
202
196
|
@__private_tag
|
203
197
|
end
|
204
198
|
|
205
|
-
def
|
206
|
-
|
199
|
+
def tagged_as_internal_api?
|
200
|
+
private_api_tag? || docstring.describes_internal_api?
|
207
201
|
end
|
208
202
|
|
209
203
|
def protected?
|
@@ -220,7 +214,7 @@ module Inch
|
|
220
214
|
|
221
215
|
# @return [Boolean] +true+ if the object has no documentation at all
|
222
216
|
def undocumented?
|
223
|
-
|
217
|
+
original_docstring.empty?
|
224
218
|
end
|
225
219
|
|
226
220
|
def unconsidered_tag_count
|
@@ -237,6 +231,14 @@ module Inch
|
|
237
231
|
text.scan(/\b(#{Regexp.escape(name)})[^_0-9\!\?]/m).size > 1
|
238
232
|
end
|
239
233
|
|
234
|
+
def original_docstring
|
235
|
+
object.docstring.all
|
236
|
+
end
|
237
|
+
|
238
|
+
def private_api_tag?
|
239
|
+
api_tag && api_tag.text == 'private'
|
240
|
+
end
|
241
|
+
|
240
242
|
def tag(name)
|
241
243
|
tags(name).first
|
242
244
|
end
|
@@ -103,7 +103,7 @@ module Inch
|
|
103
103
|
Role::Object::WithoutCodeExample => score_for(:code_example_single),
|
104
104
|
Role::Object::Tagged => score_for_unconsidered_tags,
|
105
105
|
Role::Object::TaggedAsAPI => nil,
|
106
|
-
Role::Object::
|
106
|
+
Role::Object::TaggedAsInternalAPI => nil,
|
107
107
|
}
|
108
108
|
end
|
109
109
|
|
@@ -41,7 +41,7 @@ module Inch
|
|
41
41
|
end
|
42
42
|
|
43
43
|
# Role assigned to objects explicitly or implicitly tagged to be part
|
44
|
-
# of an API. If the API is 'private'
|
44
|
+
# of an API. If the API is 'private'/'internal' TaggedAsInternalAPI is assigned
|
45
45
|
# instead.
|
46
46
|
class TaggedAsAPI < Base
|
47
47
|
applicable_if :api_tag?
|
@@ -49,8 +49,8 @@ module Inch
|
|
49
49
|
|
50
50
|
# Role assigned to objects explicitly or implicitly tagged to be part
|
51
51
|
# of a private API.
|
52
|
-
class
|
53
|
-
applicable_if :
|
52
|
+
class TaggedAsInternalAPI < Base
|
53
|
+
applicable_if :tagged_as_internal_api?
|
54
54
|
|
55
55
|
def priority
|
56
56
|
-5
|
data/lib/inch/version.rb
CHANGED
@@ -10,7 +10,7 @@ describe ::Inch::CodeObject::Provider::YARD::Docstring do
|
|
10
10
|
|
11
11
|
it "should notice things in tomdoc style docs" do
|
12
12
|
text = <<-DOC
|
13
|
-
|
13
|
+
Internal: Detects the Language of the blob.
|
14
14
|
|
15
15
|
param1 - String filename
|
16
16
|
param2 - String blob data. A block also maybe passed in for lazy
|
@@ -21,6 +21,7 @@ param3 - Optional String mode (defaults to nil)
|
|
21
21
|
Returns Language or nil.
|
22
22
|
DOC
|
23
23
|
docstring = described_class.new(text)
|
24
|
+
assert docstring.describes_internal_api?
|
24
25
|
assert docstring.mentions_parameter?(:param1)
|
25
26
|
assert docstring.mentions_parameter?(:param2)
|
26
27
|
assert docstring.mentions_parameter?(:param3)
|
@@ -12,6 +12,14 @@ describe ::Inch::CodeObject::Proxy::MethodObject do
|
|
12
12
|
assert m.undocumented?
|
13
13
|
end
|
14
14
|
|
15
|
+
def test_tagged_as_internal_api
|
16
|
+
%w( InchTest#internal_api_with_yard
|
17
|
+
InchTest#internal_api_with_tomdoc).each do |fullname|
|
18
|
+
m = @codebase.objects.find(fullname)
|
19
|
+
assert m.tagged_as_internal_api?
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
15
23
|
def test_method_without_doc
|
16
24
|
m = @codebase.objects.find("Foo::Bar#method_without_doc")
|
17
25
|
refute m.has_doc?
|
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.3.1.
|
4
|
+
version: 0.3.1.rc4
|
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: 2014-02-
|
11
|
+
date: 2014-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -290,7 +290,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
290
290
|
version: 1.3.1
|
291
291
|
requirements: []
|
292
292
|
rubyforge_project:
|
293
|
-
rubygems_version: 2.2.
|
293
|
+
rubygems_version: 2.2.0
|
294
294
|
signing_key:
|
295
295
|
specification_version: 4
|
296
296
|
summary: Documentation measurement tool for Ruby
|