Use per-file-ignores with Ruff extension for Zed #14642
-
I'm unsure whether this question belongs here or on the Zed discussion board, but I'll ask here for now. I want to configure Ruff to ignore specific linting rules for test files while keeping those rules enabled for the rest of the project. When running However, when configuring Ruff through Zed's settings, it seems the per-file-ignores section is not applied. That setup works with command-line ruff [tool.ruff.lint.per-file-ignores]
"**/tests/**" = [
"S101", # assertions
] That setup expected to work in Zed, but it doesn't. {
"lsp": {
"ruff": {
"initialization_options": {
"settings": {
"lint": {
"select": [
"ALL"
],
"ignore": [
"COM812", "COM819", "CPY"
],
"per-file-ignores": {
"**tests/**": [
"S101"
]
}
}
}
}
}
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
In the editor context, only a finite number of settings are available which can be found at: https://docs.astral.sh/ruff/editors/settings/. We have discussed this previous on whether to allow specify all possible settings but there are some challenges there. There are multiple solutions which you can utilize based on your setup:
Do you think either of the solutions mentioned above resolve your use-case? If not, can you say more about your setup? |
Beta Was this translation helpful? Give feedback.
I don't think this should happen. If you have a local config file and additional settings in the initialization options, the server should pick up both of them and merge unless you've overridden the
ruff.configurationPreference
setting which I think you haven't.Here's what I'm testing it against - I've a project whose root contains a
pyproject.toml
and a Python file with the following code:The Zed settings: