numtide / treefmt

one CLI to format your repo
https://treefmt.com
MIT License
534 stars 32 forks source link

--on-unwatched #303

Closed brianmcgee closed 1 month ago

brianmcgee commented 1 month ago

By default, if a path does not match any formatter a log message at WARN level will be emitted. A user can change this by providing the --on-unmatched or -u flag and specifying a log level debug,info,warn,error,fatal.

If fatal, the process will exit with an error on the first unmatched path encountered.

Examples

❯ nix fmt -- -c -u fatal
traversed 24 files
emitted 24 files for processing
matched 0 files to formatters
formatted 0 files in 514.925µs
treefmt: error: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/.env
❯ nix fmt -- -c -u error
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/.env
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/.envrc
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/.gitignore
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/LICENSE
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/docs/.vitepress/config.mts
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/docs/public/init.gif
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/docs/public/just-use-go.png
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/docs/public/logo.png
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/docs/public/logo.svg
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/docs/public/treefmt.gif
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/docs/vhs/init.tape
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/docs/vhs/treefmt.tape
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/flake.lock
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/go.mod
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/go.sum
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/gomod2nix.toml
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/init.toml
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/elm/src/Main.elm
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/go/go.mod
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/haskell-frontend/Main.hs
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/haskell-frontend/Setup.hs
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/haskell-frontend/haskell-frontend.cabal
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/haskell/Foo.hs
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/haskell/Main.hs
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/haskell/Nested/Foo.hs
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/haskell/Setup.hs
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/haskell/haskell.cabal
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/haskell/treefmt.toml
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/html/scripts/.gitkeep
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/nixpkgs.toml
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/python/main.py
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/python/requirements.txt
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/python/virtualenv_proxy.py
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/ruby/bundler.rb
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/rust/Cargo.toml
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/rust/src/main.rs
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/shell/foo.sh
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/terraform/main.tf
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/terraform/two.tf
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/touch.toml
ERRO format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/treefmt.toml
traversed 99 files
emitted 99 files for processing
matched 58 files to formatters
formatted 0 files in 529.38272ms
❯ nix fmt -- -c 
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/.env
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/.envrc
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/.gitignore
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/LICENSE
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/docs/.vitepress/config.mts
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/docs/public/init.gif
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/docs/public/just-use-go.png
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/docs/public/logo.png
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/docs/public/logo.svg
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/docs/public/treefmt.gif
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/docs/vhs/init.tape
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/docs/vhs/treefmt.tape
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/flake.lock
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/go.mod
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/go.sum
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/gomod2nix.toml
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/init.toml
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/elm/src/Main.elm
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/go/go.mod
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/haskell-frontend/Main.hs
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/haskell-frontend/Setup.hs
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/haskell-frontend/haskell-frontend.cabal
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/haskell/Foo.hs
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/haskell/Main.hs
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/haskell/Nested/Foo.hs
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/haskell/Setup.hs
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/haskell/haskell.cabal
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/haskell/treefmt.toml
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/html/scripts/.gitkeep
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/nixpkgs.toml
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/python/main.py
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/python/requirements.txt
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/python/virtualenv_proxy.py
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/ruby/bundler.rb
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/rust/Cargo.toml
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/rust/src/main.rs
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/shell/foo.sh
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/terraform/main.tf
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/terraform/two.tf
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/touch.toml
WARN format: no formatter for path: /home/brian/Development/com/github/numtide/treefmt/test/examples/treefmt.toml
traversed 99 files
emitted 99 files for processing
matched 58 files to formatters
formatted 0 files in 554.236855ms

Closes #302

brianmcgee commented 1 month ago

@mergify rebase

mergify[bot] commented 1 month ago

rebase

✅ Branch has been successfully rebased