Skip to content

Commit

Permalink
feat: add juliaformatter
Browse files Browse the repository at this point in the history
  • Loading branch information
storopoli committed Dec 30, 2023
1 parent 7f35ec3 commit dfb9eee
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ use nix
- [revive](https://github.com/mgechev/revive)
- [staticcheck](https://github.com/dominikh/go-tools)

## Julia

- [JuiaFormatter.jl](https://github.com/domluna/JuliaFormatter.jl)

## Shell

- [shellcheck](https://github.com/koalaman/shellcheck)
Expand Down
20 changes: 20 additions & 0 deletions modules/hooks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2241,5 +2241,25 @@ in
entry = "${tools.typst-fmt}/bin/typst-fmt";
files = "\\.typ$";
};

juliaformatter = {
description = "Run JuliaFormatter.jl against Julia source files";
files = "\\.jl$";
entry = ''
${tools.julia-bin}/bin/julia -e '
using Pkg
Pkg.activate(".")
using JuliaFormatter
format(ARGS)
out = Cmd(`git diff --name-only`) |> read |> String
if out == ""
exit(0)
else
@error "Some files have been formatted !!!"
write(stdout, out)
exit(1)
end'
'';
};
};
}
2 changes: 2 additions & 0 deletions nix/tools.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
, hunspell
, luaPackages
, lua-language-server
, julia-bin
, mdl
, mdsh
, nil
Expand Down Expand Up @@ -109,6 +110,7 @@ in
hlint
hpack
html-tidy
julia-bin
mdl
mdsh
nil
Expand Down

0 comments on commit dfb9eee

Please sign in to comment.