-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Avoid parsing joint rule codes as distinct codes in # noqa
#12809
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
0584d32 to
149bb2e
Compare
|
# noqa: A三Did you mean to use |
|
Seems reasonable to exclude non-ASCII. |
149bb2e to
383676e
Compare
CodSpeed Performance ReportMerging #12809 will not alter performanceComparing Summary
|
|
On that same note, "ASCII whitespace" is defined as "space, tab, LF, FF, CR". In our case, since Python comments don't allow line breaks, that boils down to just spaces and tabs. |
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| RUF100 | 3 | 3 | 0 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+3 -0 violations, +0 -0 fixes in 1 projects; 53 projects unchanged)
apache/airflow (+3 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL
+ providers/src/airflow/providers/apache/hdfs/sensors/hdfs.py:45:37: RUF100 [*] Unused `noqa` directive (unknown: `Ignore`) + providers/src/airflow/providers/apache/hdfs/sensors/hdfs.py:50:38: RUF100 [*] Unused `noqa` directive (unknown: `Ignore`) + providers/src/airflow/providers/google/cloud/hooks/bigquery.py:59:42: RUF100 [*] Unused `noqa` directive (unknown: `Used`)
Changes by rule (1 rules affected)
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| RUF100 | 3 | 3 | 0 | 0 | 0 |
|
But Python comments can contain non-ASCII whitespace? We already have an |
Fair enough, though I still don't see why someone would want to use non-ASCII whitespace in the |
|
One more thing: |
|
|
||
| #[test] | ||
| fn noqa_empty_comma() { | ||
| let source = "# noqa: F401,,F841"; |
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.
I think we should show a warning in this case but still parse the remaining codes (if that's possible currently). This would be similar to how we recover from a missing element in list parsing: https://play.ruff.rs/308ab356-9355-43f3-99b7-12c7c2de7334.
464bb82 to
5894aa0
Compare
5894aa0 to
c2e9746
Compare
# Summary The goal of this PR is to address various issues around parsing suppression comments by 1. Unifying the logic used to parse in-line (`# noqa`) and file-level (`# ruff: noqa`) noqa comments 2. Recovering from certain errors and surfacing warnings in these cases Closes #15682 Supersedes #12811 Addresses #14229 (comment) Related: #14229 , #12809
# Summary The goal of this PR is to address various issues around parsing suppression comments by 1. Unifying the logic used to parse in-line (`# noqa`) and file-level (`# ruff: noqa`) noqa comments 2. Recovering from certain errors and surfacing warnings in these cases Closes #15682 Supersedes #12811 Addresses #14229 (comment) Related: #14229 , #12809
# Summary The goal of this PR is to address various issues around parsing suppression comments by 1. Unifying the logic used to parse in-line (`# noqa`) and file-level (`# ruff: noqa`) noqa comments 2. Recovering from certain errors and surfacing warnings in these cases Closes #15682 Supersedes #12811 Addresses #14229 (comment) Related: #14229 , #12809
Summary
We should enable warnings for unsupported codes, but this at least fixes the parsing for
# noqa: F401F841.Closes #12808.