Hi, I have problems setting up the experimental ru...
# general
h
Hi, I have problems setting up the experimental ruff linter. It seems to work but my config gets ignored. I have a the following setup: pyproject.toml
Copy code
[tool.ruff]
cache_dir = ".cache_and_logs/.ruff"
line-length=40
select = ["E", "F", "B", "Q"]
pants.toml:
Copy code
[ruff]
lockfile = "lockfiles/ruff.lock"
The line-length limit is set to 40, but when running pants fmt or fix ruff does not throw an error or changes anything. My python file contains a long list in one line (>120 chars)
e
You're not setting a fixable list, perhaps try that since fmt and fix both imply / need mutation.
Hrm, almost certainly not it. It looks like the default list includes everything: https://beta.ruff.rs/docs/settings/#fixable
Your
cache_dir
is mis-spelled though: https://beta.ruff.rs/docs/settings/#cache-dir Perhaps ruff is lenient on config entry keys?
So, you're using a custom ruff lock file, that implies you modified the ruff version Pants uses. Can you reveal more relevant details and config there?
h
So changing
cache_dir
to
cache-dir
changed something. Now ruff seems to make changes e.g. sorting imports. When running pants lint how can I get an output of what needs to be changed?
e
The
fmt
and
fix
goals fix things; so no output needed, although there may be some, I'm not familiar with either ruff or our integration with it. The
lint
goal does not fix things; so it can only resort to printing issues. Have you run that?
r
When did the ruff linter become public?
b
For ruff specifically, there’s a bug with the lint goal (not with fix, though): https://github.com/pantsbuild/pants/issues/18430 Might that be affecting you?
h
Thanks for you answers. @broad-processor-92400 yes this is affecting me. But even when I have a fixable error when I run
fmt
it fails correctly but I get no output of whats wrong. How can I get an output of what needs to be changed?