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

Avoid treating lowercase letters as # noqa codes #14229

Merged
merged 1 commit into from
Nov 9, 2024
Merged

Conversation

charliermarsh
Copy link
Member

Summary

An oversight from the original implementation.

Closes #14228.

@charliermarsh charliermarsh changed the title Avoid treating lowercase letters as noqa codes Avoid treating lowercase letters as # noqa codes Nov 9, 2024
},
Code {
code: "F841",
range: 12..16,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems "fine", it's not ambiguous.

@charliermarsh charliermarsh merged commit ce3af27 into main Nov 9, 2024
20 checks passed
@charliermarsh charliermarsh deleted the charlie/b branch November 9, 2024 17:49
Copy link
Contributor

github-actions bot commented Nov 9, 2024

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+0 -3 violations, +0 -0 fixes in 2 projects; 52 projects unchanged)

apache/airflow (+0 -3 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --no-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`)

pandas-dev/pandas (+0 -0 violations, +0 -0 fixes)


Changes by rule (1 rules affected)

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

@@ -183,9 +183,11 @@ impl<'a> Directive<'a> {
// Extract, e.g., the `401` in `F401`.
let suffix = line[prefix..]
.chars()
.take_while(char::is_ascii_alphanumeric)
.take_while(char::is_ascii_digit)
Copy link
Contributor

@InSyncWithFoo InSyncWithFoo Nov 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0.7.3 introduces false positives for invalid # noqa directives with RUF100
3 participants