rubocop-yard 1.1.0 → 1.3.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: d52a54c55381be3ea917d1d52e64a36e7b2262e4758f2408c77468f5bfa09815
4
- data.tar.gz: 6d9f2f8e4dcccdaba87a55596bd6741479e2238ae39657fc65638578eff173d7
3
+ metadata.gz: 1899df376dd3954bb74cccef087aa23643d16a8c585965cafc732d2463ef408f
4
+ data.tar.gz: 6b268c4978625ffd07dbdcfa971f57df5442fcea0dfa1833b7570754f1758042
5
5
  SHA512:
6
- metadata.gz: a2adb53a2daa313c7dfc8cbf5a238deb4904cde7783bcdab476ce823f018bed11587b33f88214587afc9f6be5723742edc2b250f8651045cb88a1851ed6a94e8
7
- data.tar.gz: 0323d3765e33329d3ff345290cd3306676e4cbbf27d3c946da87627c1e98030a1591be102958e56f683131d37bbdf9cc7fe04af424dfce6db11264e105c5e1d3
6
+ metadata.gz: 1db8c39281f661263e7c9f3afc99e5155ad5ee566d6c0025519850e5585e6bc22c617e37b3772a41f7ca4d9c574af65ee853d8ed89f09af9537f66381f3d197a
7
+ data.tar.gz: 95a2d49c434ea46b6b86dee06347c96f0522cbcedcd5a34699536beec0009f7d8fe877ea352f79dcf57079186a8f6f5ae40c4454dbe40c06d4a1deabedddd254
data/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
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
+
3
5
  ## [1.1.0] - 2026-01-29
4
6
 
5
7
  * Fix NoMethodError when method signature includes **nil by @ksss in https://github.com/ksss/rubocop-yard/pull/39
@@ -25,6 +25,8 @@ module RuboCop
25
25
 
26
26
  begin
27
27
  types_explainers = parse_type(types.join(', '))
28
+ next if types.size != types_explainers.size
29
+
28
30
  types.zip(types_explainers).each do |type, types_explainer|
29
31
  block.call(type, types_explainer)
30
32
  end
@@ -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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module YARD
5
- VERSION = "1.1.0"
5
+ VERSION = "1.3.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.1.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ksss
@@ -93,14 +93,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 3.0.0
96
+ version: 3.3.0
97
97
  required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  requirements:
99
99
  - - ">="
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  requirements: []
103
- rubygems_version: 4.0.3
103
+ rubygems_version: 4.0.10
104
104
  specification_version: 4
105
105
  summary: Check yardoc format.
106
106
  test_files: []