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

[pygrep-hooks] Improve blanket-noqa error message (PGH004) #10851

Merged
merged 2 commits into from Apr 10, 2024

Conversation

augustelalande
Copy link
Contributor

@augustelalande augustelalande commented Apr 9, 2024

Summary

Improve blanket-noqa error message in cases where codes are provided but not detected due to formatting issues. Namely # noqa X100 (missing colon) or noqa : X100 (space before colon). The behavior is similar to NQA002 and NQA003 from flake8-noqa mentioned in #850. The idea to merge the rules into PGH004 was suggested by @MichaReiser #10325 (comment).

Test Plan

Test cases added to fixture.

Copy link

github-actions bot commented Apr 9, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@charliermarsh charliermarsh self-assigned this Apr 10, 2024
@charliermarsh charliermarsh self-requested a review April 10, 2024 03:40
@charliermarsh charliermarsh added the rule Implementing or modifying a lint rule label Apr 10, 2024
Copy link
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

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

Thanks!

@charliermarsh charliermarsh enabled auto-merge (squash) April 10, 2024 04:21
@charliermarsh charliermarsh merged commit de46a36 into astral-sh:main Apr 10, 2024
17 checks passed
@augustelalande augustelalande deleted the improve-pgh004 branch April 10, 2024 15:10
Glyphack pushed a commit to Glyphack/ruff that referenced this pull request Apr 12, 2024
…ral-sh#10851)

## Summary

Improve `blanket-noqa` error message in cases where codes are provided
but not detected due to formatting issues. Namely `# noqa X100` (missing
colon) or `noqa : X100` (space before colon). The behavior is similar to
`NQA002` and `NQA003` from `flake8-noqa` mentioned in astral-sh#850. The idea to
merge the rules into `PGH004` was suggested by @MichaReiser
astral-sh#10325 (comment).

## Test Plan

Test cases added to fixture.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants