Open alanhdu opened 11 months ago
Yeah I totally see the issue here. I think the second suggestion is going to be challenging, since we really prefer to keep rule behavior independent of the set of enabled rules (that is, we really want rules to operate independently, such that enabling or disabling one rule shouldn't affect the behavior of another). Breaking that principle can lead to confusing interactions, e.g., if you run ruff check
with RULE
in your pyproject.toml
vs. ruff check --select RULE
, you could then see different diagnostics for RULE
if it relies on enabled codes. (I should admit that RUF100
is the one rule that actually does suffer from this problem, since it can only detect whether a # noqa
is used for the enabled rules, but it at least tells you which rules are known-but-disabled codes.)
A few options, which may all be bad, I'm not sure:
external
is specified (as proposed above -- this seems reasonable).RUF100
on blank # noqa
at all if external
is enabled.external
is enabled, consider making the RUF100
fix such that we add the external codes to a blanket # noqa
? I don't know how long external
gets in practice.
This is potentially a very niche request, but I was wondering if there was a way to suppress RUF100 errors for blanket noqa when PGH004 is enabled (and
external
lints are on)?Right now, we live in a monorepo with flake8 configured along with our particular sub-codebase's
ruff
linting. The monorepo wide linting also comes with some company-specific error codes that we use theexternal
setting for. Unfortunately, we're hitting a problem with blanket noqas -- things like:which triggers RUF100 when the real problem is that it should be annotated with
# noqa: <internal>
. I was hoping to usePGH004
instead to flag these blanket noqa, but am running into two problems:# noqa
, even when it's necessary to silence the monorepo wide flake8.I think the two things that'd help us with the ruff roll out are to:
external
is specifiedWould that make sense? Not sure if this is a reasonable thing to support our if our setup is too idiosyncratic.