Skip to content

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

Merged
charliermarsh merged 2 commits intoastral-sh:mainfrom
augustelalande:improve-pgh004
Apr 10, 2024
Merged

[pygrep-hooks] Improve blanket-noqa error message (PGH004)#10851
charliermarsh merged 2 commits intoastral-sh:mainfrom
augustelalande:improve-pgh004

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.

@github-actions
Copy link
Contributor

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
@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.

2 participants