Skip to content

ruff server does not consider config include #12242

@christianbrugger

Description

@christianbrugger

I want to use ruff server on a project where I want to introduce formatting and linting gradually.

My idea was to use the include feature in the ruff.toml config:

# only lint & format opt-in files
include = [
    'src/plots.py',
    'src/reports.py',
]

This perfectly works when using ruff format . and ruff check . from the CLI, meaning that only the two files listed are formatted and linted, nothing else.

However when using the ruff server all files are formatted and linted. This is especially problematic when using the format on save or auto-fix on save feature via an IDE. Also way to many diagnostics from the linting are shown.

I looked at the formatting handler source code and can see that the exclude list is already parsed from the config. However the include property is not considered at all. The same is true for fixes and linting.

I would really appreciate, if the include mechanism could be added to the ruff server as well. Meaning that the server ignores format and fix requests, and returns no diagnostics for files not in the include list. In the same way it works for the CLI tool.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingserverRelated to the LSP server

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions