-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
RUF027 no longer has false negatives with string literals inside of method calls #9865
Conversation
…e of method calls
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
RUF027 | 8 | 8 | 0 | 0 | 0 |
The Rasa checks look like false positives (hard to avoid...), the Ibis check looks like a true positive (I think), the Pandas check looks like a false positive (maybe avoidable?), the Rotki checks look like they might be true positives. |
Perhaps we could avoid the Pandas false positive by also ignoring calls with positional arguments that use the exact same name... |
…ls that use variables which any method calls also use
@charliermarsh I added some logic to ignore literals with matching regular arguments in addition to keyword arguments. |
CodSpeed Performance ReportMerging #9865 will improve performances by 11.53%Comparing Summary
Benchmarks breakdown
|
…ethod calls (astral-sh#9865) Fixes astral-sh#9857. ## Summary Statements like `logging.info("Today it is: {day}")` will no longer be ignored by RUF027. As before, statements like `"Today it is: {day}".format(day="Tuesday")` will continue to be ignored. ## Test Plan The snapshot tests were expanded to include new cases. Additionally, the snapshot tests have been split in two to separate positive cases from negative cases.
Fixes #9857.
Summary
Statements like
logging.info("Today it is: {day}")
will no longer be ignored by RUF027. As before, statements like"Today it is: {day}".format(day="Tuesday")
will continue to be ignored.Test Plan
The snapshot tests were expanded to include new cases. Additionally, the snapshot tests have been split in two to separate positive cases from negative cases.