Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ruff server respects per-file-ignores configuration #11224

Merged
merged 1 commit into from
May 2, 2024

Conversation

snowsignal
Copy link
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 Something isn't working server Related to the LSP server labels May 1, 2024
Copy link
Contributor

github-actions bot commented May 1, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

crates/ruff_server/src/fix.rs Show resolved Hide resolved
@snowsignal snowsignal merged commit 4aac1d1 into main May 2, 2024
19 checks passed
@snowsignal snowsignal deleted the jane/server/lint-with-path branch May 2, 2024 02:24
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working server Related to the LSP server
Projects
None yet
3 participants