rubocop-yard 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40bdb35bd0b95a6bc84afcf35b31d27acfb45eba7dae27862fef99b4fb961f29
4
- data.tar.gz: 00341d80e3051ed88f0ecc390e463c5a6e2edc25f63a4d00ee1b1fba56d83ce2
3
+ metadata.gz: 449e11faef5dc981174c81ee97c4ce139c6129a66fe36e9f9620372ce382912e
4
+ data.tar.gz: 3f4560fca83dece9a2699f5148166dd60f02e64e47e7a9b3fc7856aecd87db90
5
5
  SHA512:
6
- metadata.gz: b63811dcf428762af0afa33d0e237aa44b49846793ab7b19d66d4f5e5c1fd1484081e2b9a1b4ba999b535ea55572704369d484c4266bd28bd77117d9636f3b7c
7
- data.tar.gz: a8c37ca47cfd1bd6dcc0a3f7d6e05f198ade8f7f530ba142593aee19be660c233912ff456f261162f9b9b98f2ed648f89b3cfe1ddce7b5e55f28d865e94bc9d8
6
+ metadata.gz: 6c96ee6d17d64f6009cb3458f8db1f993c2e91c45d7d4446c39b3a92948c12edf75721d1176fe2db68fce5374bcb901a38bed3f10805de8d2b5ae74b8a9c6fad
7
+ data.tar.gz: 3b7fe8c5915caf08361c7ea49e5e81084ec9e3e3513dbb8d688e933a09aca76f30aaa526bf5db4cd9ba990f1819693e4b20bcf5b4a1bd1669bda3bcd404db791
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  ## [Unreleased]
2
2
 
3
+ * `YARD/MeaninglessTag`: Allow `@param` on `Struct.new`/`Data.define` constant assignments (https://github.com/ksss/rubocop-yard/issues/36)
4
+
5
+ ## [1.1.0] - 2026-01-29
6
+
7
+ * Fix NoMethodError when method signature includes **nil by @ksss in https://github.com/ksss/rubocop-yard/pull/39
8
+ * Migrate smoke tests to RSpec by @ksss in https://github.com/ksss/rubocop-yard/pull/38
9
+
10
+ ## [1.0.0] - 2025-06-21
11
+
12
+ * Use plugins instead of require by @sue445 in https://github.com/ksss/rubocop-yard/pull/34
13
+
3
14
  ## [0.10.0] - 2024-11-20
4
15
 
5
16
  * Guess argument types by @ksss in https://github.com/ksss/rubocop-yard/pull/32
@@ -19,12 +19,26 @@ module RuboCop
19
19
  #
20
20
  # # good
21
21
  # CONST = 1
22
+ #
23
+ # # good (Struct/Data constant assignments accept @param)
24
+ # # @param name [String]
25
+ # # @param age [Integer]
26
+ # Person = Struct.new(:name, :age, keyword_init: true)
22
27
  class MeaninglessTag < Base
23
28
  include YARD::Helper
24
29
  include RangeHelp
25
30
  include DocumentationComment
26
31
  extend AutoCorrector
27
32
 
33
+ # @!method struct_or_data_definition?(node)
34
+ # @param node [RuboCop::AST::Node]
35
+ def_node_matcher :struct_or_data_definition?, <<~PATTERN
36
+ (casgn _ _ {
37
+ (block (send (const _ {:Struct :Data}) {:new :define} ...) ...)
38
+ (send (const _ {:Struct :Data}) {:new :define} ...)
39
+ })
40
+ PATTERN
41
+
28
42
  def on_class(node)
29
43
  check(node)
30
44
  end
@@ -40,6 +54,7 @@ module RuboCop
40
54
 
41
55
  docstring.tags.each do |tag|
42
56
  next unless tag.tag_name == 'param' || tag.tag_name == 'option'
57
+ next if tag.tag_name == 'param' && struct_or_data_definition?(node)
43
58
 
44
59
  comment = preceding_lines.find { |line| line.text.include?("@#{tag.tag_name}") }
45
60
  next unless comment
@@ -72,7 +72,8 @@ module RuboCop
72
72
  end
73
73
  node.arguments.each do |argument|
74
74
  next if argument.type == :blockarg
75
- next if argument.name.nil?
75
+ next if argument.type == :kwnilarg
76
+ next if !argument.respond_to?(:name) || argument.name.nil?
76
77
 
77
78
  found = docstring.tags.find do |tag|
78
79
  next unless tag.tag_name == 'param' || tag.tag_name == 'option'
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module YARD
5
- VERSION = "1.0.0"
5
+ VERSION = "1.2.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-yard
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ksss
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  requirements: []
103
- rubygems_version: 3.7.0.dev
103
+ rubygems_version: 4.0.3
104
104
  specification_version: 4
105
105
  summary: Check yardoc format.
106
106
  test_files: []