rubocop-yard 0.9.0 → 0.9.1

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
  SHA256:
3
- metadata.gz: 06747e91e4d94f896cb88e9fb16826b8863afb224451a97a55aedbe0e0c36517
4
- data.tar.gz: 8f8eb7d93d78b2f23b356850e346e82f1cdf187b40fc2e17e584751a5929774a
3
+ metadata.gz: 2b240277d34c92f69d7a7b3bf0cc2de5e6db342a668dd2b3426faad8f693b36d
4
+ data.tar.gz: d682c69f314766eb8e6ba49ac5ebb6d1c4dbe2cd3bed4c8e9d675ba49e347533
5
5
  SHA512:
6
- metadata.gz: 7a299956fd71c933d0d4aa59d68c273cd49e481b61be404f1a071b6051d8c874e18f7de1a27b1b3d59b72c6e3ee098ec554d1bb5c06e94971cc4bb04e4890555
7
- data.tar.gz: e940c21c3172cc9ba385f16d227418006406af7c44f34a7c1da32ee53dabfa3062d7e83b2a2351671a7a68d9c4457f4672df574e5d71a1e68fcf406fa5da98e2
6
+ metadata.gz: c02ef119ea3d56b064ffc1770ae0abc28d8e519eef44516b1ae5e14bb34347b494782d0e0d7a32d9db996d271513ae234e06234e85d61e8175efd0a7a7397162
7
+ data.tar.gz: 162842c1675a778c33063ead865a10515c4665821751e3d05f222b5437369d06a62837ddcf1950bdc18775be4a46b8864e94489287464835d9db221d01557350
@@ -75,6 +75,17 @@ module RuboCop
75
75
  def inline_comment?(comment)
76
76
  !comment_line?(comment.source_range.source_line)
77
77
  end
78
+
79
+ def build_docstring(preceding_lines)
80
+ comment_texts = preceding_lines.map { |l| l.text.gsub(/\A#/, '') }
81
+ minimum_space = comment_texts.map { |t| t.index(/[^\s]/) }.min
82
+ yard_docstring = comment_texts.map { |t| t[minimum_space..-1] }.join("\n")
83
+ begin
84
+ ::YARD::DocstringParser.new.parse(yard_docstring)
85
+ rescue
86
+ nil
87
+ end
88
+ end
78
89
  end
79
90
  end
80
91
  end
@@ -20,6 +20,7 @@ module RuboCop
20
20
  # # good
21
21
  # CONST = 1
22
22
  class MeaninglessTag < Base
23
+ include YARD::Helper
23
24
  include RangeHelp
24
25
  include DocumentationComment
25
26
  extend AutoCorrector
@@ -34,8 +35,9 @@ module RuboCop
34
35
  preceding_lines = preceding_lines(node)
35
36
  return false unless preceding_comment?(node, preceding_lines.last)
36
37
 
37
- yard_docstring = preceding_lines.map { |line| line.text.gsub(/\A#\s*/, '') }.join("\n")
38
- docstring = ::YARD::DocstringParser.new.parse(yard_docstring)
38
+ docstring = build_docstring(preceding_lines)
39
+ return false unless docstring
40
+
39
41
  docstring.tags.each do |tag|
40
42
  next unless tag.tag_name == 'param' || tag.tag_name == 'option'
41
43
 
@@ -28,12 +28,8 @@ module RuboCop
28
28
  preceding_lines = preceding_lines(node)
29
29
  return false unless preceding_comment?(node, preceding_lines.last)
30
30
 
31
- yard_docstring = preceding_lines.map { |line| line.text.gsub(/\A#\s*/, '') }.join("\n")
32
- docstring = begin
33
- ::YARD::DocstringParser.new.parse(yard_docstring)
34
- rescue
35
- return false
36
- end
31
+ docstring = build_docstring(preceding_lines)
32
+ return false unless docstring
37
33
 
38
34
  return false if include_overload_tag?(docstring)
39
35
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module YARD
5
- VERSION = "0.9.0"
5
+ VERSION = "0.9.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-yard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ksss
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-06 00:00:00.000000000 Z
11
+ date: 2023-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop