inch 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -0
- data/README.md +2 -28
- data/TODOS.md +1 -3
- data/bin/inch +6 -0
- data/lib/inch/code_object/docstring.rb +7 -2
- data/lib/inch/code_object/proxy/method_object.rb +8 -0
- data/lib/inch/evaluation/method_object.rb +12 -1
- data/lib/inch/evaluation/role/method.rb +6 -1
- data/lib/inch/version.rb +1 -1
- data/test/fixtures/simple/lib/role_methods.rb +4 -0
- data/test/inch/code_object/docstring_test.rb +3 -0
- data/test/inch/code_object/proxy/method_object_test.rb +166 -0
- data/test/inch/code_object/proxy_test.rb +0 -149
- data/test/test_helper.rb +7 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 252dd36f4749f380d6f1a5c6c78ebf39cbb6a02b
|
4
|
+
data.tar.gz: 189e4afb63928cfda6dceab1f855b8633a5490d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41efced3e37aac30b9a83ce7c278f0ea2e35d952f087242e24c11a59c2ad8ec8d4dd4a565023d8350c462afc46d21258478ce475c83bcf5cc4fe6126583fde3d
|
7
|
+
data.tar.gz: 4f5b2baba065d521af008bffeaa1f911e0d54024865fa31c5167bf9a677aa42863a20231c7e52c9dbab55f51710babfd6951f3b16aabc57480555c740a2cb9ed
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -3,9 +3,8 @@
|
|
3
3
|
Inch is a documentation measurement tool for Ruby, based on
|
4
4
|
[YARD](http://yardoc.org/).
|
5
5
|
|
6
|
-
It does not measure
|
7
|
-
|
8
|
-
One Inch at a time.
|
6
|
+
It does not measure *coverage*, but grades your documentation to give you
|
7
|
+
hints where to improve your docs. One Inch at a time.
|
9
8
|
|
10
9
|
|
11
10
|
## Installation
|
@@ -140,25 +139,19 @@ Suggests places where a codebase suffers a lack of documentation.
|
|
140
139
|
|
141
140
|
# Properly documented, could be improved:
|
142
141
|
|
143
|
-
┃ B ↑ Inch::CLI::Command::BaseObject#prepare_objects
|
144
142
|
┃ B ↑ Inch::CLI::Command::BaseList#prepare_list
|
145
|
-
┃ B ↑ Inch::CLI::Command::Suggest#run
|
146
|
-
┃ B ↑ Inch::CLI::Command::List#run
|
147
143
|
┃ B ↑ Inch::CodeObject::Proxy::MethodParameterObject#initialize
|
148
144
|
┃ B ↗ Inch::CLI::Command::Stats#run
|
149
145
|
┃ B ↗ Inch::CLI::CommandParser#run
|
150
|
-
┃ B ↗ Inch::CLI::CommandParser.run
|
151
146
|
|
152
147
|
# Not properly documented:
|
153
148
|
|
154
149
|
┃ C ↑ Inch::CodeObject::NodocHelper#implicit_nodoc_comment?
|
155
|
-
┃ C ↑ Inch::CLI::Command::Output::Console#initialize
|
156
150
|
┃ C ↑ Inch::CLI::Command::Output::Suggest#initialize
|
157
151
|
┃ C ↑ Inch::Rake::Suggest#initialize
|
158
152
|
|
159
153
|
# Undocumented:
|
160
154
|
|
161
|
-
┃ U ↑ Inch::Evaluation::NamespaceObject#evaluate
|
162
155
|
┃ U ↑ Inch::Evaluation::ConstantObject#evaluate
|
163
156
|
┃ U ↑ Inch::Evaluation::MethodObject#evaluate
|
164
157
|
┃ U ↑ Inch::SourceParser#find_object
|
@@ -167,8 +160,6 @@ Suggests places where a codebase suffers a lack of documentation.
|
|
167
160
|
|
168
161
|
┃ lib/inch/code_object/proxy/base.rb
|
169
162
|
┃ lib/inch/code_object/proxy/method_object.rb
|
170
|
-
┃ lib/inch/evaluation/role/constant.rb
|
171
|
-
┃ lib/inch/evaluation/role/method_parameter.rb
|
172
163
|
┃ lib/inch/evaluation/role/object.rb
|
173
164
|
|
174
165
|
Grade distribution (undocumented, C, B, A): █ ▃ ▁ ▄
|
@@ -244,41 +235,24 @@ Lists all objects in your codebase with their grades.
|
|
244
235
|
# Seems really good
|
245
236
|
|
246
237
|
┃ A ↑ Inch::CLI::Command::Output::Console#object
|
247
|
-
┃ A ↗ Inch
|
248
238
|
┃ A ↗ Inch::CodeObject::Proxy::Base#depth
|
249
|
-
┃ A ↗ Inch::CodeObject::Proxy::Base#height
|
250
239
|
┃ A ↗ Inch::CLI::Command::Base#description
|
251
240
|
┃ A ↗ Inch::CodeObject::NodocHelper#nodoc?
|
252
|
-
┃ A ↗ Inch::CLI::YardoptsHelper#parse_yardopts_options
|
253
|
-
┃ A ↗ Inch::Evaluation::NamespaceObject
|
254
|
-
┃ A ↗ Inch::SourceParser
|
255
|
-
┃ A ↗ Inch::Evaluation::ScoreRange#range=
|
256
241
|
┃ ... (omitting 75 objects)
|
257
242
|
|
258
243
|
# Proper documentation present
|
259
244
|
|
260
245
|
┃ B ↑ Inch::CLI::Command::Suggest#run
|
261
|
-
┃ B ↑ Inch::CLI::Command::List#run
|
262
246
|
┃ B ↑ Inch::CodeObject::Proxy::MethodParameterObject#initialize
|
263
247
|
┃ B ↗ Inch::CLI::Command::Stats#run
|
264
248
|
┃ B ↗ Inch::CLI::CommandParser#run
|
265
|
-
┃ B ↗ Inch::CLI::CommandParser.run
|
266
|
-
┃ B ↗ Inch::CLI::Command::Base.run
|
267
|
-
┃ B ↗ Inch::Evaluation::Base#object=
|
268
|
-
┃ B ↗ Inch::CodeObject::Proxy::Base#object=
|
269
249
|
|
270
250
|
# Needs work
|
271
251
|
|
272
|
-
┃ C ↑ Inch::CLI::Command::Output::Stats#initialize
|
273
|
-
┃ C ↑ Inch::CLI::Command::Output::Suggest#initialize
|
274
252
|
┃ C ↑ Inch::CodeObject::NodocHelper#implicit_nodoc_comment?
|
275
253
|
┃ C ↑ Inch::CLI::Command::Output::Console#initialize
|
276
|
-
┃ C ↑ Inch::Evaluation::NamespaceObject#evaluate
|
277
254
|
┃ C ↑ Inch::Evaluation::ConstantObject#evaluate
|
278
255
|
┃ C ↑ Inch::SourceParser#find_object
|
279
|
-
┃ C ↑ Inch::Evaluation::MethodObject#evaluate
|
280
|
-
┃ C ↗ Inch::CLI::Command::Show#run
|
281
|
-
┃ C ↗ Inch::CodeObject::Proxy::Base
|
282
256
|
┃ ... (omitting 248 objects)
|
283
257
|
|
284
258
|
This output omitted 323 objects. Use `--all` to display all objects.
|
data/TODOS.md
CHANGED
@@ -7,6 +7,4 @@
|
|
7
7
|
visibility options
|
8
8
|
* Add support for multiple signatures for methods
|
9
9
|
(realized via the @overload tag in YARD)
|
10
|
-
*
|
11
|
-
mark -- maybe this is a problem since those methods appear as `C` in
|
12
|
-
the output, even if they don't have any other documentation
|
10
|
+
* Make `inch lib/optparse.rb` work (without explicit `suggest`)
|
data/bin/inch
CHANGED
@@ -5,6 +5,12 @@ begin
|
|
5
5
|
Bundler.require
|
6
6
|
rescue Bundler::GemfileNotFound
|
7
7
|
ensure
|
8
|
+
path = __FILE__
|
9
|
+
while File.symlink?(path)
|
10
|
+
path = File.expand_path(File.readlink(path), File.dirname(path))
|
11
|
+
end
|
12
|
+
$:.unshift(File.join(File.dirname(File.expand_path(path)), '..', 'lib'))
|
13
|
+
|
8
14
|
require 'inch'
|
9
15
|
end
|
10
16
|
|
@@ -33,6 +33,10 @@ module Inch
|
|
33
33
|
@text.lines.last =~ /^Returns\ /
|
34
34
|
end
|
35
35
|
|
36
|
+
def describes_return?
|
37
|
+
@text.lines.last =~ /^Returns\ (\w+\s){2,}/
|
38
|
+
end
|
39
|
+
|
36
40
|
def parse_code_examples
|
37
41
|
code_examples = []
|
38
42
|
example = nil
|
@@ -76,10 +80,11 @@ module Inch
|
|
76
80
|
end
|
77
81
|
|
78
82
|
def describe_parameter_regexps(name)
|
79
|
-
mention_parameter_patterns(name).map do |pattern|
|
83
|
+
same_line_regexps = mention_parameter_patterns(name).map do |pattern|
|
80
84
|
r = pattern.is_a?(Regexp) ? pattern : Regexp.escape(pattern)
|
81
85
|
/^#{r}\s?\S+/
|
82
|
-
end
|
86
|
+
end
|
87
|
+
same_line_regexps + describe_parameter_extra_regexps(name)
|
83
88
|
end
|
84
89
|
|
85
90
|
def mention_parameter_regexps(name)
|
@@ -58,6 +58,14 @@ module Inch
|
|
58
58
|
!!return_tag || docstring.mentions_return?
|
59
59
|
end
|
60
60
|
|
61
|
+
def return_described?
|
62
|
+
(return_tag && !return_tag.text.empty?) || docstring.describes_return?
|
63
|
+
end
|
64
|
+
|
65
|
+
def questioning_name?
|
66
|
+
name =~ /\?$/
|
67
|
+
end
|
68
|
+
|
61
69
|
private
|
62
70
|
|
63
71
|
def all_parameter_names
|
@@ -22,6 +22,9 @@ module Inch
|
|
22
22
|
if object.bang_name?
|
23
23
|
add_role Role::Method::WithBangName.new(object)
|
24
24
|
end
|
25
|
+
if object.questioning_name?
|
26
|
+
add_role Role::Method::WithQuestioningName.new(object)
|
27
|
+
end
|
25
28
|
if object.has_alias?
|
26
29
|
add_role Role::Method::HasAlias.new(object)
|
27
30
|
end
|
@@ -117,7 +120,15 @@ module Inch
|
|
117
120
|
|
118
121
|
def eval_return_type
|
119
122
|
if object.return_mentioned?
|
120
|
-
|
123
|
+
if object.questioning_name? && !object.return_described?
|
124
|
+
# annotating a question mark method with the return type boolean
|
125
|
+
# does not give any points
|
126
|
+
# also, this could to be one of those cases where YARD
|
127
|
+
# automatically assigns a @return tag to methods ending in a
|
128
|
+
# question mark
|
129
|
+
else
|
130
|
+
add_role Role::Method::WithReturnType.new(object, RETURN_SCORE)
|
131
|
+
end
|
121
132
|
else
|
122
133
|
add_role Role::Method::WithoutReturnType.new(object, RETURN_SCORE)
|
123
134
|
end
|
@@ -22,6 +22,11 @@ module Inch
|
|
22
22
|
+3
|
23
23
|
end
|
24
24
|
end
|
25
|
+
class WithQuestioningName < Base
|
26
|
+
def priority
|
27
|
+
-4
|
28
|
+
end
|
29
|
+
end
|
25
30
|
class HasAlias < Base
|
26
31
|
# +priority
|
27
32
|
def priority
|
@@ -33,7 +38,7 @@ module Inch
|
|
33
38
|
end
|
34
39
|
class WithoutReturnType < Missing
|
35
40
|
def suggestion
|
36
|
-
"Describe
|
41
|
+
"Describe what '#{object.name}' returns"
|
37
42
|
end
|
38
43
|
end
|
39
44
|
|
data/lib/inch/version.rb
CHANGED
@@ -29,6 +29,7 @@ DOC
|
|
29
29
|
assert docstring.describes_parameter?(:param3)
|
30
30
|
refute docstring.contains_code_example?
|
31
31
|
assert docstring.mentions_return?
|
32
|
+
assert docstring.describes_return?
|
32
33
|
end
|
33
34
|
|
34
35
|
it "should notice things in tomdoc style docs 2" do
|
@@ -51,6 +52,7 @@ DOC
|
|
51
52
|
refute docstring.mentions_parameter?(:Look)
|
52
53
|
assert docstring.contains_code_example?
|
53
54
|
assert docstring.mentions_return?
|
55
|
+
assert docstring.describes_return?
|
54
56
|
end
|
55
57
|
|
56
58
|
it "should notice things in tomdoc style docs 3" do
|
@@ -73,6 +75,7 @@ DOC
|
|
73
75
|
refute docstring.mentions_parameter?(:Look)
|
74
76
|
assert docstring.contains_code_example?
|
75
77
|
assert docstring.mentions_return?
|
78
|
+
assert docstring.describes_return?
|
76
79
|
end
|
77
80
|
|
78
81
|
|
@@ -0,0 +1,166 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../../test_helper')
|
2
|
+
|
3
|
+
describe ::Inch::CodeObject::Proxy::MethodObject do
|
4
|
+
before do
|
5
|
+
Dir.chdir fixture_path(:simple)
|
6
|
+
@source_parser ||= Inch::SourceParser.run(["lib/**/*.rb"])
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_method_without_doc
|
10
|
+
m = @source_parser.find_object("Foo::Bar#method_without_doc")
|
11
|
+
refute m.has_doc?
|
12
|
+
refute m.has_parameters?
|
13
|
+
refute m.return_mentioned?
|
14
|
+
assert m.undocumented?
|
15
|
+
|
16
|
+
assert_equal 0, m.score
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_method_with_missing_param_doc
|
20
|
+
m = @source_parser.find_object("Foo::Bar#method_with_missing_param_doc")
|
21
|
+
assert m.has_doc?
|
22
|
+
assert m.has_parameters?
|
23
|
+
assert m.return_mentioned?
|
24
|
+
|
25
|
+
assert_equal 3, m.parameters.size
|
26
|
+
p = m.parameter(:param1)
|
27
|
+
assert p.mentioned?
|
28
|
+
p = m.parameter(:param2)
|
29
|
+
assert p.mentioned?
|
30
|
+
p = m.parameter(:param3)
|
31
|
+
refute p.mentioned?
|
32
|
+
|
33
|
+
assert m.score
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_method_with_wrong_doc
|
37
|
+
m = @source_parser.find_object("Foo::Bar#method_with_wrong_doc")
|
38
|
+
assert m.has_doc?
|
39
|
+
assert m.has_parameters?
|
40
|
+
assert m.return_mentioned?
|
41
|
+
|
42
|
+
assert_equal 4, m.parameters.size
|
43
|
+
p = m.parameter(:param1)
|
44
|
+
assert p.mentioned? # mentioned in docs, correctly
|
45
|
+
refute p.wrongly_mentioned?
|
46
|
+
p = m.parameter(:param2)
|
47
|
+
refute p.mentioned?
|
48
|
+
refute p.wrongly_mentioned? # not mentioned in docs at all
|
49
|
+
p = m.parameter(:param3)
|
50
|
+
refute p.mentioned?
|
51
|
+
refute p.wrongly_mentioned? # not mentioned in docs at all
|
52
|
+
p = m.parameter(:param4)
|
53
|
+
assert p.mentioned?
|
54
|
+
assert p.wrongly_mentioned? # mentioned in docs, but not present
|
55
|
+
|
56
|
+
assert m.score
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_method_with_full_doc
|
60
|
+
m = @source_parser.find_object("Foo::Bar#method_with_full_doc")
|
61
|
+
assert m.has_doc?
|
62
|
+
assert m.has_parameters?
|
63
|
+
assert m.return_mentioned?
|
64
|
+
|
65
|
+
assert_equal 2, m.parameters.size
|
66
|
+
m.parameters.each do |param|
|
67
|
+
assert param.mentioned?
|
68
|
+
assert param.typed?
|
69
|
+
assert param.described?
|
70
|
+
refute param.wrongly_mentioned?
|
71
|
+
end
|
72
|
+
|
73
|
+
assert_equal 100, m.score
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_method_without_params_or_return_type
|
77
|
+
m = @source_parser.find_object("Foo::Bar#method_without_params_or_return_type")
|
78
|
+
assert m.has_doc?
|
79
|
+
refute m.has_parameters?
|
80
|
+
refute m.return_mentioned?
|
81
|
+
|
82
|
+
assert m.score
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_method_without_docstring
|
86
|
+
m = @source_parser.find_object("Foo::Bar#method_without_docstring")
|
87
|
+
refute m.has_doc?
|
88
|
+
assert m.has_parameters?
|
89
|
+
assert m.return_mentioned?
|
90
|
+
|
91
|
+
assert m.score
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_method_without_params_or_docstring
|
95
|
+
m = @source_parser.find_object("Foo::Bar#method_without_params_or_docstring")
|
96
|
+
refute m.has_doc?
|
97
|
+
refute m.has_parameters?
|
98
|
+
assert m.return_mentioned?
|
99
|
+
|
100
|
+
assert m.score
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_method_with_rdoc_doc
|
104
|
+
m = @source_parser.find_object("Foo::Bar#method_with_rdoc_doc")
|
105
|
+
assert m.has_doc?
|
106
|
+
assert m.has_parameters?
|
107
|
+
p = m.parameter(:param1)
|
108
|
+
assert p.mentioned? # mentioned in docs, correctly
|
109
|
+
refute m.return_mentioned?
|
110
|
+
|
111
|
+
assert m.score
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_method_with_other_rdoc_doc
|
115
|
+
m = @source_parser.find_object("Foo::Bar#method_with_other_rdoc_doc")
|
116
|
+
assert m.has_doc?
|
117
|
+
assert m.has_parameters?
|
118
|
+
p = m.parameter(:param1)
|
119
|
+
assert p.mentioned? # mentioned in docs, correctly
|
120
|
+
p = m.parameter(:param2)
|
121
|
+
assert p.mentioned? # mentioned in docs, correctly
|
122
|
+
p = m.parameter(:param3)
|
123
|
+
assert p.mentioned? # mentioned in docs, correctly
|
124
|
+
refute m.return_mentioned?
|
125
|
+
|
126
|
+
assert m.score
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_method_with_unstructured_doc
|
130
|
+
m = @source_parser.find_object("Foo::Bar#method_with_unstructured_doc")
|
131
|
+
assert m.has_doc?
|
132
|
+
assert m.has_parameters?
|
133
|
+
p = m.parameter(:param1)
|
134
|
+
assert p.mentioned? # mentioned in docs, correctly
|
135
|
+
refute m.return_mentioned?
|
136
|
+
|
137
|
+
assert m.score
|
138
|
+
end
|
139
|
+
|
140
|
+
def test_method_with_unstructured_doc_missing_params
|
141
|
+
m = @source_parser.find_object("Foo::Bar#method_with_unstructured_doc_missing_params")
|
142
|
+
assert m.has_doc?
|
143
|
+
assert m.has_parameters?
|
144
|
+
p = m.parameter(:format)
|
145
|
+
refute p.mentioned? # mentioned in docs, correctly
|
146
|
+
refute m.return_mentioned?
|
147
|
+
|
148
|
+
assert m.score
|
149
|
+
end
|
150
|
+
|
151
|
+
def test_question_mark_method
|
152
|
+
m = @source_parser.find_object("InchTest#question_mark_method?")
|
153
|
+
refute m.has_doc?
|
154
|
+
refute m.has_parameters?
|
155
|
+
|
156
|
+
assert_equal 0, m.score
|
157
|
+
end
|
158
|
+
|
159
|
+
def test_question_mark_method_with_description
|
160
|
+
m = @source_parser.find_object("InchTest#question_mark_method_with_description?")
|
161
|
+
refute m.has_doc?
|
162
|
+
refute m.has_parameters?
|
163
|
+
|
164
|
+
assert m.score > 0
|
165
|
+
end
|
166
|
+
end
|
@@ -1,154 +1,5 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
|
2
2
|
|
3
|
-
describe ::Inch::CodeObject::Proxy::Base do
|
4
|
-
before do
|
5
|
-
Dir.chdir fixture_path(:simple)
|
6
|
-
@source_parser ||= Inch::SourceParser.run(["lib/**/*.rb"])
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_method_without_doc
|
10
|
-
m = @source_parser.find_object("Foo::Bar#method_without_doc")
|
11
|
-
refute m.has_doc?
|
12
|
-
refute m.has_parameters?
|
13
|
-
refute m.return_mentioned?
|
14
|
-
assert m.undocumented?
|
15
|
-
|
16
|
-
assert_equal 0, m.score
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_method_with_missing_param_doc
|
20
|
-
m = @source_parser.find_object("Foo::Bar#method_with_missing_param_doc")
|
21
|
-
assert m.has_doc?
|
22
|
-
assert m.has_parameters?
|
23
|
-
assert m.return_mentioned?
|
24
|
-
|
25
|
-
assert_equal 3, m.parameters.size
|
26
|
-
p = m.parameter(:param1)
|
27
|
-
assert p.mentioned?
|
28
|
-
p = m.parameter(:param2)
|
29
|
-
assert p.mentioned?
|
30
|
-
p = m.parameter(:param3)
|
31
|
-
refute p.mentioned?
|
32
|
-
|
33
|
-
assert m.score
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_method_with_wrong_doc
|
37
|
-
m = @source_parser.find_object("Foo::Bar#method_with_wrong_doc")
|
38
|
-
assert m.has_doc?
|
39
|
-
assert m.has_parameters?
|
40
|
-
assert m.return_mentioned?
|
41
|
-
|
42
|
-
assert_equal 4, m.parameters.size
|
43
|
-
p = m.parameter(:param1)
|
44
|
-
assert p.mentioned? # mentioned in docs, correctly
|
45
|
-
refute p.wrongly_mentioned?
|
46
|
-
p = m.parameter(:param2)
|
47
|
-
refute p.mentioned?
|
48
|
-
refute p.wrongly_mentioned? # not mentioned in docs at all
|
49
|
-
p = m.parameter(:param3)
|
50
|
-
refute p.mentioned?
|
51
|
-
refute p.wrongly_mentioned? # not mentioned in docs at all
|
52
|
-
p = m.parameter(:param4)
|
53
|
-
assert p.mentioned?
|
54
|
-
assert p.wrongly_mentioned? # mentioned in docs, but not present
|
55
|
-
|
56
|
-
assert m.score
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_method_with_full_doc
|
60
|
-
m = @source_parser.find_object("Foo::Bar#method_with_full_doc")
|
61
|
-
assert m.has_doc?
|
62
|
-
assert m.has_parameters?
|
63
|
-
assert m.return_mentioned?
|
64
|
-
|
65
|
-
assert_equal 2, m.parameters.size
|
66
|
-
m.parameters.each do |param|
|
67
|
-
assert param.mentioned?
|
68
|
-
assert param.typed?
|
69
|
-
assert param.described?
|
70
|
-
refute param.wrongly_mentioned?
|
71
|
-
end
|
72
|
-
|
73
|
-
assert_equal 100, m.score
|
74
|
-
end
|
75
|
-
|
76
|
-
def test_method_without_params_or_return_type
|
77
|
-
m = @source_parser.find_object("Foo::Bar#method_without_params_or_return_type")
|
78
|
-
assert m.has_doc?
|
79
|
-
refute m.has_parameters?
|
80
|
-
refute m.return_mentioned?
|
81
|
-
|
82
|
-
assert m.score
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_method_without_docstring
|
86
|
-
m = @source_parser.find_object("Foo::Bar#method_without_docstring")
|
87
|
-
refute m.has_doc?
|
88
|
-
assert m.has_parameters?
|
89
|
-
assert m.return_mentioned?
|
90
|
-
|
91
|
-
assert m.score
|
92
|
-
end
|
93
|
-
|
94
|
-
def test_method_without_params_or_docstring
|
95
|
-
m = @source_parser.find_object("Foo::Bar#method_without_params_or_docstring")
|
96
|
-
refute m.has_doc?
|
97
|
-
refute m.has_parameters?
|
98
|
-
assert m.return_mentioned?
|
99
|
-
|
100
|
-
assert m.score
|
101
|
-
end
|
102
|
-
|
103
|
-
def test_method_with_rdoc_doc
|
104
|
-
m = @source_parser.find_object("Foo::Bar#method_with_rdoc_doc")
|
105
|
-
assert m.has_doc?
|
106
|
-
assert m.has_parameters?
|
107
|
-
p = m.parameter(:param1)
|
108
|
-
assert p.mentioned? # mentioned in docs, correctly
|
109
|
-
refute m.return_mentioned?
|
110
|
-
|
111
|
-
assert m.score
|
112
|
-
end
|
113
|
-
|
114
|
-
def test_method_with_other_rdoc_doc
|
115
|
-
m = @source_parser.find_object("Foo::Bar#method_with_other_rdoc_doc")
|
116
|
-
assert m.has_doc?
|
117
|
-
assert m.has_parameters?
|
118
|
-
p = m.parameter(:param1)
|
119
|
-
assert p.mentioned? # mentioned in docs, correctly
|
120
|
-
p = m.parameter(:param2)
|
121
|
-
assert p.mentioned? # mentioned in docs, correctly
|
122
|
-
p = m.parameter(:param3)
|
123
|
-
assert p.mentioned? # mentioned in docs, correctly
|
124
|
-
refute m.return_mentioned?
|
125
|
-
|
126
|
-
assert m.score
|
127
|
-
end
|
128
|
-
|
129
|
-
def test_method_with_unstructured_doc
|
130
|
-
m = @source_parser.find_object("Foo::Bar#method_with_unstructured_doc")
|
131
|
-
assert m.has_doc?
|
132
|
-
assert m.has_parameters?
|
133
|
-
p = m.parameter(:param1)
|
134
|
-
assert p.mentioned? # mentioned in docs, correctly
|
135
|
-
refute m.return_mentioned?
|
136
|
-
|
137
|
-
assert m.score
|
138
|
-
end
|
139
|
-
|
140
|
-
def test_method_with_unstructured_doc_missing_params
|
141
|
-
m = @source_parser.find_object("Foo::Bar#method_with_unstructured_doc_missing_params")
|
142
|
-
assert m.has_doc?
|
143
|
-
assert m.has_parameters?
|
144
|
-
p = m.parameter(:format)
|
145
|
-
refute p.mentioned? # mentioned in docs, correctly
|
146
|
-
refute m.return_mentioned?
|
147
|
-
|
148
|
-
assert m.score
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
3
|
describe ::Inch::CodeObject::Proxy::Base do
|
153
4
|
before do
|
154
5
|
Dir.chdir fixture_path(:code_examples)
|
data/test/test_helper.rb
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
require 'simplecov'
|
2
|
-
SimpleCov.start
|
2
|
+
SimpleCov.start do
|
3
|
+
add_filter '/test/'
|
4
|
+
|
5
|
+
add_group 'CLI', 'lib/inch/cli'
|
6
|
+
add_group 'Code Objects', 'lib/inch/code_object'
|
7
|
+
add_group 'Evaluation', 'lib/inch/evaluation'
|
8
|
+
end
|
3
9
|
|
4
10
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
5
11
|
|
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.1.
|
4
|
+
version: 0.1.1
|
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-01-
|
11
|
+
date: 2014-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -105,6 +105,7 @@ files:
|
|
105
105
|
- .gitignore
|
106
106
|
- .ruby-gemset
|
107
107
|
- .ruby-version
|
108
|
+
- .travis.yml
|
108
109
|
- Gemfile
|
109
110
|
- LICENSE
|
110
111
|
- README.md
|
@@ -200,6 +201,7 @@ files:
|
|
200
201
|
- test/inch/cli/yardopts_helper_test.rb
|
201
202
|
- test/inch/code_object/docstring_test.rb
|
202
203
|
- test/inch/code_object/nodoc_helper_test.rb
|
204
|
+
- test/inch/code_object/proxy/method_object_test.rb
|
203
205
|
- test/inch/code_object/proxy_test.rb
|
204
206
|
- test/inch/source_parser_test.rb
|
205
207
|
- test/integration/stats_options_test.rb
|
@@ -251,6 +253,7 @@ test_files:
|
|
251
253
|
- test/inch/cli/yardopts_helper_test.rb
|
252
254
|
- test/inch/code_object/docstring_test.rb
|
253
255
|
- test/inch/code_object/nodoc_helper_test.rb
|
256
|
+
- test/inch/code_object/proxy/method_object_test.rb
|
254
257
|
- test/inch/code_object/proxy_test.rb
|
255
258
|
- test/inch/source_parser_test.rb
|
256
259
|
- test/integration/stats_options_test.rb
|