Skip to content
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

Argument counting doesn't work when '%s' is missing enitrely #81

Open
Seefooo opened this issue Dec 22, 2023 · 1 comment
Open

Argument counting doesn't work when '%s' is missing enitrely #81

Seefooo opened this issue Dec 22, 2023 · 1 comment

Comments

@Seefooo
Copy link

Seefooo commented Dec 22, 2023

Python Version

3.11

flake8 Version

6.1.0

Package Version

N/A Using pre-commit to get this and I am not sure how to find out

Description

Basically, the arg counting doesn't cover the case where the string lacks any %s, but still has arguments.

Example: logger.error("Test Example.", 42)

@adamchainz
Copy link
Owner

Hi

This was done somewhat on purpose because I was concerned that alternative formatting styles may be in use, like {}. Avoiding a message when there was no % marker was a heuristic to allow other styles. See: #17 (comment)

I think I misunderstood the logging docs a bit, though? So perhaps we can expand the feature to the “no markers” situation.

Do you think my research is correct? It would be good if you could double-check my research.

Also, it would handy if you could make a PR expanding the rule. I won’t be able to prioritize it for a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants