[flake8-noqa] Implement NQA002, NQA003, NQA004, and NQA005 - #10325
[flake8-noqa] Implement NQA002, NQA003, NQA004, and NQA005#10325augustelalande wants to merge 25 commits into
flake8-noqa] Implement NQA002, NQA003, NQA004, and NQA005#10325Conversation
|
I'm hoping someone can help me here. I've basically finalized the rules, but I can't run Appreciate any help. |
flake8-noqa] Implement NQA002, NQA003, NQA004, and NQA005flake8-noqa][help] Implement NQA002, NQA003, NQA004, and NQA005
|
Hi @augustelalande thanks for the pull request! I haven't looked at the changes yet but I think what you're looking for is |
This comment was marked as resolved.
This comment was marked as resolved.
|
Ah sorry I looked at the Linux CI which was failing for the reason I said but the Windows CI is indeed failing with that error I'd recommend trying the change they suggest here. cc @konstin who knows |
|
@zanieb It doesn't seem like a windows only issue. Check out the mkdocs check (running ubuntu). |
|
@zanieb Thanks I was wary of making the change because I was also not sure of the implications. |
flake8-noqa][help] Implement NQA002, NQA003, NQA004, and NQA005flake8-noqa] Implement NQA002, NQA003, NQA004, and NQA005
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| RUF100 | 6 | 6 | 0 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+9 -0 violations, +0 -0 fixes in 4 projects; 40 projects unchanged)
DisnakeDev/disnake (+1 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
+ disnake/utils.py:1161:48: RUF100 [*] Unused `noqa` directive (duplicated: `S307`)
RasaHQ/rasa (+2 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
+ rasa/core/agent.py:422:99: RUF030 [*] `noqa` directives should have one space after the colon + rasa/utils/tensorflow/model_data.py:106:114: RUF030 [*] `noqa` directives should have one space after the colon
PlasmaPy/PlasmaPy (+5 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
+ plasmapy/particles/tests/test_ionization_collection.py:461:40: RUF100 [*] Unused `noqa` directive (duplicated: `S307`) + plasmapy/particles/tests/test_ionization_collection.py:477:40: RUF100 [*] Unused `noqa` directive (duplicated: `S307`) + plasmapy/particles/tests/test_ionization_collection.py:494:40: RUF100 [*] Unused `noqa` directive (duplicated: `S307`) + plasmapy/particles/tests/test_particle_class.py:557:51: RUF100 [*] Unused `noqa` directive (duplicated: `S307`) + plasmapy/utils/tests/test_code_repr.py:327:41: RUF100 [*] Unused `noqa` directive (duplicated: `S307`)
ibis-project/ibis (+1 -0 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview
+ ibis/backends/tests/test_client.py:1544:43: RUF030 [*] `noqa` directives should have one space after the colon
Changes by rule (2 rules affected)
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| RUF100 | 6 | 6 | 0 | 0 | 0 |
| RUF030 | 3 | 3 | 0 | 0 | 0 |
This reverts commit 1ad9498.
|
Thank you @augustelalande, for working on the noqa rules. I've reviewed the rules and to my understanding:
That's why I think that it would be best to integrate:
I don't think there's an existing rule that covers What do you think? |
|
That sounds fine to me. |
|
Done. I also added a new RUF rule to detect missing spaces after noqa directives, e.g., If you merge this, you may want to consider closing #850, as I don't think anything else from there needs to be added to ruff. |
|
I'm gonna split this into seperate PRs to make it easier to merge. |
) ## 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.
…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.
…10850) ## Summary Implement duplicate code detection as part of `RUF100`, mirroring the behavior of `flake8-noqa` (`NQA005`) mentioned in #850. The idea to merge the rule into `RUF100` was suggested by @MichaReiser #10325 (comment). ## Test Plan Test cases were added to the fixture.
…851) ## 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 astral-sh/ruff#10325 (comment). ## Test Plan Test cases added to fixture.
…#10850) ## Summary Implement duplicate code detection as part of `RUF100`, mirroring the behavior of `flake8-noqa` (`NQA005`) mentioned in #850. The idea to merge the rule into `RUF100` was suggested by @MichaReiser astral-sh/ruff#10325 (comment). ## Test Plan Test cases were added to the fixture.
Summary
Implement
flake8-noqarules. Part of #850.Test Plan
Test fixtures have been added for all rules.