Class: RuboCop::Cop::Style::RbsInline::MissingDataClassAnnotation
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Style::RbsInline::MissingDataClassAnnotation
- Extended by:
- AutoCorrector
- Includes:
- RangeHelp, ASTUtils, SourceCodeHelper
- Defined in:
- lib/rubocop/cop/style/rbs_inline/missing_data_class_annotation.rb
Overview
Checks that ‘Data.define` attributes have inline type annotations.
Each attribute passed to ‘Data.define` should have a trailing `#:` type annotation comment on the same line.
Constant Summary collapse
- MSG =
'Missing inline type annotation for Data attribute (e.g., `#: Type`).'
Instance Method Summary collapse
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 ASTUtils
#end_line, #name_location, #source!, #value_to_sym
Instance Method Details
#on_send(node) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/rubocop/cop/style/rbs_inline/missing_data_class_annotation.rb', line 32 def on_send(node) #: void return unless data_define?(node) if folded_data_class?(node) add_offenses_for_folded_data_class(node) else check_multiline_data_class(node) end end |