-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Detect missing arguments in logging format strings #10108
base: main
Are you sure you want to change the base?
Conversation
π€ Effect of this PR on checked open source code: π€ Effect on home-assistant:
This comment was generated for commit ee3d0b0 |
Those home assistant warnings are actual issues, this is looking very good. |
@@ -326,10 +326,6 @@ def _check_format_string(self, node: nodes.Call, format_arg: Literal[0, 1]) -> N | |||
format_arg: Index of the format string in the node arguments. | |||
""" | |||
num_args = _count_supplied_tokens(node.args[format_arg + 1 :]) | |||
if not num_args: | |||
# If no args were supplied the string is not interpolated and can contain | |||
# formatting characters - it's used verbatim. Don't check any further. |
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.
It seems to be voluntary though. Might need a dΓ©cision
Type of Changes
Description
This PR raises logging-too-few-args when the logging message contains placeholders but no arguments are provided as suggested by @zenlyj here: #9999 (comment)
Closes #9999