Avoid treating lowercase letters as # noqa codes#14229
Merged
charliermarsh merged 1 commit intomainfrom Nov 9, 2024
Merged
Conversation
# noqa codes
charliermarsh
commented
Nov 9, 2024
| }, | ||
| Code { | ||
| code: "F841", | ||
| range: 12..16, |
Member
Author
There was a problem hiding this comment.
This seems "fine", it's not ambiguous.
Contributor
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| RUF100 | 3 | 0 | 3 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+0 -3 violations, +0 -0 fixes in 1 projects; 53 projects unchanged)
apache/airflow (+0 -3 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 | 0 | 3 | 0 | 0 |
| let suffix = line[prefix..] | ||
| .chars() | ||
| .take_while(char::is_ascii_alphanumeric) | ||
| .take_while(char::is_ascii_digit) |
Contributor
There was a problem hiding this comment.
What about ParsedFileExemption::lex_code()?
There are multiple reimplementations of the # noqa parsing algorithm, including two by me (RyeCharm, #14111) and another by @koxudaxi (Ruff PyCharm Plugin). I would appreciate it if you could keep it consistent.
dylwil3
added a commit
that referenced
this pull request
Mar 11, 2025
# 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
MichaReiser
pushed a commit
that referenced
this pull request
Mar 13, 2025
# 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
MichaReiser
pushed a commit
that referenced
this pull request
Mar 13, 2025
# 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
An oversight from the original implementation.
Closes #14228.