Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix exclusive rules selection for
only
arg (#310)
## Summary Earlier, if a user had define a rule selection or exclusion using the `lint.args` setting, it would collide with the `only` parameter. The purpose of the `only` parameter is to only run Ruff for the given rule excluding everything else. The "excluding everything else" part was done with `--extend-ignore=ALL`. The problem, as highlighted in the linked issue, was that if there's a user defined `--ignore` / `--select` (or their `--extend-*` version), then the `ALL` directive won't work because: > When breaking ties between enabled and disabled rules (via select and ignore, respectively), more specific prefixes override less specific prefixes. > > _Reference: https://docs.astral.sh/ruff/settings/#ignore_ This means that between `--select=E,F` and `--ignore=ALL`, the former wins. This PR fixes this issue by checking for the following argument pattern in user defined settings, skipping them if the `only` parameter is given: * `["--select", "A,B,C"]` / `["--select=A,B,C"]` * `["--ignore", "A,B,C"]` / `["--ignore=A,B,C"]` And their `--extend-*` version. ## Test Plan Manual testing locally :) fixes: astral-sh/ruff-vscode#328
- Loading branch information