rubocop-rbs_inline 1.5.4 → 1.5.5

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: 887dbca0ede20b0bc2f948c4468a1795bdd59a22e377602769c6b96cdefa628a
4
- data.tar.gz: b12ec5654d6a54b2dd5389a67c47a8b4adcc8a6ff6784b6426b413fad8a8c0b0
3
+ metadata.gz: 5c49186b8eccbf2e04581f828318839da5405951bf81833fc895eca366d850b8
4
+ data.tar.gz: 6e56027b2905e92da5bbc9ec5f16cfb92027f9a6fce03f15ff9a23b40fb95929
5
5
  SHA512:
6
- metadata.gz: c490a7ed73c4ca80d535ab4bff1e7399a26e414c5d72d86779e6def4d414194635bed3c4ce2e6c7432da78db5d19c32ce745502721d2c7b26b4426553703c9b8
7
- data.tar.gz: bead6840e55e119ba47a58210ba622cd4874131477465790c06621080deb34bd02baa1c60e9029cecf3931211bd2f0ca57242dc2c389a953dff01120d054f080
6
+ metadata.gz: dda3647518169c8fc20fd69e240c762315a7d2483c8bf58a771cb3f3287f366a1dce929a5fc456e2d48c4ad3b8e0a78cc062c6895cb2159738d6326100586fb8
7
+ data.tar.gz: 254f949c7b20a84c115ccbae0b10c23dbcf082ad56065170cb048a25a143eb42d6a3733fa12b85dc315c7b79c2d30c1e45bf3f6af2a620c9a2e7844e1eb8271b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.5.5 (2026-05-19)
4
+
5
+ ### Bug Fixes
6
+
7
+ - **Style/RbsInline/ParametersSeparator**: No longer reports false positives for `# @rbs` method type signature annotations such as `# @rbs (Type) -> ReturnType` or `# @rbs [T] (T) -> T`.
8
+ - **Style/RbsInline/MissingTypeAnnotation**: Recognizes `# @rbs` method type signature annotations (e.g. `# @rbs (Type) -> ReturnType`) as satisfying the `method_type_signature` and `method_type_signature_or_return_annotation` styles.
9
+
3
10
  ## 1.5.4 (2026-03-30)
4
11
 
5
12
  ### Internal
@@ -105,7 +105,7 @@ module RuboCop
105
105
  max_end_col = node.arguments.map do |arg|
106
106
  comma_length = arg.equal?(last_arg) ? 0 : 1
107
107
  arg.location.column + source!(arg).length + comma_length
108
- end.max || 0 # steep:ignore
108
+ end.max || 0
109
109
 
110
110
  max_end_col + 2
111
111
  end
@@ -161,7 +161,7 @@ module RuboCop
161
161
  max_end_col = node.arguments.map do |arg|
162
162
  comma_length = arg.equal?(last_arg) ? 0 : 1
163
163
  arg.location.column + source!(arg).length + comma_length
164
- end.max || 0 # steep:ignore
164
+ end.max || 0
165
165
 
166
166
  max_end_col + 2
167
167
  end
@@ -281,6 +281,7 @@ module RuboCop
281
281
  # @rbs node: RuboCop::AST::DefNode
282
282
  def check_method_type_signature(node) #: void
283
283
  return if find_method_type_signature_comments(node.location.line)
284
+ return if rbs_method_type_annotation?(node.location.line)
284
285
 
285
286
  add_offense(offense_range_for_def(node), message: METHOD_TYPE_SIGNATURE_MESSAGE)
286
287
  end
@@ -298,6 +299,7 @@ module RuboCop
298
299
  def check_method_type_signature_or_return_annotation(node) #: void
299
300
  return if find_method_type_signature_comments(node.location.line)
300
301
  return if find_trailing_comment(method_parameter_list_end_line(node))
302
+ return if rbs_method_type_annotation?(node.location.line)
301
303
 
302
304
  add_offense(offense_range_for_def(node), message: METHOD_TYPE_SIGNATURE_OR_RETURN_ANNOTATION_MESSAGE)
303
305
  end
