mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-19 01:51:30 +00:00
ruff server
respects per-file-ignores
configuration (#11224)
## Summary Fixes #11185 Fixes #11214 Document path and package information is now forwarded to the Ruff linter, which allows `per-file-ignores` to correctly match against the file name. This also fixes an issue where the import sorting rule didn't distinguish between third-party and first-party packages since we didn't pass in the package root. ## Test Plan `per-file-ignores` should ignore files as expected. One quick way to check is by adding this to your `pyproject.toml`: ```toml [tool.ruff.lint.per-file-ignores] "__init__.py" = ["ALL"] ``` Then, confirm that no diagnostics appear when you add code to an `__init__.py` file (besides syntax errors). The import sorting fix can be verified by failing to reproduce the original issue - an `I001` diagnostic should not appear in `other_module.py`.
This commit is contained in:
parent
653c8d83e9
commit
4aac1d1db9
5 changed files with 40 additions and 11 deletions
|
@ -64,6 +64,7 @@ impl super::SyncRequestHandler for ExecuteCommand {
|
|||
Command::FixAll => {
|
||||
let edits = super::code_action_resolve::fix_all_edit(
|
||||
snapshot.document(),
|
||||
snapshot.url(),
|
||||
snapshot.settings().linter(),
|
||||
snapshot.encoding(),
|
||||
)
|
||||
|
@ -83,6 +84,7 @@ impl super::SyncRequestHandler for ExecuteCommand {
|
|||
Command::OrganizeImports => {
|
||||
let edits = super::code_action_resolve::organize_imports_edit(
|
||||
snapshot.document(),
|
||||
snapshot.url(),
|
||||
snapshot.settings().linter(),
|
||||
snapshot.encoding(),
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue