Skip to content

Incorrect ignore logic #4916

@dcragusa

Description

@dcragusa

Ruff version ruff 0.0.271.

pyproject.toml:

[tool.ruff]
select = ["ALL"]

test.py:

"""Module to test ruff ignores."""
print("test")
a = 20  # TODO

Command run: ruff . in project directory.

Output seen:

test.py:2:1: T201 `print` found
test.py:3:11: TD002 Missing author in TODO; try: `# TODO(<author_name>): ...`
test.py:3:11: TD004 Missing colon in TODO
test.py:3:11: TD005 Missing issue description after `TODO`
test.py:3:11: TD003 Missing issue link on the line following this TODO
test.py:3:11: T002 Line contains TODO

This is fine. Now we add ignore = ["T20"] to the toml file. Output seen:

test.py:3:11: TD002 Missing author in TODO; try: `# TODO(<author_name>): ...`
test.py:3:11: TD004 Missing colon in TODO
test.py:3:11: TD005 Missing issue description after `TODO`
test.py:3:11: TD003 Missing issue link on the line following this TODO
test.py:3:11: T002 Line contains TODO

This is also fine. But if we change it to ignore = ["T"], we see:

test.py:3:11: TD002 Missing author in TODO; try: `# TODO(<author_name>): ...`
test.py:3:11: TD004 Missing colon in TODO
test.py:3:11: TD005 Missing issue description after `TODO`
test.py:3:11: TD003 Missing issue link on the line following this TODO
test.py:3:11: T002 Line contains TODO

Instead we should be seeing:

test.py:2:1: T201 `print` found
test.py:3:11: TD002 Missing author in TODO; try: `# TODO(<author_name>): ...`
test.py:3:11: TD004 Missing colon in TODO
test.py:3:11: TD005 Missing issue description after `TODO`
test.py:3:11: TD003 Missing issue link on the line following this TODO

Ruff is confusing T and T20.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionAsking for support or clarification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions