Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

ruff server does not respect per-file-ignores #11185

Closed
charliermarsh opened this issue Apr 28, 2024 · 1 comment · Fixed by #11224
Closed

ruff server does not respect per-file-ignores #11185

charliermarsh opened this issue Apr 28, 2024 · 1 comment · Fixed by #11224
Assignees
Labels
bug Something isn't working server Related to the LSP server

Comments

@charliermarsh
Copy link
Member

See: #11138 (comment)

@charliermarsh charliermarsh added bug Something isn't working server Related to the LSP server labels Apr 28, 2024
@snowsignal snowsignal self-assigned this Apr 28, 2024
@charliermarsh
Copy link
Member Author

Note: we need to fill in the two arguments here:

snowsignal added a commit that referenced this issue May 2, 2024
## 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`.
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 a pull request may close this issue.

2 participants