Class: RuboCop::Cop::Style::RbsInline::UnmatchedAnnotations
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Style::RbsInline::UnmatchedAnnotations
- Includes:
- RangeHelp, CommentParser, SourceCodeHelper
- 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
Attributes included from CommentParser
Instance Method Summary collapse
- #on_def(node) ⇒ Object
- #on_defs(node) ⇒ Object
-
#on_investigation_end ⇒ Object
: void.
-
#on_new_investigation ⇒ Object
: void.
Methods included from SourceCodeHelper
#annotation_range, #blank_line?, #char_at, #character_offset, #comment_at, #comment_range, #line_range, #location_to_range, #source_code_at
Methods included from CommentParser
#find_doc_style_param_annotations, #find_doc_style_return_annotation, #find_last_consecutive_comment, #find_leading_annotation, #find_method_type_signature_comments, #find_trailing_comment, #overload_type_signatures?, #parse_comments
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 parsed_comments.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 parse_comments end |