worried-piano-22913
10/06/2025, 2:55 PMpants check --lint-only=ruff-check doesn't flag rules but invoking ruff itself does? i tried to manually set the config file and even to explicitly set this rule, but it didn't help. Also debugging it with -ldebug didn't give me any information. Maybe an idea on how to debug this?
The one thing which is different in the output is that pants says: Found 9 errors (9 fixed, 0 remaining). (they arent fixed) and Ruff states: Found 9 errors. [*] 9 fixable with the --fix option.
Edit: The rule in this case is D415.worried-piano-22913
10/14/2025, 12:00 PMpants check --lint-only=ruff-check with the arg --ruff-args="--no-fix" resolves this problem.
Executing pants check --lint-only=ruff-check fixes the errors, but probably only in a temporary file, because it shows:
11:53:15.31 [INFO] Completed: Lint with `ruff check` - ruff check succeeded.
Found 9 errors (9 fixed, 0 remaining).
But my own file still has the errors in it.
Since its a check command i woud expect pants to execute ruff check with the flag --no-fix and return the exit code and the error message.wide-midnight-78598
10/14/2025, 12:57 PMpants lint though, no?wide-midnight-78598
10/14/2025, 12:59 PMif request.mode is RuffMode.FORMAT:
extra_initial_args = ("format",)
elif request.mode is RuffMode.FIX:
extra_initial_args = ("check", "--fix")
elif request.mode is RuffMode.LINT:
extra_initial_args = ("check",)
else:
assert_never(request.mode)worried-piano-22913
10/14/2025, 1:10 PMlint !worried-piano-22913
10/14/2025, 1:12 PM--no-fix for ruff check because if not set, it wont report any errorwide-midnight-78598
10/14/2025, 1:17 PMpants lint for ruff runs without --fix - I haven't checked ruff lately to see if defaults changed, but there might also be a weird reporting issue (e.g. are we running fix internally and then just not materializing the sandbox changes into the workspace) kinda thingwide-midnight-78598
10/14/2025, 1:18 PMworried-piano-22913
10/14/2025, 1:46 PMfix = true was set in our pyproject.toml . Thats why pants fixed the problems even when only running pants lint --lint-only=ruff-check. But it seems that pants linted and fixed the files in a temporary file, because the file in my repo was unchanged. Does pants lint in a temp dir?
Also, since the fix is only temporary, should pants lint always enforce --no-fix to always
properly report errors?wide-midnight-78598
10/14/2025, 1:52 PMfix=true in a configuration as that seemed most likely, but it was worth testing otherwise.
It definitely seems inconsistent, but pants usually operates with defaults that are easily overwritten (from pants.toml or pyproject, or wherever else). I think the only promise it makes is to not change the working directory.
I could see a world where linting with fix=true (as odd as I personally find it) would be useful to know for seeing how many non-auto-fixable bugs a project has (for tracking). If we add no-fix, that might prevent someone from appending a fix later (no clue, never tested (--no-fix --fix) - whereas right now, the default is correct, overrides are correctly applied. In general, Pants tries to allow defaults with escape hatches wherever possiblewide-midnight-78598
10/14/2025, 1:53 PMworried-piano-22913
10/16/2025, 7:55 AMworried-piano-22913
10/16/2025, 7:58 AM