Class: RuboCop::Cop::Style::RbsInline::UnmatchedAnnotations
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Style::RbsInline::UnmatchedAnnotations
- Includes:
- RangeHelp
- Defined in:
- lib/rubocop/cop/style/rbs_inline/unmatched_annotations.rb
Overview
IRB::Inline annotations comments for parameters should be matched to the parameters.
Constant Summary collapse
- MSG =
'target parameter not found.'
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
: Array.
Instance Method Summary collapse
- #on_def(node) ⇒ Object
- #on_defs(node) ⇒ Object
-
#on_investigation_end ⇒ Object
: void.
-
#on_new_investigation ⇒ Object
: void.
Instance Attribute Details
#result ⇒ Object (readonly)
: Array
25 26 27 |
# File 'lib/rubocop/cop/style/rbs_inline/unmatched_annotations.rb', line 25 def result @result end |
Instance Method Details
#on_def(node) ⇒ Object
33 34 35 |
# File 'lib/rubocop/cop/style/rbs_inline/unmatched_annotations.rb', line 33 def on_def(node) #: void process(node) end |
#on_defs(node) ⇒ Object
38 39 40 |
# File 'lib/rubocop/cop/style/rbs_inline/unmatched_annotations.rb', line 38 def on_defs(node) #: void process(node) end |
#on_investigation_end ⇒ Object
: void
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/rubocop/cop/style/rbs_inline/unmatched_annotations.rb', line 42 def on_investigation_end #: void result.each do |comment| comment.each_annotation do |annotation| case annotation when RBS::Inline::AST::Annotations::BlockType, RBS::Inline::AST::Annotations::ReturnType, RBS::Inline::AST::Annotations::VarType add_offense_for(annotation) end end end super end |
#on_new_investigation ⇒ Object
: void
27 28 29 30 |
# File 'lib/rubocop/cop/style/rbs_inline/unmatched_annotations.rb', line 27 def on_new_investigation #: void super @result = parse_comments end |