ruff/crates/ruff_linter
Brent Westbrook 8cff77c82e
Avoid generating diagnostics with per-file ignores (#18801)
## Summary

This PR avoids one of the three calls to `NoqaCode::rule` from
https://github.com/astral-sh/ruff/pull/18391 by applying per-file
ignores in the `LintContext`. To help with this, it also replaces all
direct uses of `LinterSettings.rules.enabled` with a
`LintContext::enabled` (or `Checker::enabled`, which defers to its
context) method. There are still some direct accesses to
`settings.rules`, but as far as I can tell these are not in a part of
the code where we can really access a `LintContext`. I believe all of
the code reachable from `check_path`, where the replaced per-file ignore
code was, should be converted to the new methods.

## Test Plan

Existing tests, with a single snapshot updated for RUF100, which I think
actually shows a more accurate diagnostic message now.
2025-06-20 13:33:09 -04:00
..
resources [flake8-simplify] Fix false negatives for shadowed bindings (SIM910, SIM911) (#18794) 2025-06-20 13:25:36 -04:00
src Avoid generating diagnostics with per-file ignores (#18801) 2025-06-20 13:33:09 -04:00
Cargo.toml Bump 0.12.0 (#18724) 2025-06-17 11:05:59 -04:00