Skip to content

ruff server respects per-file-ignores configuration#11224

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

ruff server respects per-file-ignores configuration#11224
snowsignal merged 1 commit intomainfrom
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 Something isn't working server Related to the LSP server labels May 1, 2024
@github-actions
Copy link
Copy Markdown
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.

@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 Something isn't working server Related to the 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