Skip to content

Request: Enforce space after colon (:) for special comments #10160

@Avasam

Description

@Avasam

I've open the same request over at PyCQA/flake8-pyi#465 , but I think that Ruff could generalize this, or at least expand on supported keywords.

Comments handled by Ruff
# noqa:Y011 --> # noqa: Y011 (not handled by flake8-noqa #850 )
# fmt:off --> # fmt: off (except if this is added to a formatter)
# ruff:noqa --> # ruff: noqa
# ruff:noqa:F811 --> # ruff: noqa: F811 (or at least # ruff: noqa:F811 if generalized)
# flake8:noqa:F811 --> # flake8: noqa: F811 (or at least # flake8: noqa:F811 if generalized)
# ruff:isort:skip_file --> # ruff: isort: skip_file (or at least # ruff: isort:skip_file if generalized)
# isort:skip_file --> # isort: skip_file

Not handled by Ruff, but popular:
# type:ignore --> # type: ignore
# pyright:ignore --> # pyright: ignore
# nopycln:import --> # nopycln: import
...

Basically the same as https://docs.astral.sh/ruff/rules/missing-space-after-todo-colon/ but with a lot more keywords

Formatters (black and Ruff) already take of adding a space after #

Metadata

Metadata

Assignees

No one assigned

    Labels

    ruleImplementing or modifying a lint rule

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions