numtide / treefmt

one CLI to format your repo [maintainers=@zimbatm,@brianmcgee]
https://treefmt.com
MIT License
575 stars 35 forks source link

Hard fail on missing tools #180

Closed zimbatm closed 1 year ago

zimbatm commented 1 year ago

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

brianmcgee commented 1 year ago

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.

basile-henry commented 1 year ago

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?

zimbatm commented 1 year ago

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

brianmcgee commented 1 year ago

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