New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
false offense for Style/CommentedKeyword #4886
Comments
Hm. I'm guessing this cop uses a regular expression instead of checking for comments outside the AST. 😅 |
We should add an internal affairs cop that bans this. Seems to be the source of a lot of bugs |
@backus True. And I guess we don't review these things very carefully. 😆 |
Same problem here. app/helpers/bootstrap/alert_helper.rb:49:40: C: Do not place comments on the same line as the def keyword.
def alert_link(name = nil, path = '#', options = {}, &block)
^^^^^^^^^^^^^^^^^^^^^^^^^ |
Also here: def self.tap_paths(name, taps = Dir["#{HOMEBREW_LIBRARY}/Taps/*/*/"]) |
same for
|
Commit also contains cop improvements: Instead of going through each line of the processed_source we can easily take comments only and cop only those lines, where comments are located. Instead of splitting line with `#` symbol we take column values from `comment.location`.
Commit also contains cop improvements: Instead of going through each line of the processed_source we can easily take comments only and cop only those lines, where comments are located. Instead of splitting line with `#` symbol we take column values from `comment.location`.
Expected behavior
I expect rubocop to allow literal octothorpes and interpolated strings in method arguments.
Actual behavior
An offense was generated for an interpolated string in a method argument. The offense claims this is a comment, which triggered a violation of the
Style/CommentedKeyword
cop.Steps to reproduce the problem
$ rubocop
RuboCop version
0.51.0
The text was updated successfully, but these errors were encountered: