Skip to content

Commit

Permalink
Adding support for Elixir pre-commits
Browse files Browse the repository at this point in the history
  • Loading branch information
atavistock committed Apr 27, 2023
1 parent fb58866 commit eb04c33
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ use nix
- [elm-review](https://github.com/jfmengels/elm-review)
- [elm-test](https://github.com/rtfeldman/node-test-runner)

## Elixir

- [mix-format](https://hexdocs.pm/mix/main/Mix.Tasks.Format.html)
- [mix-test](https://hexdocs.pm/mix/1.13/Mix.Tasks.Test.html)
- [credo](https://github.com/rrrene/credo)
- [dialyzer](https://github.com/jeremyjh/dialyxir)

## OCaml

- [dune-fmt](https://dune.build/)
Expand Down
40 changes: 40 additions & 0 deletions modules/hooks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,16 @@ in
default = true;
};
};

credo = {
strict =
mkOption {
type = types.bool;
description = lib.mdDoc "Whether to auto-promote the changes.";
default = true;
};
};

};

config.hooks =
Expand Down Expand Up @@ -1223,5 +1233,35 @@ in
in "${pkgs.dune_3}/bin/dune build @fmt ${auto-promote}";
pass_filenames = false;
};

mix-format = {
name = "mix-format";
descriptiion = "Runs the built-in Elixir syntax formatter";
entry = "${pkgs.elixir}/bin/mix format";
types = [ "elixir" ];
};

mix-test = {
name = "mix-test";
descriptiion = "Runs the built-in Elixir test framework";
entry = "${pkgs.elixir}/bin/mix test";
types = [ "elixir" ];
};

credo = {
name = "credo";
descriptiion = "Runs a static code analysis using Credo";
entry =
let strict = if settings.credo.strict then "--strict" else "";
in "${pkgs.elixir}/bin/mix credo";
types = [ "elixir" ];
};

dialyzer = {
name = "dialyzer";
descriptiion = "Runs a static code analysis using Dialyzer";
entry = "${pkgs.elixir}/bin/mix dialyzer";
types = [ "elixir" ];
};
};
}

0 comments on commit eb04c33

Please sign in to comment.