rubocop-rbs_inline 1.7.0 → 2.0.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.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.claude/hooks/pre-commit-check.sh +42 -2
  3. data/.claude/hooks/protect-sig-files.sh +45 -0
  4. data/.claude/hooks/self-review.sh +89 -0
  5. data/.claude/settings.json +16 -1
  6. data/.rubocop.yml +17 -12
  7. data/CHANGELOG.md +30 -0
  8. data/CLAUDE.md +11 -14
  9. data/README.md +51 -6
  10. data/Rakefile +12 -3
  11. data/config/default.yml +2 -4
  12. data/lib/rubocop/cop/rbs_inline_cops.rb +16 -7
  13. data/lib/rubocop/cop/style/rbs_inline/data_class_comment_alignment.rb +2 -9
  14. data/lib/rubocop/cop/style/rbs_inline/data_define_with_block.rb +13 -7
  15. data/lib/rubocop/cop/style/rbs_inline/embedded_rbs_spacing.rb +3 -2
  16. data/lib/rubocop/cop/style/rbs_inline/invalid_comment.rb +2 -2
  17. data/lib/rubocop/cop/style/rbs_inline/invalid_types.rb +1 -0
  18. data/lib/rubocop/cop/style/rbs_inline/keyword_separator.rb +2 -2
  19. data/lib/rubocop/cop/style/rbs_inline/method_comment_spacing.rb +3 -2
  20. data/lib/rubocop/cop/style/rbs_inline/missing_data_class_annotation.rb +2 -9
  21. data/lib/rubocop/cop/style/rbs_inline/missing_struct_class_annotation.rb +2 -16
  22. data/lib/rubocop/cop/style/rbs_inline/missing_type_annotation.rb +3 -16
  23. data/lib/rubocop/cop/style/rbs_inline/mixin/annotation_keywords.rb +16 -0
  24. data/lib/rubocop/cop/style/rbs_inline/mixin/ast_utils.rb +75 -0
  25. data/lib/rubocop/cop/style/rbs_inline/{comment_parser.rb → mixin/comment_parser.rb} +8 -0
  26. data/lib/rubocop/cop/style/rbs_inline/mixin/data_class_matcher.rb +22 -0
  27. data/lib/rubocop/cop/style/rbs_inline/{data_struct_helper.rb → mixin/data_struct_helper.rb} +14 -5
  28. data/lib/rubocop/cop/style/rbs_inline/mixin/file_filter.rb +72 -0
  29. data/lib/rubocop/cop/style/rbs_inline/mixin/mode_config.rb +39 -0
  30. data/lib/rubocop/cop/style/rbs_inline/{source_code_helper.rb → mixin/source_code_helper.rb} +3 -5
  31. data/lib/rubocop/cop/style/rbs_inline/mixin/struct_class_matcher.rb +32 -0
  32. data/lib/rubocop/cop/style/rbs_inline/parameters_separator.rb +2 -2
  33. data/lib/rubocop/cop/style/rbs_inline/redundant_annotation_with_skip.rb +2 -11
  34. data/lib/rubocop/cop/style/rbs_inline/redundant_instance_variable_annotation.rb +1 -0
  35. data/lib/rubocop/cop/style/rbs_inline/redundant_type_annotation.rb +6 -15
  36. data/lib/rubocop/cop/style/rbs_inline/require_rbs_inline_comment.rb +35 -23
  37. data/lib/rubocop/cop/style/rbs_inline/struct_class_comment_alignment.rb +2 -16
  38. data/lib/rubocop/cop/style/rbs_inline/struct_new_with_block.rb +13 -7
  39. data/lib/rubocop/cop/style/rbs_inline/unmatched_annotations.rb +31 -6
  40. data/lib/rubocop/cop/style/rbs_inline/untyped_instance_variable.rb +16 -6
  41. data/lib/rubocop/cop/style/rbs_inline/variable_comment_spacing.rb +3 -2
  42. data/lib/rubocop/rbs_inline/version.rb +1 -1
  43. data/rbs_collection.lock.yaml +11 -11
  44. data/sig/gems/rubocop/rubocop.rbs +14 -0
  45. data/sig/rubocop/cop/style/rbs_inline/data_class_comment_alignment.rbs +4 -5
  46. data/sig/rubocop/cop/style/rbs_inline/data_define_with_block.rbs +9 -2
  47. data/sig/rubocop/cop/style/rbs_inline/embedded_rbs_spacing.rbs +2 -0
  48. data/sig/rubocop/cop/style/rbs_inline/invalid_comment.rbs +4 -3
  49. data/sig/rubocop/cop/style/rbs_inline/invalid_types.rbs +2 -0
  50. data/sig/rubocop/cop/style/rbs_inline/keyword_separator.rbs +4 -3
  51. data/sig/rubocop/cop/style/rbs_inline/method_comment_spacing.rbs +2 -0
  52. data/sig/rubocop/cop/style/rbs_inline/missing_data_class_annotation.rbs +4 -5
  53. data/sig/rubocop/cop/style/rbs_inline/missing_struct_class_annotation.rbs +4 -10
  54. data/sig/rubocop/cop/style/rbs_inline/missing_type_annotation.rbs +4 -8
  55. data/sig/rubocop/cop/style/rbs_inline/mixin/annotation_keywords.rbs +16 -0
  56. data/sig/rubocop/cop/style/rbs_inline/{ast_utils.rbs → mixin/ast_utils.rbs} +14 -1
  57. data/sig/rubocop/cop/style/rbs_inline/{class_comment_alignment.rbs → mixin/class_comment_alignment.rbs} +1 -1
  58. data/sig/rubocop/cop/style/rbs_inline/{comment_parser.rbs → mixin/comment_parser.rbs} +5 -1
  59. data/sig/rubocop/cop/style/rbs_inline/mixin/data_class_matcher.rbs +18 -0
  60. data/sig/rubocop/cop/style/rbs_inline/{data_struct_helper.rbs → mixin/data_struct_helper.rbs} +6 -1
  61. data/sig/rubocop/cop/style/rbs_inline/mixin/file_filter.rbs +53 -0
  62. data/sig/rubocop/cop/style/rbs_inline/{missing_class_annotation.rbs → mixin/missing_class_annotation.rbs} +1 -1
  63. data/sig/rubocop/cop/style/rbs_inline/mixin/mode_config.rbs +27 -0
  64. data/sig/rubocop/cop/style/rbs_inline/{source_code_helper.rbs → mixin/source_code_helper.rbs} +1 -1
  65. data/sig/rubocop/cop/style/rbs_inline/mixin/struct_class_matcher.rbs +26 -0
  66. data/sig/rubocop/cop/style/rbs_inline/parameters_separator.rbs +4 -3
  67. data/sig/rubocop/cop/style/rbs_inline/redundant_annotation_with_skip.rbs +4 -4
  68. data/sig/rubocop/cop/style/rbs_inline/redundant_instance_variable_annotation.rbs +2 -0
  69. data/sig/rubocop/cop/style/rbs_inline/redundant_type_annotation.rbs +4 -4
  70. data/sig/rubocop/cop/style/rbs_inline/require_rbs_inline_comment.rbs +22 -5
  71. data/sig/rubocop/cop/style/rbs_inline/struct_class_comment_alignment.rbs +4 -10
  72. data/sig/rubocop/cop/style/rbs_inline/struct_new_with_block.rbs +9 -2
  73. data/sig/rubocop/cop/style/rbs_inline/unmatched_annotations.rbs +13 -0
  74. data/sig/rubocop/cop/style/rbs_inline/untyped_instance_variable.rbs +10 -0
  75. data/sig/rubocop/cop/style/rbs_inline/variable_comment_spacing.rbs +2 -0
  76. metadata +28 -18
  77. data/lib/rubocop/cop/style/rbs_inline/ast_utils.rb +0 -46
  78. data/sig/rubocop/cop/style/rbs_inline/redundant_argument_type.rbs +0 -85
  79. data/sig/rubocop/cop/style/rbs_inline/redundant_return_type.rbs +0 -109
  80. /data/.claude/hooks/{setup.sh → claude-code-web-session-start.sh} +0 -0
  81. /data/lib/rubocop/cop/style/rbs_inline/{class_comment_alignment.rb → mixin/class_comment_alignment.rb} +0 -0
  82. /data/lib/rubocop/cop/style/rbs_inline/{missing_class_annotation.rb → mixin/missing_class_annotation.rb} +0 -0
@@ -0,0 +1,16 @@
1
+ # Generated from lib/rubocop/cop/style/rbs_inline/mixin/annotation_keywords.rb with RBS::Inline
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module Style
6
+ module RbsInline
7
+ # Provides the list of keywords that may follow `# @rbs` in an annotation comment.
8
+ #
9
+ # refs: https://github.com/soutaro/rbs-inline/blob/main/lib/rbs/inline/annotation_parser/tokenizer.rb
10
+ module AnnotationKeywords
11
+ RBS_INLINE_KEYWORDS: Array[String]
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,4 +1,4 @@
1
- # Generated from lib/rubocop/cop/style/rbs_inline/ast_utils.rb with RBS::Inline
1
+ # Generated from lib/rubocop/cop/style/rbs_inline/mixin/ast_utils.rb with RBS::Inline
2
2
 
3
3
  module RuboCop
4
4
  module Cop
@@ -9,12 +9,25 @@ module RuboCop
9
9
  # @rbs default: Integer
10
10
  def end_line: (RuboCop::AST::Node node, default: Integer) -> Integer
11
11
 
12
+ # Returns the arguments node of a method definition.
13
+ # @rbs node: RuboCop::AST::DefNode
14
+ def args_node_for: (RuboCop::AST::DefNode node) -> RuboCop::AST::Node
15
+
16
+ # Returns the last line of the method parameter list (the closing ) line, or the def line if no parens).
17
+ # @rbs node: RuboCop::AST::DefNode
18
+ def method_parameter_list_end_line: (RuboCop::AST::DefNode node) -> Integer
19
+
12
20
  # @rbs node: RuboCop::AST::Node
13
21
  def name_location: (RuboCop::AST::Node node) -> untyped
14
22
 
15
23
  # @rbs node: RuboCop::AST::Node
16
24
  def source!: (RuboCop::AST::Node node) -> String
17
25
 
26
+ # Returns the name of the constant `node` is assigned to, or `nil` when the name
27
+ # is not statically determinable (e.g. `self::Foo = ...`).
28
+ # @rbs node: RuboCop::AST::Node
29
+ def assigned_constant_name: (RuboCop::AST::Node node) -> String?
30
+
18
31
  # : (RuboCop::AST::SymbolNode) -> Symbol
19
32
  # : (RuboCop::AST::StrNode) -> Symbol
20
33
  # : (RuboCop::AST::Node) -> Symbol?
@@ -1,4 +1,4 @@
1
- # Generated from lib/rubocop/cop/style/rbs_inline/class_comment_alignment.rb with RBS::Inline
1
+ # Generated from lib/rubocop/cop/style/rbs_inline/mixin/class_comment_alignment.rb with RBS::Inline
2
2
 
3
3
  module RuboCop
4
4
  module Cop
@@ -1,4 +1,4 @@
1
- # Generated from lib/rubocop/cop/style/rbs_inline/comment_parser.rb with RBS::Inline
1
+ # Generated from lib/rubocop/cop/style/rbs_inline/mixin/comment_parser.rb with RBS::Inline
2
2
 
3
3
  module RuboCop
4
4
  module Cop
@@ -9,6 +9,10 @@ module RuboCop
9
9
  module CommentParser : RuboCop::Cop::Base
10
10
  attr_reader parsed_comments: Array[RBS::Inline::AnnotationParser::ParsingResult]
11
11
 
12
+ # Fallback for cops that include CommentParser without prepending FileFilter;
13
+ # `FileFilter` overrides this to return the real per-file decision.
14
+ def rbs_inline_file_skipped?: () -> bool
15
+
12
16
  # Parse comments from the source code
13
17
  def parse_comments: () -> Array[RBS::Inline::AnnotationParser::ParsingResult]
14
18
 
@@ -0,0 +1,18 @@
1
+ # Generated from lib/rubocop/cop/style/rbs_inline/mixin/data_class_matcher.rb with RBS::Inline
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module Style
6
+ module RbsInline
7
+ # Matcher for `Data.define` calls, shared by the cops that check
8
+ # `Data.define` class definitions.
9
+ module DataClassMatcher
10
+ private
11
+
12
+ # @rbs node: RuboCop::AST::SendNode
13
+ def struct_like_class?: (RuboCop::AST::SendNode node) -> bool
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -1,4 +1,4 @@
1
- # Generated from lib/rubocop/cop/style/rbs_inline/data_struct_helper.rb with RBS::Inline
1
+ # Generated from lib/rubocop/cop/style/rbs_inline/mixin/data_struct_helper.rb with RBS::Inline
2
2
 
3
3
  module RuboCop
4
4
  module Cop
@@ -40,9 +40,14 @@ module RuboCop
40
40
  # @rbs line: Integer
41
41
  def find_regular_comment: (Integer line) -> Parser::Source::Comment?
42
42
 
43
+ # The column is determined by the attribute arguments only; non-attribute
44
+ # arguments (e.g. the `Struct.new` name or a `keyword_init:` keyword argument)
45
+ # never carry an annotation and so must not influence the alignment.
43
46
  # @rbs node: RuboCop::AST::SendNode
44
47
  def annotation_column: (RuboCop::AST::SendNode node) -> Integer
45
48
 
49
+ # Only attribute arguments are considered, for the same reason as
50
+ # {#annotation_column}.
46
51
  # @rbs node: RuboCop::AST::SendNode
47
52
  def longest_argname: (RuboCop::AST::SendNode node) -> String
48
53
 
@@ -0,0 +1,53 @@
1
+ # Generated from lib/rubocop/cop/style/rbs_inline/mixin/file_filter.rb with RBS::Inline
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module Style
6
+ module RbsInline
7
+ # Filters files a cop reports offenses on, based on `Mode` configuration.
8
+ #
9
+ # When `Mode` is `opt_in`, offenses are only reported for files that contain
10
+ # a `# rbs_inline: enabled` magic comment. When `Mode` is `opt_out`, all files
11
+ # are checked unless they contain `# rbs_inline: disabled`.
12
+ #
13
+ # This module is designed to be `prepend`ed to a cop so that it can short-circuit
14
+ # the cop's heavy work (annotation parsing via `parse_comments`) and suppress any
15
+ # residual offense reporting for files that should be skipped.
16
+ #
17
+ # @rbs module-self RuboCop::Cop::Base
18
+ module FileFilter : RuboCop::Cop::Base
19
+ include ModeConfig
20
+
21
+ MAGIC_COMMENT_ENABLED: Regexp
22
+
23
+ MAGIC_COMMENT_DISABLED: Regexp
24
+
25
+ @rbs_inline_skip_file: bool
26
+
27
+ def on_new_investigation: () -> void
28
+
29
+ # @rbs *args: untyped
30
+ # @rbs **kwargs: untyped
31
+ def add_offense: (*untyped args, **untyped kwargs) ?{ (?) -> untyped } -> void
32
+
33
+ # Exposes the FileFilter's per-file skip decision as a proper method so
34
+ # helper modules (e.g. `CommentParser`) can consult it explicitly instead
35
+ # of poking at `@rbs_inline_skip_file` directly.
36
+ def rbs_inline_file_skipped?: () -> bool
37
+
38
+ private
39
+
40
+ def skip_by_mode?: () -> bool
41
+
42
+ # Iterate the already-materialized `processed_source.comments` so this
43
+ # matches RequireRbsInlineComment's detection exactly (line endings,
44
+ # indented comments, heredoc/string content are all handled correctly
45
+ # by the parser).
46
+ def rbs_inline_enabled?: () -> bool
47
+
48
+ def rbs_inline_disabled?: () -> bool
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -1,4 +1,4 @@
1
- # Generated from lib/rubocop/cop/style/rbs_inline/missing_class_annotation.rb with RBS::Inline
1
+ # Generated from lib/rubocop/cop/style/rbs_inline/mixin/missing_class_annotation.rb with RBS::Inline
2
2
 
3
3
  module RuboCop
4
4
  module Cop
@@ -0,0 +1,27 @@
1
+ # Generated from lib/rubocop/cop/style/rbs_inline/mixin/mode_config.rb with RBS::Inline
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module Style
6
+ module RbsInline
7
+ # Resolves the `Mode` setting shared by every cop in the `Style/RbsInline`
8
+ # department.
9
+ #
10
+ # @rbs module-self RuboCop::Cop::Base
11
+ module ModeConfig : RuboCop::Cop::Base
12
+ type mode = :opt_in | :opt_out
13
+
14
+ SUPPORTED_MODES: Array[mode]
15
+
16
+ # Hook RuboCop calls while mobilizing its cops, so an unsupported `Mode`
17
+ # fails the run as a config error instead of an error on every file.
18
+ def validate_config: () -> void
19
+
20
+ private
21
+
22
+ def configured_mode: () -> mode
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -1,4 +1,4 @@
1
- # Generated from lib/rubocop/cop/style/rbs_inline/source_code_helper.rb with RBS::Inline
1
+ # Generated from lib/rubocop/cop/style/rbs_inline/mixin/source_code_helper.rb with RBS::Inline
2
2
 
3
3
  module RuboCop
4
4
  module Cop
@@ -0,0 +1,26 @@
1
+ # Generated from lib/rubocop/cop/style/rbs_inline/mixin/struct_class_matcher.rb with RBS::Inline
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module Style
6
+ module RbsInline
7
+ # Matcher for `Struct.new` calls, shared by the cops that check `Struct.new`
8
+ # class definitions.
9
+ #
10
+ # Also overrides {DataStructHelper#attr_argument?} for `Struct.new` semantics,
11
+ # so cops that include both must include this module last.
12
+ module StructClassMatcher
13
+ private
14
+
15
+ # @rbs node: RuboCop::AST::SendNode
16
+ def struct_like_class?: (RuboCop::AST::SendNode node) -> bool
17
+
18
+ # `Struct.new` treats a leading string argument as the struct name, so only
19
+ # symbol arguments are attributes.
20
+ # @rbs arg: RuboCop::AST::Node
21
+ def attr_argument?: (RuboCop::AST::Node arg) -> bool
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -20,15 +20,16 @@ module RuboCop
20
20
  # # good
21
21
  # # @rbs %a{pure}
22
22
  class ParametersSeparator < Base
23
+ prepend FileFilter
24
+
23
25
  extend AutoCorrector
24
26
 
27
+ include AnnotationKeywords
28
+
25
29
  include RangeHelp
26
30
 
27
31
  MSG: ::String
28
32
 
29
- # refs: https://github.com/soutaro/rbs-inline/blob/main/lib/rbs/inline/annotation_parser/tokenizer.rb
30
- RBS_INLINE_KEYWORDS: Array[String]
31
-
32
33
  RBS_INLINE_REGEXP_KEYWORDS: Array[Regexp]
33
34
 
34
35
  def on_new_investigation: () -> void
@@ -55,8 +55,12 @@ module RuboCop
55
55
  # def method(a)
56
56
  # end
57
57
  class RedundantAnnotationWithSkip < Base
58
+ prepend FileFilter
59
+
58
60
  extend AutoCorrector
59
61
 
62
+ include ASTUtils
63
+
60
64
  include CommentParser
61
65
 
62
66
  include RangeHelp
@@ -105,10 +109,6 @@ module RuboCop
105
109
 
106
110
  # @rbs param_list_end_line: Integer
107
111
  def check_trailing_return: (Integer param_list_end_line) -> void
108
-
109
- # Returns the last line of the method parameter list (the closing ) line, or the def line if no parens).
110
- # @rbs node: RuboCop::AST::DefNode
111
- def method_parameter_list_end_line: (RuboCop::AST::DefNode node) -> Integer
112
112
  end
113
113
  end
114
114
  end
@@ -25,6 +25,8 @@ module RuboCop
25
25
  #
26
26
  # attr_reader :foo
27
27
  class RedundantInstanceVariableAnnotation < Base
28
+ prepend FileFilter
29
+
28
30
  extend AutoCorrector
29
31
 
30
32
  include ASTUtils
@@ -77,8 +77,12 @@ module RuboCop
77
77
  # def method(a) #: String
78
78
  # end
79
79
  class RedundantTypeAnnotation < Base
80
+ prepend FileFilter
81
+
80
82
  extend AutoCorrector
81
83
 
84
+ include ASTUtils
85
+
82
86
  include CommentParser
83
87
 
84
88
  include ConfigurableEnforcedStyle
@@ -110,10 +114,6 @@ module RuboCop
110
114
  # @rbs def_line: Integer
111
115
  def check_parameter_redundancy: (Integer def_line) -> void
112
116
 
113
- # Returns the last line of the method parameter list (the closing ) line, or the def line if no parens).
114
- # @rbs node: RuboCop::AST::DefNode
115
- def method_parameter_list_end_line: (RuboCop::AST::DefNode node) -> Integer
116
-
117
117
  # @rbs def_line: Integer
118
118
  # @rbs parameter_list_end_line: Integer
119
119
  def check_return_type_redundancy: (Integer def_line, Integer parameter_list_end_line) -> void
@@ -10,7 +10,7 @@ module RuboCop
10
10
  # opt-out (processes all files by default). This cop enforces consistency in which
11
11
  # mode your codebase uses.
12
12
  #
13
- # @example EnforcedStyle: always (default)
13
+ # @example Mode: opt_in
14
14
  # # bad
15
15
  # # (no rbs_inline comment)
16
16
  # class Foo
@@ -26,7 +26,17 @@ module RuboCop
26
26
  # class Foo
27
27
  # end
28
28
  #
29
- # @example EnforcedStyle: never
29
+ # @example Mode: opt_in, AllowMissingComment: true
30
+ # # good - the cop does not enforce the magic comment
31
+ # class Foo
32
+ # end
33
+ #
34
+ # # good
35
+ # # rbs_inline: enabled
36
+ # class Foo
37
+ # end
38
+ #
39
+ # @example Mode: opt_out
30
40
  # # bad
31
41
  # # rbs_inline: enabled
32
42
  # class Foo
@@ -42,6 +52,8 @@ module RuboCop
42
52
  # class Foo
43
53
  # end
44
54
  class RequireRbsInlineComment < Base
55
+ include ModeConfig
56
+
45
57
  include RangeHelp
46
58
 
47
59
  extend AutoCorrector
@@ -60,16 +72,21 @@ module RuboCop
60
72
  def disabled?: (Parser::Source::Comment? magic_comment) -> bool
61
73
 
62
74
  # @rbs magic_comment: Parser::Source::Comment?
63
- def check_always_style: (Parser::Source::Comment? magic_comment) -> void
75
+ def check_opt_in: (Parser::Source::Comment? magic_comment) -> void
64
76
 
65
77
  # @rbs magic_comment: Parser::Source::Comment?
66
- def check_never_style: (Parser::Source::Comment? magic_comment) -> void
78
+ def check_opt_out: (Parser::Source::Comment? magic_comment) -> void
67
79
 
68
80
  def find_insert_position: () -> Integer
69
81
 
82
+ # The insert position lands at the end of the buffer when the file has no trailing
83
+ # newline. The magic comment then needs its own newline to stay on a separate line.
84
+ # @rbs insert_position: Integer
85
+ def insertion_text: (Integer insert_position) -> String
86
+
70
87
  def find_last_comment_in_first_block: () -> Parser::Source::Comment
71
88
 
72
- def style: () -> Symbol
89
+ def allow_missing_comment?: () -> bool
73
90
 
74
91
  def first_line_range: () -> Parser::Source::Range
75
92
  end
@@ -23,24 +23,18 @@ module RuboCop
23
23
  # :y #: Integer
24
24
  # )
25
25
  class StructClassCommentAlignment < Base
26
+ prepend FileFilter
27
+
26
28
  include ClassCommentAlignment
27
29
 
30
+ include StructClassMatcher
31
+
28
32
  extend AutoCorrector
29
33
 
30
34
  MSG: ::String
31
35
 
32
36
  # @rbs node: RuboCop::AST::SendNode
33
37
  def on_send: (RuboCop::AST::SendNode node) -> void
34
-
35
- private
36
-
37
- # @rbs node: RuboCop::AST::SendNode
38
- def struct_like_class?: (RuboCop::AST::SendNode node) -> bool
39
-
40
- # `Struct.new` treats a leading string argument as the struct name, so only
41
- # symbol arguments are attributes.
42
- # @rbs arg: RuboCop::AST::Node
43
- def attr_argument?: (RuboCop::AST::Node arg) -> bool
44
38
  end
45
39
  end
46
40
  end
@@ -24,6 +24,12 @@ module RuboCop
24
24
  # def admin? = role == :admin #: bool
25
25
  # end
26
26
  class StructNewWithBlock < Base
27
+ prepend FileFilter
28
+
29
+ include StructClassMatcher
30
+
31
+ include ASTUtils
32
+
27
33
  MSG: ::String
28
34
 
29
35
  # @rbs node: RuboCop::AST::SendNode
@@ -31,8 +37,9 @@ module RuboCop
31
37
 
32
38
  private
33
39
 
34
- # @rbs node: RuboCop::AST::SendNode
35
- def struct_like_class?: (RuboCop::AST::SendNode node) -> bool
40
+ # The constant the definition is assigned to is the class to reopen.
41
+ # @rbs node: RuboCop::AST::Node
42
+ def destination: (RuboCop::AST::Node node) -> String
36
43
  end
37
44
  end
38
45
  end
@@ -15,6 +15,8 @@ module RuboCop
15
15
  # # @rbs arg: String
16
16
  # def method(arg); end
17
17
  class UnmatchedAnnotations < Base
18
+ prepend FileFilter
19
+
18
20
  include CommentParser
19
21
 
20
22
  include RangeHelp
@@ -23,6 +25,8 @@ module RuboCop
23
25
 
24
26
  MSG: ::String
25
27
 
28
+ attr_reader processed_comments: Set[RBS::Inline::AnnotationParser::ParsingResult]
29
+
26
30
  def on_new_investigation: () -> void
27
31
 
28
32
  # @rbs node: RuboCop::AST::DefNode
@@ -38,6 +42,15 @@ module RuboCop
38
42
  # @rbs node: RuboCop::AST::DefNode
39
43
  def process: (RuboCop::AST::DefNode node) -> void
40
44
 
45
+ # @rbs node: RuboCop::AST::DefNode
46
+ def leading_comment_for: (RuboCop::AST::DefNode node) -> RBS::Inline::AnnotationParser::ParsingResult?
47
+
48
+ # @rbs comment: RBS::Inline::AnnotationParser::ParsingResult
49
+ def mark_processed: (RBS::Inline::AnnotationParser::ParsingResult comment) -> void
50
+
51
+ # @rbs comment: RBS::Inline::AnnotationParser::ParsingResult
52
+ def processed?: (RBS::Inline::AnnotationParser::ParsingResult comment) -> bool
53
+
41
54
  # @rbs node: RuboCop::AST::DefNode
42
55
  def arguments_for: (RuboCop::AST::DefNode node) -> Array[String]
43
56
 
@@ -56,6 +56,8 @@ module RuboCop
56
56
  # end
57
57
  # end
58
58
  class UntypedInstanceVariable < Base
59
+ prepend FileFilter
60
+
59
61
  include ASTUtils
60
62
 
61
63
  include CommentParser
@@ -125,6 +127,14 @@ module RuboCop
125
127
  # @rbs node: RuboCop::AST::Node
126
128
  def collect_typed_ivars_for_scope: (RuboCop::AST::Node node) -> void
127
129
 
130
+ # Moves the annotations placed within +lines+ from +annotations+ into +typed+
131
+ # so that outer scopes no longer see them.
132
+ #
133
+ # @rbs annotations: Hash[Integer, Symbol]
134
+ # @rbs typed: Set[Symbol]
135
+ # @rbs lines: Range[Integer]
136
+ def move_annotations: (Hash[Integer, Symbol] annotations, Set[Symbol] typed, Range[Integer] lines) -> void
137
+
128
138
  def collect_ivar_type_annotations: () -> [ Hash[Integer, Symbol], Hash[Integer, Symbol] ]
129
139
 
130
140
  # @rbs ann: RBS::Inline::AST::Annotations::IvarType
@@ -27,6 +27,8 @@ module RuboCop
27
27
  # def method
28
28
  # end
29
29
  class VariableCommentSpacing < Base
30
+ prepend FileFilter
31
+
30
32
  extend AutoCorrector
31
33
 
32
34
  include SourceCodeHelper
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.7.0
4
+ version: 2.0.0
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-07-20 00:00:00.000000000 Z
11
+ date: 2026-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lint_roller
@@ -65,9 +65,11 @@ executables: []
65
65
  extensions: []
66
66
  extra_rdoc_files: []
67
67
  files:
68
+ - ".claude/hooks/claude-code-web-session-start.sh"
68
69
  - ".claude/hooks/pre-commit-check.sh"
70
+ - ".claude/hooks/protect-sig-files.sh"
69
71
  - ".claude/hooks/rbs-inline.sh"
70
- - ".claude/hooks/setup.sh"
72
+ - ".claude/hooks/self-review.sh"
71
73
  - ".claude/settings.json"
72
74
  - ".rspec"
73
75
  - ".rubocop.yml"
@@ -83,27 +85,32 @@ files:
83
85
  - config/default.yml
84
86
  - lib/rubocop-rbs_inline.rb
85
87
  - lib/rubocop/cop/rbs_inline_cops.rb
86
- - lib/rubocop/cop/style/rbs_inline/ast_utils.rb
87
- - lib/rubocop/cop/style/rbs_inline/class_comment_alignment.rb
88
- - lib/rubocop/cop/style/rbs_inline/comment_parser.rb
89
88
  - lib/rubocop/cop/style/rbs_inline/data_class_comment_alignment.rb
90
89
  - lib/rubocop/cop/style/rbs_inline/data_define_with_block.rb
91
- - lib/rubocop/cop/style/rbs_inline/data_struct_helper.rb
92
90
  - lib/rubocop/cop/style/rbs_inline/embedded_rbs_spacing.rb
93
91
  - lib/rubocop/cop/style/rbs_inline/invalid_comment.rb
94
92
  - lib/rubocop/cop/style/rbs_inline/invalid_types.rb
95
93
  - lib/rubocop/cop/style/rbs_inline/keyword_separator.rb
96
94
  - lib/rubocop/cop/style/rbs_inline/method_comment_spacing.rb
97
- - lib/rubocop/cop/style/rbs_inline/missing_class_annotation.rb
98
95
  - lib/rubocop/cop/style/rbs_inline/missing_data_class_annotation.rb
99
96
  - lib/rubocop/cop/style/rbs_inline/missing_struct_class_annotation.rb
100
97
  - lib/rubocop/cop/style/rbs_inline/missing_type_annotation.rb
98
+ - lib/rubocop/cop/style/rbs_inline/mixin/annotation_keywords.rb
99
+ - lib/rubocop/cop/style/rbs_inline/mixin/ast_utils.rb
100
+ - lib/rubocop/cop/style/rbs_inline/mixin/class_comment_alignment.rb
101
+ - lib/rubocop/cop/style/rbs_inline/mixin/comment_parser.rb
102
+ - lib/rubocop/cop/style/rbs_inline/mixin/data_class_matcher.rb
103
+ - lib/rubocop/cop/style/rbs_inline/mixin/data_struct_helper.rb
104
+ - lib/rubocop/cop/style/rbs_inline/mixin/file_filter.rb
105
+ - lib/rubocop/cop/style/rbs_inline/mixin/missing_class_annotation.rb
106
+ - lib/rubocop/cop/style/rbs_inline/mixin/mode_config.rb
107
+ - lib/rubocop/cop/style/rbs_inline/mixin/source_code_helper.rb
108
+ - lib/rubocop/cop/style/rbs_inline/mixin/struct_class_matcher.rb
101
109
  - lib/rubocop/cop/style/rbs_inline/parameters_separator.rb
102
110
  - lib/rubocop/cop/style/rbs_inline/redundant_annotation_with_skip.rb
103
111
  - lib/rubocop/cop/style/rbs_inline/redundant_instance_variable_annotation.rb
104
112
  - lib/rubocop/cop/style/rbs_inline/redundant_type_annotation.rb
105
113
  - lib/rubocop/cop/style/rbs_inline/require_rbs_inline_comment.rb
106
- - lib/rubocop/cop/style/rbs_inline/source_code_helper.rb
107
114
  - lib/rubocop/cop/style/rbs_inline/struct_class_comment_alignment.rb
108
115
  - lib/rubocop/cop/style/rbs_inline/struct_new_with_block.rb
109
116
  - lib/rubocop/cop/style/rbs_inline/unmatched_annotations.rb
@@ -117,29 +124,32 @@ files:
117
124
  - sig/gems/rubocop/rubocop.rbs
118
125
  - sig/rubocop-rbs_inline.rbs
119
126
  - sig/rubocop/cop/rbs_inline_cops.rbs
120
- - sig/rubocop/cop/style/rbs_inline/ast_utils.rbs
121
- - sig/rubocop/cop/style/rbs_inline/class_comment_alignment.rbs
122
- - sig/rubocop/cop/style/rbs_inline/comment_parser.rbs
123
127
  - sig/rubocop/cop/style/rbs_inline/data_class_comment_alignment.rbs
124
128
  - sig/rubocop/cop/style/rbs_inline/data_define_with_block.rbs
125
- - sig/rubocop/cop/style/rbs_inline/data_struct_helper.rbs
126
129
  - sig/rubocop/cop/style/rbs_inline/embedded_rbs_spacing.rbs
127
130
  - sig/rubocop/cop/style/rbs_inline/invalid_comment.rbs
128
131
  - sig/rubocop/cop/style/rbs_inline/invalid_types.rbs
129
132
  - sig/rubocop/cop/style/rbs_inline/keyword_separator.rbs
130
133
  - sig/rubocop/cop/style/rbs_inline/method_comment_spacing.rbs
131
- - sig/rubocop/cop/style/rbs_inline/missing_class_annotation.rbs
132
134
  - sig/rubocop/cop/style/rbs_inline/missing_data_class_annotation.rbs
133
135
  - sig/rubocop/cop/style/rbs_inline/missing_struct_class_annotation.rbs
134
136
  - sig/rubocop/cop/style/rbs_inline/missing_type_annotation.rbs
137
+ - sig/rubocop/cop/style/rbs_inline/mixin/annotation_keywords.rbs
138
+ - sig/rubocop/cop/style/rbs_inline/mixin/ast_utils.rbs
139
+ - sig/rubocop/cop/style/rbs_inline/mixin/class_comment_alignment.rbs
140
+ - sig/rubocop/cop/style/rbs_inline/mixin/comment_parser.rbs
141
+ - sig/rubocop/cop/style/rbs_inline/mixin/data_class_matcher.rbs
142
+ - sig/rubocop/cop/style/rbs_inline/mixin/data_struct_helper.rbs
143
+ - sig/rubocop/cop/style/rbs_inline/mixin/file_filter.rbs
144
+ - sig/rubocop/cop/style/rbs_inline/mixin/missing_class_annotation.rbs
145
+ - sig/rubocop/cop/style/rbs_inline/mixin/mode_config.rbs
146
+ - sig/rubocop/cop/style/rbs_inline/mixin/source_code_helper.rbs
147
+ - sig/rubocop/cop/style/rbs_inline/mixin/struct_class_matcher.rbs
135
148
  - sig/rubocop/cop/style/rbs_inline/parameters_separator.rbs
136
149
  - sig/rubocop/cop/style/rbs_inline/redundant_annotation_with_skip.rbs
137
- - sig/rubocop/cop/style/rbs_inline/redundant_argument_type.rbs
138
150
  - sig/rubocop/cop/style/rbs_inline/redundant_instance_variable_annotation.rbs
139
- - sig/rubocop/cop/style/rbs_inline/redundant_return_type.rbs
140
151
  - sig/rubocop/cop/style/rbs_inline/redundant_type_annotation.rbs
141
152
  - sig/rubocop/cop/style/rbs_inline/require_rbs_inline_comment.rbs
142
- - sig/rubocop/cop/style/rbs_inline/source_code_helper.rbs
143
153
  - sig/rubocop/cop/style/rbs_inline/struct_class_comment_alignment.rbs
144
154
  - sig/rubocop/cop/style/rbs_inline/struct_new_with_block.rbs
145
155
  - sig/rubocop/cop/style/rbs_inline/unmatched_annotations.rbs
@@ -154,7 +164,7 @@ licenses:
154
164
  metadata:
155
165
  homepage_uri: https://github.com/tk0miya/rubocop-rbs_inline
156
166
  source_code_uri: https://github.com/tk0miya/rubocop-rbs_inline
157
- changelog_uri: https://github.com/tk0miya/rubocop-rbs_inline
167
+ changelog_uri: https://github.com/tk0miya/rubocop-rbs_inline/blob/main/CHANGELOG.md
158
168
  rubygems_mfa_required: 'true'
159
169
  default_lint_roller_plugin: RuboCop::RbsInline::Plugin
160
170
  post_install_message: