Skip to content

# flake8: noqa top-of-the-file comment doesn't respect external config #10202

@Avasam

Description

@Avasam

The warning:
warning: Invalid rule code provided to # ruff: noqa at stubs\six\six\moves\builtins.pyi:1: NQA102

The Python file:

# flake8: noqa: NQA102 # https://github.com/plinss/flake8-noqa/issues/22
# six explicitly re-exports builtins. Normally this is something we'd want to avoid.
# But this is specifically a compatibility package.
from builtins import *  # noqa: UP029

The Ruff lint configs (I stripped out format configs):

[tool.ruff.lint]
# We still use flake8-pyi and flake8-noqa to check these (see .flake8 config file)
external = ["F821", "NQA", "Y"]
extend-select = [
    "B", # flake8-bugbear
    "FA", # flake8-future-annotations
    "I", # isort
    "RUF", # Ruff-specific and unused-noqa
    "UP", # pyupgrade
    # PYI: only enable rules that always autofix, avoids duplicate # noqa with flake8-pyi
    # See https://github.com/plinss/flake8-noqa/issues/22
    "PYI009", # use `...`, not `pass`, in empty class bodies
    "PYI010", # function bodies must be empty
    "PYI012", # class bodies must not contain `pass`
    "PYI013", # non-empty class bodies must not contain `...`
    "PYI016", # duplicate union member
    "PYI020", # quoted annotations are always unnecessary in stubs
    "PYI025", # always alias `collections.abc.Set` as `AbstractSet` when importing it
    "PYI032", # use `object`, not `Any`, as the second parameter to `__eq__`
    "PYI055", # multiple `type[T]` usages in a union
    "PYI058", # use `Iterator` as the return type for `__iter__` methods
]
ignore = [
    ###
    # Rules we don't want or don't agree with
    ###
    # Slower and more verbose https://github.com/astral-sh/ruff/issues/7871
    "UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)`
    # Used for direct, non-subclass type comparison, for example: `type(val) is str`
    # see https://github.com/astral-sh/ruff/issues/6465
    "E721", # Do not compare types, use `isinstance()`
    ###
    # False-positives, but already checked by type-checkers
    ###
    # Ruff doesn't support multi-file analysis yet: https://github.com/astral-sh/ruff/issues/5295
    "RUF013", # PEP 484 prohibits implicit `Optional`
]

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions