https://pantsbuild.org/ logo
#general
Title
# general
h

happy-family-315

03/30/2023, 9:05 AM
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

enough-analyst-54434

03/30/2023, 9:33 AM
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

happy-family-315

03/30/2023, 10:21 AM
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

enough-analyst-54434

03/30/2023, 10:42 AM
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

ripe-gigabyte-88964

03/30/2023, 3:12 PM
When did the ruff linter become public?
b

broad-processor-92400

03/30/2023, 6:55 PM
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

happy-family-315

04/03/2023, 8:58 AM
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?