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: cda3975f7c4c00946ceb1e4bd66a3c8df91715a6
4
- data.tar.gz: d5f36041326be52c7c0e5959dcfe776133a768d0
3
+ metadata.gz: 8db784f667f4f70a4d90d9ab4ea5485e38f31590
4
+ data.tar.gz: ff193873fff093ae113b9efde21245b69019f0ad
5
5
  SHA512:
6
- metadata.gz: 1d8dec948b24ed11f4697b2deca0bf47de8eab10a474e61305afef05eade69d2b444aa0d81507658b8849d9bd50fcbedda5ccae2ea90b321132c5532c2744018
7
- data.tar.gz: b2af424aacd0b6a1d6aceb3bca229ed4d069ad81cae8be57308db6c3ceeefab14d7db28f3c2d98d47bf324a6209d06938b0c246525bfd058276ffb7c3655cc49
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
- return_tags.any? do |t|
77
- !t.text.empty? && !YARD.implicit_tag?(t, self)
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
@@ -1,3 +1,3 @@
1
1
  module Inch
2
- VERSION = "0.4.9"
2
+ VERSION = "0.4.10"
3
3
  end
@@ -41,10 +41,14 @@ module Foo
41
41
  def method_without_docstring(p1, p2 = nil)
42
42
  end
43
43
 
44
- # @return [void]
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#method_without_docstring\b/, out
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#method_without_docstring\b/, out
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#method_without_docstring\b/, out
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.9
4
+ version: 0.4.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - René Föhring