-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Lint/UnneededDisable of Metrics/LineLength that isn't unneeded #4001
Comments
I confirmed the report. Also, changing Sidenote: It would be nice if |
As it turns out, it's really easy to reproduce this. Any line containing both non-directive I'd be happy to submit a fix for this. |
COMMENT_DIRECTIVE_REGEXP = Regexp.new(
('\A# rubocop : ((?:dis|en)able)\b ' + COPS_PATTERN).gsub(' ', '\s*')
) Is it necessary for the regexp to have the |
Metrics/LineLength had a bug when configured with “ignoreCopDirectives” set to true AND checking a line with both directive # and non-directive # present. For example: ```rb aaa … aaa # bbb … bbb # rubocop:disable CopName ``` where (aaa … aaa # bbb … bbb) exceeds the specified line length. The cop would correctly detect it as a violation, but would return the extraneous characters AND the directive in the error message. ```rb LARGE_DATA_STRING_PATTERN = %r{\A([A-Za-z0-9\+\/#]…)} # rubocop:disable CopName ``` The above line has # as part of regexp and the line is longer than the permissible line length before the directive. The cop did not detect it as a violation.
This line (among many others) is throwing an error for me:
My full
LineLength
config is as follows:Expected behavior
No error for
Lint/UnneededDisable
Actual behavior
An error for
Lint/UnneededDisable
RuboCop version
The text was updated successfully, but these errors were encountered: