Skip to content

ruff server respects per-file-ignores configuration - #11224

Merged
snowsignal merged 1 commit into
mainfrom
jane/server/lint-with-path
May 2, 2024
Merged

snowsignal merged 1 commit into
mainfrom
jane/server/lint-with-path

Conversation

@snowsignal

Copy link
Copy Markdown
Contributor

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:

[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.

@snowsignal snowsignal added bug An issue describing something that isn't working, or a PR that fixes a bug server Related to the Ruff or ty LSP server labels May 1, 2024
@github-actions

github-actions Bot commented May 1, 2024

Copy link
Copy Markdown
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Comment thread crates/ruff_server/src/fix.rs
@snowsignal
snowsignal merged commit 4aac1d1 into main May 2, 2024
@snowsignal
snowsignal deleted the jane/server/lint-with-path branch May 2, 2024 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug An issue describing something that isn't working, or a PR that fixes a bug server Related to the Ruff or ty LSP server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ruff server first-party libraries get categorized as third-party ruff server does not respect per-file-ignores

3 participants