Open pp-gborodin opened 10 months ago
I want to explain my motivation here: I tried using new ruff formatter (pants release 2.20.0dev3) along with ruff checker. It uses the same tool_subsystem = Ruff
and therefore the same tool_id = "ruff"
. This makes it impossible to turn off the ruff formatter, but not the ruff checker.
My first idea was to make pants fix
respect [fmt].only
parameter, this way I could set [fmt].only=['black']
and run pants fix
and it will only run ruff check --fix
and not ruff format
. But now I'm not sure it's a good idea, because [fmt]
is dedicated to the fmt
goal, it's not clear why fix
goal should respect fmt
subsystem. The same logic also applies to lint
goal, if fix
goal respects [fmt]
then lint
goal should also respect [fmt]
, right? It all looks weird, so I think the right solution is to change tool_id
for ruff:
class RuffFixRequest(FixTargetsRequest):
tool_id = 'ruff-check'
...
class RuffFormatRequest(FmtTargetsRequest):
tool_id = 'ruff-format'
...
This will solve the issue and keep the current lint/format/fix structure.
Describe the bug Imagine I have
black
andisort
configured, and I set[fmt].only = "black"
. With this setup I expectpants fix ::
to only runblack
, but this is not the case, it runs bothblack
andisort
.Pants version 2.20.0dev3
OS Ubuntu 22.04
Additional info Looks like the issue is here, the fix rule doesn't respect FmtSubsystem