-
-
Couldn't load subscription status.
- Fork 1.2k
Fixes for linting of new style logging format. #2713
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
Conversation
| # special keywords - out of scope. | ||
| return | ||
| elif self._format_style == "new": | ||
| keys, num_args, manual_pos_arg = utils.parse_format_method_string( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bug was that num_args was overwriting the one at line 287, so the number of arguments always matches when using implicit positional placeholders. And never matches when using named arguments.
The changes are just renaming variables + removing the short-circuit for no arguments case above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me! Can you fix the CI failures? It's currently failing due to formatting issues. You can follow the pre-commit recommendations from the documentation (or run black manually over those files): http://pylint.pycqa.org/en/latest/development_guide/contribute.html#repository
The number of arguments was not handled properly, leading to an always successful check. See new tests for specific cases this fixes.
|
@PCManticore this is good to go. |
|
Thanks a lot @neykov for this PR! |
…ated too The original decision was taken in db8b3a4 during implementation with a different rational ("If no args were supplied, then all format strings are valid don't check any further.") and was not discussed again when the comment was updated in #2713. I think the new behavior make sense especially considering that the primer shows 4 false negative in home-assistant. Co-authored by: Alex Prabhat Bara <[email protected]>
…ated too The original decision was taken in db8b3a4 during implementation with a different rational ("If no args were supplied, then all format strings are valid don't check any further.") and was not discussed again when the comment was updated in #2713. I think the new behavior make sense especially considering that the primer shows 4 false negative in home-assistant. Co-authored-by: Alex Prabhat Bara <[email protected]>
… at all (#10321) * [feat] Detect missing formatting args when the string is not interpolated too The original decision was taken in db8b3a4 during implementation with a different rational ("If no args were supplied, then all format strings are valid don't check any further.") and was not discussed again when the comment was updated in #2713. I think the new behavior make sense especially considering that the primer shows 4 false negative in home-assistant. Co-authored-by: Alex Prabhat Bara <[email protected]> * Fix required because logging are tested elsewhere
Steps
doc/whatsnew/<current release.rst>.Description
The number of arguments was not handled properly, leading to an always successful check. See new tests for specific cases this fixes.
Type of Changes
Related Issue