feat: add an example of 'before'

Signed-off-by: Brian McGee <brian@bmcgee.ie>
This commit is contained in:
Brian McGee 2024-02-15 14:17:16 +00:00
parent f4700c4e63
commit 2b49923bf7
Signed by: brianmcgee
GPG Key ID: D49016E76AD1E8C0
3 changed files with 16 additions and 8 deletions

View File

@ -52,13 +52,13 @@ func TestReadConfigFile(t *testing.T) {
as.Equal([]string{"*.hs"}, haskell.Includes)
as.Equal([]string{"examples/haskell/"}, haskell.Excludes)
// nix
nix, ok := cfg.Formatters["nix"]
as.True(ok, "nix formatter not found")
as.Equal("alejandra", nix.Command)
as.Nil(nix.Options)
as.Equal([]string{"*.nix"}, nix.Includes)
as.Equal([]string{"examples/nix/sources.nix"}, nix.Excludes)
// alejandra
alejandra, ok := cfg.Formatters["alejandra"]
as.True(ok, "alejandra formatter not found")
as.Equal("alejandra", alejandra.Command)
as.Nil(alejandra.Options)
as.Equal([]string{"*.nix"}, alejandra.Includes)
as.Equal([]string{"examples/nix/sources.nix"}, alejandra.Excludes)
// ruby
ruby, ok := cfg.Formatters["ruby"]

View File

@ -12,5 +12,7 @@ with pkgs; [
rustfmt
shellcheck
shfmt
statix
deadnix
terraform
]

View File

@ -26,11 +26,17 @@ options = [
includes = ["*.hs"]
excludes = ["examples/haskell/"]
[formatter.nix]
[formatter.alejandra]
command = "alejandra"
includes = ["*.nix"]
# Act as an example on how to exclude specific files
excludes = ["examples/nix/sources.nix"]
# Make this run before deadnix
# Note this formatter determines the file set for any 'downstream' formatters
before = "deadnix"
[formatter.deadnix]
command = "deadnix"
[formatter.ruby]
command = "rufo"