@@ -393,6 +395,14 @@ module RuboCop
393
395
  annotation.comments.any? { |c| c.location.slice.match?(/\A#\s+@rbs\s+(skip|override)\b/) }
394
396
  end
395
397
 
398
+ # @rbs line: Integer
399
+ def rbs_method_type_annotation?(line) #: bool
400
+ annotation = find_leading_annotation(line)
401
+ return false unless annotation
402
+
403
+ annotation.each_annotation.any?(RBS::Inline::AST::Annotations::Method)
404
+ end
405
+
396
406
  # Returns acceptable annotation name variants for the parameter, or nil for unrecognized types.
397
407
  # @rbs argument: RuboCop::AST::Node
398
408
  # @rbs name: String
@@ -51,6 +51,8 @@ module RuboCop
51
51
  return true if RBS_INLINE_KEYWORDS.include?(matched)
52
52
  return true if RBS_INLINE_REGEXP_KEYWORDS.any? { |regexp| matched =~ regexp }
53
53
  return true if matched.end_with?(':')
54
+ # method type signature, e.g. `# @rbs (Integer) -> String` or `# @rbs [T] (T) -> T`
55
+ return true if matched.start_with?('(', '[')
54
56
 
55
57
  false
56
58
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module RbsInline
5
- VERSION = '1.5.4'
5
+ VERSION = '1.5.5'
6
6
  end
7
7
  end
@@ -6,7 +6,7 @@ gems:
6
6
  source:
7
7
  type: git
8
8
  name: ruby/gem_rbs_collection
9
- revision: d1139840c691d4d0e9231915d4f4ffb4a7a21838
9
+ revision: 81fa8bd0617286078617a62b6a3229cebfd4af23
10
10
  remote: https://github.com/ruby/gem_rbs_collection.git
11
11
  repo_dir: gems
12
12
  - name: diff-lcs
@@ -14,7 +14,7 @@ gems:
14
14
  source:
15
15
  type: git
16
16
  name: ruby/gem_rbs_collection
17
- revision: d1139840c691d4d0e9231915d4f4ffb4a7a21838
17
+ revision: 81fa8bd0617286078617a62b6a3229cebfd4af23
18
18
  remote: https://github.com/ruby/gem_rbs_collection.git
19
19
  repo_dir: gems
20
20
  - name: fileutils
@@ -30,13 +30,17 @@ gems:
30
30
  source:
31
31
  type: git
32
32
  name: ruby/gem_rbs_collection
33
- revision: d1139840c691d4d0e9231915d4f4ffb4a7a21838
33
+ revision: 81fa8bd0617286078617a62b6a3229cebfd4af23
34
34
  remote: https://github.com/ruby/gem_rbs_collection.git
35
35
  repo_dir: gems
36
36
  - name: logger
37
- version: '0'
37
+ version: '1.7'
38
38
  source:
39
- type: stdlib
39
+ type: git
40
+ name: ruby/gem_rbs_collection
41
+ revision: 81fa8bd0617286078617a62b6a3229cebfd4af23
42
+ remote: https://github.com/ruby/gem_rbs_collection.git
43
+ repo_dir: gems
40
44
  - name: monitor
41
45
  version: '0'
42
46
  source:
@@ -50,7 +54,7 @@ gems:
50
54
  source:
51
55
  type: git
52
56
  name: ruby/gem_rbs_collection
53
- revision: d1139840c691d4d0e9231915d4f4ffb4a7a21838
57
+ revision: 81fa8bd0617286078617a62b6a3229cebfd4af23
54
58
  remote: https://github.com/ruby/gem_rbs_collection.git
55
59
  repo_dir: gems
56
60
  - name: parser
@@ -58,7 +62,7 @@ gems:
58
62
  source:
59
63
  type: git
60
64
  name: ruby/gem_rbs_collection
61
- revision: d1139840c691d4d0e9231915d4f4ffb4a7a21838
65
+ revision: 81fa8bd0617286078617a62b6a3229cebfd4af23
62
66
  remote: https://github.com/ruby/gem_rbs_collection.git
63
67
  repo_dir: gems
64
68
  - name: prism
@@ -70,7 +74,7 @@ gems:
70
74
  source:
71
75
  type: git
72
76
  name: ruby/gem_rbs_collection
73
- revision: d1139840c691d4d0e9231915d4f4ffb4a7a21838
77
+ revision: 81fa8bd0617286078617a62b6a3229cebfd4af23
74
78
  remote: https://github.com/ruby/gem_rbs_collection.git
75
79
  repo_dir: gems
76
80
  - name: rake
@@ -78,15 +82,15 @@ gems:
78
82
  source:
79
83
  type: git
80
84
  name: ruby/gem_rbs_collection
81
- revision: d1139840c691d4d0e9231915d4f4ffb4a7a21838
85
+ revision: 81fa8bd0617286078617a62b6a3229cebfd4af23
82
86
  remote: https://github.com/ruby/gem_rbs_collection.git
83
87
  repo_dir: gems
84
88
  - name: rbs
85
- version: 3.10.3
89
+ version: 4.0.2
86
90
  source:
87
91
  type: rubygems
88
92
  - name: rbs-inline
89
- version: 0.13.0
93
+ version: 0.14.0
90
94
  source:
91
95
  type: rubygems
92
96
  - name: rdoc
@@ -98,7 +102,7 @@ gems:
98
102
  source:
99
103
  type: git
100
104
  name: ruby/gem_rbs_collection
101
- revision: d1139840c691d4d0e9231915d4f4ffb4a7a21838
105
+ revision: 81fa8bd0617286078617a62b6a3229cebfd4af23
102
106
  remote: https://github.com/ruby/gem_rbs_collection.git
103
107
  repo_dir: gems
104
108
  - name: rubocop
@@ -106,7 +110,7 @@ gems:
106
110
  source:
107
111
  type: git
108
112
  name: ruby/gem_rbs_collection
109
- revision: d1139840c691d4d0e9231915d4f4ffb4a7a21838
113
+ revision: 81fa8bd0617286078617a62b6a3229cebfd4af23
110
114
  remote: https://github.com/ruby/gem_rbs_collection.git
111
115
  repo_dir: gems
112
116
  - name: rubocop-ast
@@ -114,7 +118,7 @@ gems:
114
118
  source:
115
119
  type: git
116
120
  name: ruby/gem_rbs_collection
117
- revision: d1139840c691d4d0e9231915d4f4ffb4a7a21838
121
+ revision: 81fa8bd0617286078617a62b6a3229cebfd4af23
118
122
  remote: https://github.com/ruby/gem_rbs_collection.git
119
123
  repo_dir: gems
120
124
  - name: strscan
@@ -246,6 +246,9 @@ module RuboCop
246
246
  # @rbs line: Integer
247
247
  def skip_annotation?: (Integer line) -> bool
248
248
 
249
+ # @rbs line: Integer
250
+ def rbs_method_type_annotation?: (Integer line) -> bool
251
+
249
252
  # Returns acceptable annotation name variants for the parameter, or nil for unrecognized types.
250
253
  # @rbs argument: RuboCop::AST::Node
251
254
  # @rbs name: String
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-rbs_inline
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.4
4
+ version: 1.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takeshi KOMIYA
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-03-30 00:00:00.000000000 Z
11
+ date: 2026-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lint_roller