Class: RuboCop::Cop::Style::RbsInline::RequireRbsInlineComment
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Style::RbsInline::RequireRbsInlineComment
- Extended by:
- AutoCorrector
- Includes:
- RangeHelp
- Defined in:
- lib/rubocop/cop/style/rbs_inline/require_rbs_inline_comment.rb
Overview
Checks for the presence or absence of ‘# rbs_inline:` magic comment.
RBS::Inline supports two modes: opt-in (requires ‘# rbs_inline: enabled`) and opt-out (processes all files by default). This cop enforces consistency in which mode your codebase uses.
Constant Summary collapse
- MSG_MISSING =
'Missing `# rbs_inline:` magic comment.'- MSG_FORBIDDEN =
'Remove `# rbs_inline:` magic comment.'
Instance Method Summary collapse
-
#on_new_investigation ⇒ Object
: void.
Instance Method Details
#on_new_investigation ⇒ Object
: void
52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/rubocop/cop/style/rbs_inline/require_rbs_inline_comment.rb', line 52 def on_new_investigation #: void return if processed_source.buffer.source.empty? magic_comment = find_rbs_inline_magic_comment return if disabled?(magic_comment) if style == :always check_always_style(magic_comment) elsif style == :never check_never_style(magic_comment) end end |