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

PGH004 (blanket-noqa) doesn't checks file-level pragmas #11454

Closed
ashrub-holvi opened this issue May 17, 2024 · 1 comment · Fixed by #11540
Closed

PGH004 (blanket-noqa) doesn't checks file-level pragmas #11454

ashrub-holvi opened this issue May 17, 2024 · 1 comment · Fixed by #11540
Labels
help wanted Contributions especially welcome rule Implementing or modifying a lint rule

Comments

@ashrub-holvi
Copy link

Hi,

If blanket noqa is used on a file level, cat test.py:

# ruff: noqa

print("Hello Astral!")

ruff will not complain about it:

ruff check --select=PGH004 test.py
All checks passed!

but probably it should, because in any case better to disable exact rules, not everything.
Same for # flake8: noqa which is also supported by ruff.

ruff --version
ruff 0.4.4
@charliermarsh charliermarsh added the rule Implementing or modifying a lint rule label May 17, 2024
@charliermarsh
Copy link
Member

Seems reasonable to me? May need to be added in preview since it's an increase in the scope of the rule.

@zanieb zanieb added the help wanted Contributions especially welcome label May 18, 2024
charliermarsh pushed a commit that referenced this issue Jun 4, 2024
…4`) (#11540)

## Summary

Should resolve #11454.

This is my first PR to `ruff`, so I may have missed something.

If I understood the suggestion in the issue correctly, rule `PGH004`
should be set to `Preview` again.

## Test Plan

Created two fixtures derived from the issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Contributions especially welcome rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants