-
-
Notifications
You must be signed in to change notification settings - Fork 327
Verify plugin validation codes follow expected alphanumeric style #325
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
Comments
In GitLab by @pjacock on Nov 27, 2019, 06:13 mentioned in merge request !385 |
In GitLab by @keisheiled on Nov 27, 2019, 09:52 I really prefer named error codes like eslint and pylint, perhaps this regex could instead be expanded |
In GitLab by @asottile on Nov 27, 2019, 09:58 it's unfortunately not that simple, especially when you consider the format for flake8 has always had this style of codes and I don't think that's going to change any time soon (even it if kind of accidentally sort-of works in some cases) |
In GitLab by @sigmavirus24 on Nov 27, 2019, 12:36 @keisheiled We're already trying not to step on pylint's toes and vice-versa as users run both flake8 and pylint against their codebase. Adding those error codes would only be more confusing and introduce more potential for problems. In other words, that makes me a hard "no" |
Assuming I've understood this correctly, it looks like this is happening now. If I look at a plugin that does not follow this pattern, I now get the following errors on
Should this be closed as fixed? Alternatively, should the error be turned to a warning for now to allow some time for developers of flake8 plugins to switch over? |
I should say, closed as either fixed or won't fix: I think the original ask here was to allow more complex codes which we're clearly not going to do now. |
flake8 has always expected codes to use formats like 'E123' or 'W451'. More complex codes like 'COMPANY-UNIT-TESTS-FILEPATH' have traditionally worked everywhere *except* in flake8 configuration files, and attempts to change this have been rejected [1]. The upcoming version of flake8 now enforced this practice everywhere, which is resulting in the following error message when attempting to use 'flake8-logging-format' with master of 'flake8' [2]: There was a critical error during execution of Flake8: plugin code for `flake8-logging-format[logging-format]` does not match ^[A-Z]{1,3}[0-9]{0,3}$ The resolution here is change our code to something that matches this pattern. We use 'LF' since it should be fairly unique and _somewhat_ descriptive. [1] PyCQA/flake8#1568 [2] PyCQA/flake8#325 Signed-off-by: Stephen Finucane <stephen@that.guru>
flake8 has always expected codes to use formats like 'E123' or 'W451'. More complex codes like 'COMPANY-UNIT-TESTS-FILEPATH' have traditionally worked everywhere *except* in flake8 configuration files, and attempts to change this have been rejected [1]. The upcoming version of flake8 now enforced this practice everywhere, which is resulting in the following error message when attempting to use 'flake8-logging-format' with master of 'flake8' [2]: There was a critical error during execution of Flake8: plugin code for `flake8-logging-format[logging-format]` does not match ^[A-Z]{1,3}[0-9]{0,3}$ The resolution here is change our code to something that matches this pattern. We use 'G' as this matches the codes provided by this plugin. [1] PyCQA/flake8#1568 [2] PyCQA/flake8#325 Signed-off-by: Stephen Finucane <stephen@that.guru>
flake8 has always expected codes to use formats like 'E123' or 'W451'. More complex codes like 'COMPANY-UNIT-TESTS-FILEPATH' have traditionally worked everywhere *except* in flake8 configuration files, and attempts to change this have been rejected [1]. The upcoming version of flake8 now enforced this practice everywhere, which is resulting in the following error message when attempting to use 'flake8-logging-format' with master of 'flake8' [2]: There was a critical error during execution of Flake8: plugin code for `flake8-logging-format[logging-format]` does not match ^[A-Z]{1,3}[0-9]{0,3}$ The resolution here is change our code to something that matches this pattern. We use 'G' as this matches the codes provided by this plugin. [1] PyCQA/flake8#1568 [2] PyCQA/flake8#325 Signed-off-by: Stephen Finucane <stephen@that.guru>
What exactly was the issue with codes with more than 3 letters or numbers (like ABCD1234)? I haven't encountered any issues with plugins that use that format; noqa comments and the If I make the plugin's entry point be "ABC" but keep the error codes as "ABCD1234" everything still seems to work fine with flake8 5.x. You can even do |
In GitLab by @pjacock on Nov 27, 2019, 06:10
Spin out from discussion on https://gitlab.com/pycqa/flake8/merge_requests/385
https://gitlab.com/pycqa/flake8/blob/e571167161a42a5da052eaf247ab13ac0c56b7c6/src/flake8/defaults.py#L39 defines a REGEX which implicitly limits the allowed pattern for violation codes:
There should be a separate pattern for the violation codes (
NOQA_INLINE_REGEXP
could be defined using this), and this can be used to validate messages from plugins match this (and if not raise an error) before reporting them to the user.The text was updated successfully, but these errors were encountered: