Skip to content

[pycodestyle] Fix duplicated diagnostic in E712 #17651

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

Merged
merged 2 commits into from
Apr 28, 2025

Conversation

LaBatata101
Copy link
Contributor

Summary

Fixes a duplicated diagnostic when both sides of the operator are True.
Example:

if True == True:
    ...

Let me know if there is another case where this could happen, I couldn't think of any.

Fixes #17582.

Test Plan

Snapshot tests.

@LaBatata101
Copy link
Contributor Author

Hmm, weird tests didn't fail locally.

@Daverball
Copy link
Contributor

@LaBatata101 You probably changed the comment in E712.py and forgot to rerun cargo insta test afterwards or you forgot to include your updated snapshot in your initial commit.

It used to read # No duplicated error, but you changed it to # No duplicated diagnostic, but the snapshot still contains the old comment. The snapshot needs to match exactly, so every time you change the source code, you also need to update the snapshot again.

@MichaReiser MichaReiser added the rule Implementing or modifying a lint rule label Apr 27, 2025
@LaBatata101
Copy link
Contributor Author

@LaBatata101 You probably changed the comment in E712.py and forgot to rerun cargo insta test afterwards or you forgot to include your updated snapshot in your initial commit.

It used to read # No duplicated error, but you changed it to # No duplicated diagnostic, but the snapshot still contains the old comment. The snapshot needs to match exactly, so every time you change the source code, you also need to update the snapshot again.

Thanks!

Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@MichaReiser MichaReiser merged commit 826b2c9 into astral-sh:main Apr 28, 2025
33 checks passed
@MichaReiser MichaReiser added the bug Something isn't working label Apr 28, 2025
dcreager added a commit that referenced this pull request Apr 28, 2025
* main: (37 commits)
  [red-knot] Revert blanket `clippy::too_many_arguments` allow (#17688)
  Add config option to disable `typing_extensions` imports  (#17611)
  ruff_db: render file paths in diagnostics as relative paths if possible
  Bump mypy_primer pin (#17685)
  red_knot_python_semantic: improve `not-iterable` diagnostic
  [red-knot] Allow all callables to be assignable to @Todo-signatures (#17680)
  [`refurb`] Mark fix as safe for `readlines-in-for` (`FURB129`) (#17644)
  Collect preview lint behaviors in separate module (#17646)
  Upgrade Salsa to a more recent commit (#17678)
  [red-knot] TypedDict: No errors for introspection dunder attributes (#17677)
  [`flake8-pyi`] Ensure `Literal[None,] | Literal[None,]` is not autofixed to `None | None` (`PYI061`) (#17659)
  [red-knot] No errors for definitions of `TypedDict`s (#17674)
  Update actions/download-artifact digest to d3f86a1 (#17664)
  [red-knot] Use 101 exit code when there's at least one diagnostic with severity 'fatal' (#17640)
  [`pycodestyle`] Fix duplicated diagnostic in `E712` (#17651)
  [airflow] fix typos `AIR312` (#17673)
  [red-knot] Don't ignore hidden files by default (#17655)
  Update pre-commit hook astral-sh/ruff-pre-commit to v0.11.7 (#17670)
  Update docker/build-push-action digest to 14487ce (#17665)
  Update taiki-e/install-action digest to ab3728c (#17666)
  ...
@LaBatata101 LaBatata101 deleted the fix-E712 branch April 30, 2025 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicate E712 diagnostics
3 participants