You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For the inline disabling of cops in inspected code, RuboCop allows many variations of the # rubocop:disable and # rubocop:todo comments when it comes to the use of whitespace.
The Style/CommentedKeyword cop, which reports on end-of-line comments next to certain keywords, makes exceptions for these special comments and don't report offenses for them. The problem is that the cop's definition of the comments is quite strict regarding whitespace, and it deviates from what other parts of RuboCop defines as acceptable syntax for them.
Expected behavior
The same definition of # rubocop:disable and # rubocop:todo should be used everywhere.
Actual behavior
Style/CommentedKeyword reports and corrects offenses if the spacing isn't # rubopcop:disable Dept/Cop.
Steps to reproduce the problem
Run rubocop --only Style/CommentedKeyword on the file
…e/CommentedKeyword
To make sure we don't have a different, more strict definition of what
constitutes a rubocop:disable or rubocop:todo comment in the cop compared to
elsewhere in the code, use the definition implemented in DirectiveComment.
We also get the rubocop:enable comments included in this definition, but it's
not a problem if we allow those comments in the cop, as they don't make any
sense as end-of-line comments and are unlikely to occur.
This came out of the discussion in #12705.
For the inline disabling of cops in inspected code, RuboCop allows many variations of the
# rubocop:disable
and# rubocop:todo
comments when it comes to the use of whitespace.The
Style/CommentedKeyword
cop, which reports on end-of-line comments next to certain keywords, makes exceptions for these special comments and don't report offenses for them. The problem is that the cop's definition of the comments is quite strict regarding whitespace, and it deviates from what other parts of RuboCop defines as acceptable syntax for them.Expected behavior
The same definition of
# rubocop:disable
and# rubocop:todo
should be used everywhere.Actual behavior
Style/CommentedKeyword
reports and corrects offenses if the spacing isn't# rubopcop:disable Dept/Cop
.Steps to reproduce the problem
Run
rubocop --only Style/CommentedKeyword
on the fileAn offense is reported.
RuboCop version
The text was updated successfully, but these errors were encountered: