treefmt icon indicating copy to clipboard operation
treefmt copied to clipboard

Hard fail on missing tools

Open zimbatm opened this issue 3 years ago • 4 comments
trafficstars

Is your feature request related to a problem? Please describe.

Right now treefmt ignores commands if it cannot find the related executable. This allows developers to partially format the code tree even if they don't have all the dependencies installed.

The issue is that in CI, we want to be notified if a tool is missing.

Describe the solution you'd like

Either add a new --fail-on-missing-command flag, or change the behaviour of treefmt when --fail-on-change is enabled.

Describe alternatives you've considered

N/A

Additional context

Some internal repo: https://github.com/numtide/blended/issues/288

zimbatm avatar Sep 21 '22 15:09 zimbatm

Should it not bail by default if a configured formatter is not available? IMHO it would be more intuitive and is what I falsely believed was the case until recently.

brianmcgee avatar Sep 21 '22 15:09 brianmcgee

I agree, defaulting to an error is better in this case. We could have a flag that gives the current behaviour: --allow-missing-formatter for example?

basile-henry avatar Oct 12 '22 21:10 basile-henry

Ok, you convinced me. Anybody wants to send a PR?

zimbatm avatar Oct 15 '22 16:10 zimbatm

I have some time this week, I'll take a stab at it

brianmcgee avatar Oct 17 '22 08:10 brianmcgee