Skip to content

[pygrep_hooks] Move blanket-noqa to noqa checker (PGH004)#11053

Merged
charliermarsh merged 1 commit intoastral-sh:mainfrom
augustelalande:pgh004
Apr 22, 2024
Merged

[pygrep_hooks] Move blanket-noqa to noqa checker (PGH004)#11053
charliermarsh merged 1 commit intoastral-sh:mainfrom
augustelalande:pgh004

Conversation

@augustelalande
Copy link
Copy Markdown
Contributor

Summary

Move blanket-noqa rule from the token checker to the noqa checker. This allows us to make use of the line directives already computed in the noqa checker.

Test Plan

Verified test results are unchanged.

@github-actions
Copy link
Copy Markdown
Contributor

ruff-ecosystem results

Linter (stable)

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

bokeh/bokeh (+1 -1 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --no-preview --select ALL

+ src/bokeh/embed/util.py:146:32: RUF100 [*] Unused blanket `noqa` directive
- src/bokeh/embed/util.py:146:32: RUF100 [*] Unused blanket `noqa` directive

rotki/rotki (+2 -2 violations, +0 -0 fixes)

+ pytestgeventwrapper.py:1:48: RUF100 [*] Unused blanket `noqa` directive
- pytestgeventwrapper.py:1:48: RUF100 [*] Unused blanket `noqa` directive
+ pytestgeventwrapper.py:2:34: RUF100 [*] Unused blanket `noqa` directive
- pytestgeventwrapper.py:2:34: RUF100 [*] Unused blanket `noqa` directive

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
RUF100 6 3 3 0 0

Linter (preview)

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

bokeh/bokeh (+1 -1 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL

+ src/bokeh/embed/util.py:146:32: RUF100 [*] Unused blanket `noqa` directive
- src/bokeh/embed/util.py:146:32: RUF100 [*] Unused blanket `noqa` directive

rotki/rotki (+2 -2 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ pytestgeventwrapper.py:1:48: RUF100 [*] Unused blanket `noqa` directive
- pytestgeventwrapper.py:1:48: RUF100 [*] Unused blanket `noqa` directive
+ pytestgeventwrapper.py:2:34: RUF100 [*] Unused blanket `noqa` directive
- pytestgeventwrapper.py:2:34: RUF100 [*] Unused blanket `noqa` directive

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
RUF100 6 3 3 0 0

@MichaReiser MichaReiser added the internal An internal refactor or improvement label Apr 22, 2024
@MichaReiser
Copy link
Copy Markdown
Member

MichaReiser commented Apr 22, 2024

Uhh, what are the differences in the ecosystem check. Are the ranges different?

@augustelalande
Copy link
Copy Markdown
Contributor Author

It's because the reporting order gets switched.
Before

➜  ruff check ..\test\ruff_test\main.py --no-cache --exit-zero --output-format concise --preview --select RUF100,PGH004
C:\Users\Auguste\workspace\test\ruff_test\main.py:158:32: PGH004 Use specific rule codes when using `noqa`
C:\Users\Auguste\workspace\test\ruff_test\main.py:158:32: RUF100 [*] Unused blanket `noqa` directive
Found 2 errors.
[*] 1 fixable with the `--fix` option.

After

➜  cargo run -p ruff -- check ..\test\ruff_test\main.py --no-cache --preview --exit-zero --output-format concise --select RUF100,PGH004
    Finished dev [unoptimized + debuginfo] target(s) in 0.44s
     Running `target\debug\ruff.exe check ..\test\ruff_test\main.py --no-cache --preview --exit-zero --output-format concise --select RUF100,PGH004`
C:\Users\Auguste\workspace\test\ruff_test\main.py:158:32: RUF100 [*] Unused blanket `noqa` directive
C:\Users\Auguste\workspace\test\ruff_test\main.py:158:32: PGH004 Use specific rule codes when using `noqa`
Found 2 errors.
[*] 1 fixable with the `--fix` option.

@charliermarsh
Copy link
Copy Markdown
Member

Oh hah that's funny. Thanks for looking into it.

@charliermarsh charliermarsh merged commit 647548b into astral-sh:main Apr 22, 2024
@augustelalande augustelalande deleted the pgh004 branch April 22, 2024 17:37
@qarmin qarmin mentioned this pull request Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal An internal refactor or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants