Class: RuboCop::Cop::Style::RbsInline::KeywordSeparator
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Style::RbsInline::KeywordSeparator
- Includes:
- RangeHelp
- Defined in:
- lib/rubocop/cop/style/rbs_inline/keyword_separator.rb
Overview
IRB::Inline expects annotations comments for keywords are not separeted with ‘:`. This cop checks for comments that do not match the expected pattern.
Constant Summary collapse
- MSG =
'Do not use `:` after the keyword.'- RBS_INLINE_KEYWORDS =
%w[inherits override use module-self generic skip module class].freeze
Instance Method Summary collapse
Instance Method Details
#on_new_investigation ⇒ Object
: Array
25 26 27 28 29 30 31 |
# File 'lib/rubocop/cop/style/rbs_inline/keyword_separator.rb', line 25 def on_new_investigation #: void processed_source.comments.each do |comment| if (matched = comment.text.match(/\A#\s+@rbs\s+(#{RBS_INLINE_KEYWORDS.join('|')}):/)) add_offense(invalid_location_for(comment, matched)) end end end |