Class: RuboCop::Cop::Style::RbsInline::EmbeddedRbsSpacing

Inherits:
Base
  • Object
show all
Extended by:
AutoCorrector
Includes:
CommentParser, SourceCodeHelper
Defined in:
lib/rubocop/cop/style/rbs_inline/embedded_rbs_spacing.rb

Overview

Checks that ‘@rbs!` comments (embedded RBS) are followed by a blank line.

RBS::Inline requires ‘@rbs!` comments to be standalone comments, meaning they should not have any code immediately following them. A blank line after the `@rbs!` block ensures proper separation.

Examples:

# bad
# @rbs! type foo = Integer
def method
end

# good
# @rbs! type foo = Integer

def method
end

Constant Summary collapse

MSG =
'`@rbs!` comment must be followed by a blank line.'

Instance Attribute Summary

Attributes included from CommentParser

#parsed_comments

Instance Method Summary collapse

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

Methods included from SourceCodeHelper

#annotation_range, #blank_line?, #char_at, #character_offset, #comment_at, #comment_range, #line_range, #location_to_range, #source_code_at

Instance Method Details

#on_new_investigationObject

: void



35
36
37
# File 'lib/rubocop/cop/style/rbs_inline/embedded_rbs_spacing.rb', line 35

def on_new_investigation #: void
  check_embedded_rbs_spacing
end