You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I am seeing the same diagnostic reported twice in the VS Code "Problems" tab when using the Ruff extension. Specifically, the RUF001: Avoid equality comparisons to True; use is True for truth checks error appears two times for the same line of code.
To Reproduce
Steps to reproduce the behavior:
Set up a Python project using Poetry.
Add ruff to the development dependencies (poetry add ruff@latest --group dev).
Ensure the Ruff VS Code extension is installed and enabled.
Create a Python file with code that triggers the RUF001 rule, e.g., if variable == True:.
Open the file in VS Code.
Observe the "Problems" tab where the RUF001 diagnostic is listed twice for the same location.
Expected behavior
I would expect the diagnostic for the RUF001 error to appear only once in the "Problems" tab.
Thanks for the report! I don't think this is a duplicate diagnostic. You're getting one diagnostic for each True value, but each diagnostic highlights the whole comparison expression. If you had PLR0133 enabled, you'd get a third diagnostic with the same range: https://play.ruff.rs/68219349-d23f-45a8-91b3-1154d97b805f
We could arguably limit the ranges to each True separately, but I think it generally makes sense to mark the whole comparison.
Duplicate diagnostics for RUF001 in VS Code
Describe the bug
I am seeing the same diagnostic reported twice in the VS Code "Problems" tab when using the Ruff extension. Specifically, the
RUF001: Avoid equality comparisons to True; use
is Truefor truth checks
error appears two times for the same line of code.To Reproduce
Steps to reproduce the behavior:
ruff
to the development dependencies (poetry add ruff@latest --group dev
).RUF001
rule, e.g.,if variable == True:
.RUF001
diagnostic is listed twice for the same location.Expected behavior
I would expect the diagnostic for the
RUF001
error to appear only once in the "Problems" tab.Screenshots

Environment
Relevant Configuration
.venv\Scripts\python.exe
pyproject.toml
:The text was updated successfully, but these errors were encountered: