inch 0.4.9 → 0.4.10
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8db784f667f4f70a4d90d9ab4ea5485e38f31590
|
4
|
+
data.tar.gz: ff193873fff093ae113b9efde21245b69019f0ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff12fd72f9f142eb7ae4217f003f5f4579f1a05f15baf4d95e583b489380096bdd2b041870b7bd5e4bc2ab8e11ebbb51aabdcc2890683e986f9f49d61440e1e8
|
7
|
+
data.tar.gz: 16b3b9c9a18eea2cb34db191565efeaf01f00688b445cd20417ef0446c2a541a02b9ce561da3a89463932fe6b3dc9f302c006571d5c0baba359ed52c6f0c7849
|
@@ -73,9 +73,8 @@ module Inch
|
|
73
73
|
|
74
74
|
# Returns +true+ if a return value is described by words.
|
75
75
|
def return_described?
|
76
|
-
|
77
|
-
|
78
|
-
end || docstring.describes_return? && !implicit_docstring?
|
76
|
+
return_described_via_tag? ||
|
77
|
+
docstring.describes_return? && !implicit_docstring?
|
79
78
|
end
|
80
79
|
|
81
80
|
def return_typed?
|
@@ -145,6 +144,19 @@ module Inch
|
|
145
144
|
overloaded_return_tags +
|
146
145
|
attributed_return_tags
|
147
146
|
end
|
147
|
+
|
148
|
+
# Returns +true+ if a return value is described by words.
|
149
|
+
def return_described_via_tag?
|
150
|
+
return_tags.any? do |t|
|
151
|
+
return_tag_describes_unusable_value?(t) ||
|
152
|
+
!t.text.empty? && !YARD.implicit_tag?(t, self)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
def return_tag_describes_unusable_value?(t)
|
157
|
+
return if t.types.nil?
|
158
|
+
t.types.size == 1 && %w(void nil nothing).include?(t.types.first)
|
159
|
+
end
|
148
160
|
end
|
149
161
|
end
|
150
162
|
end
|
data/lib/inch/version.rb
CHANGED
@@ -41,10 +41,14 @@ module Foo
|
|
41
41
|
def method_without_docstring(p1, p2 = nil)
|
42
42
|
end
|
43
43
|
|
44
|
-
# @return [
|
44
|
+
# @return [String]
|
45
45
|
def method_without_params_or_docstring
|
46
46
|
end
|
47
47
|
|
48
|
+
# @return [void]
|
49
|
+
def method_without_usable_return_value
|
50
|
+
end
|
51
|
+
|
48
52
|
# Provides an example of a method without parameters
|
49
53
|
# missing the return type.
|
50
54
|
#
|
@@ -13,7 +13,7 @@ describe ::Inch::CLI::Command::Suggest do
|
|
13
13
|
refute out.empty?, "there should be some output"
|
14
14
|
assert err.empty?, "there should be no errors"
|
15
15
|
assert_match /\bFoo::Bar#method_with_wrong_doc\b/, out
|
16
|
-
assert_match /\bFoo::Bar#
|
16
|
+
assert_match /\bFoo::Bar#method_with_rdoc_doc\b/, out
|
17
17
|
assert_match /\bFoo::Bar#method_with_unstructured_doc\b/, out
|
18
18
|
end
|
19
19
|
|
@@ -32,7 +32,7 @@ describe ::Inch::CLI::Command::Suggest do
|
|
32
32
|
refute out.empty?, "there should be some output"
|
33
33
|
assert err.empty?, "there should be no errors"
|
34
34
|
assert_match /\bFoo::Bar#method_with_wrong_doc\b/, out
|
35
|
-
assert_match /\bFoo::Bar#
|
35
|
+
assert_match /\bFoo::Bar#method_with_rdoc_doc\b/, out
|
36
36
|
assert_match /\bFoo::Bar#method_with_unstructured_doc\b/, out
|
37
37
|
end
|
38
38
|
|
@@ -53,7 +53,7 @@ describe ::Inch::CLI::Command::Suggest do
|
|
53
53
|
refute out.empty?, "there should be some output"
|
54
54
|
assert err.empty?, "there should be no errors"
|
55
55
|
assert_match /\bFoo::Bar#method_with_wrong_doc\b/, out
|
56
|
-
assert_match /\bFoo::Bar#
|
56
|
+
assert_match /\bFoo::Bar#method_with_rdoc_doc\b/, out
|
57
57
|
assert_match /\bFoo::Bar#method_with_unstructured_doc\b/, out
|
58
58
|
end
|
59
59
|
|
@@ -99,6 +99,15 @@ describe ::Inch::CodeObject::Proxy::MethodObject do
|
|
99
99
|
refute m.has_doc?
|
100
100
|
refute m.has_parameters?
|
101
101
|
assert m.return_mentioned?
|
102
|
+
refute m.return_described?
|
103
|
+
|
104
|
+
assert m.score
|
105
|
+
end
|
106
|
+
|
107
|
+
it "should handle unusable return value when only @return [void] is given" do
|
108
|
+
m = @objects.find("Foo::Bar#method_without_usable_return_value")
|
109
|
+
assert m.return_mentioned?
|
110
|
+
assert m.return_described?
|
102
111
|
|
103
112
|
assert m.score
|
104
113
|
end
|