Class: RuboCop::Cop::Style::RbsInline::RedundantAnnotationWithSkip
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Style::RbsInline::RedundantAnnotationWithSkip
- Extended by:
- AutoCorrector
- Includes:
- RangeHelp, CommentParser, SourceCodeHelper
- Defined in:
- lib/rubocop/cop/style/rbs_inline/redundant_annotation_with_skip.rb
Overview
Checks for redundant type annotations when ‘@rbs skip` or `@rbs override` is present.
‘@rbs skip` tells RBS::Inline to skip RBS generation for this method entirely. `@rbs override` tells RBS::Inline to inherit the type signature from the parent class. In both cases, any additional type annotations (method type signatures, parameter annotations, return type annotations) are redundant and will be ignored by RBS::Inline.
Constant Summary collapse
- MSG_METHOD_TYPE_SIGNATURE =
'Redundant method type signature. ' \ '`@rbs skip` and `@rbs override` skip RBS generation.'
- MSG_DOC_STYLE_ANNOTATION =
'Redundant `@rbs` annotation. ' \ '`@rbs skip` and `@rbs override` skip RBS generation.'
- MSG_TRAILING_RETURN =
'Redundant trailing return type annotation. ' \ '`@rbs skip` and `@rbs override` skip RBS generation.'
- MSG_DUPLICATE_SKIP =
'Duplicate `@rbs skip` annotation.'- MSG_DUPLICATE_OVERRIDE =
'Duplicate `@rbs override` annotation.'- MSG_CONFLICTING_SKIP_OVERRIDE =
'`@rbs skip` and `@rbs override` cannot both be specified.'
Instance Attribute Summary
Attributes included from CommentParser
Instance Method Summary collapse
- #on_def(node) ⇒ Object (also: #on_defs)
-
#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 Also known as: on_defs
82 83 84 |
# File 'lib/rubocop/cop/style/rbs_inline/redundant_annotation_with_skip.rb', line 82 def on_def(node) #: void process(node) end |
#on_new_investigation ⇒ Object
: void
76 77 78 79 |
# File 'lib/rubocop/cop/style/rbs_inline/redundant_annotation_with_skip.rb', line 76 def on_new_investigation #: void super parse_comments end |