Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

what does "One or more formatters are missing" mean? #286

Open
MangoIV opened this issue Apr 29, 2024 · 3 comments
Open

what does "One or more formatters are missing" mean? #286

MangoIV opened this issue Apr 29, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@MangoIV
Copy link

MangoIV commented Apr 29, 2024

Describe the bug

I'm trying to run selected formatters of the ones declared in my treefmt.toml, I get "One or more formatters missing"

To Reproduce

following treefmt.toml

[formatter.nix]
command = "nixpkgs-fmt"
includes = ["*.nix"]
excludes = [ "nix/sources.nix"] # managed by niv. 

[formatter.cabal-fmt]
command = "cabal-fmt"
options = [ "--inplace" ]
includes = [ "*.cabal" ]
excludes = [ "dist-newstyle/" ]

[formatter.ormolu]
command = "ormolu"
includes = ["*.hs"]
excludes = [ "dist*" ]
options = [
  "--mode", "inplace", 
  "--check-idempotence",
]

[formatter.hlint]
command = "hlint"
includes = ["*.hs"]
excludes = [ "dist*" ]

[formatter.shellcheck]
command = "shellcheck"
includes = ["*.sh"]
excludes = []

Steps to reproduce the behavior:

run treefmt -v -f cabal-fmt, get [ERROR] One or more formatters are missing what does this mean? I want to only run cabal-fmt; there's a formatter in the toml that is called that and cabal-fmt is available.

Expected behavior

it runs only the cabal-fmt formatter

System information

treefmt version 0.6.1, nixos nixpkgs unstable

Additional context
n/a

@MangoIV MangoIV added the bug Something isn't working label Apr 29, 2024
@MangoIV
Copy link
Author

MangoIV commented Apr 29, 2024

The issue here is that I don't even understand what the error message is supposed to tell me, does it think the formatter is missing in the path? Does it mean that the formatter is missing in the toml? according to the Debug log, it does parse the config file and it is able to format the repo without passing arguments.

@MangoIV
Copy link
Author

MangoIV commented Apr 29, 2024

alright; I have found the option --allow-missing-formatter which makes it run even with multiple argument but it seems like it invalidates the cache of the run without specific formatters which makes it practically unusable? I also don't know what exactly is the problem here; why does it need to have this flag passed?

@MangoIV
Copy link
Author

MangoIV commented Apr 29, 2024

yeah; so by using treefmt --allow-missing-formatter -f cabal-fmt -f ormolu -f hlint I get cache misses on the formatters that I have not specified via the f flag on the next run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant