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

Adding support for Elixir pre-commits #292

Merged
merged 7 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -498,6 +498,16 @@ in
default = { };
};
};

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

};

config.hooks =
Expand Down Expand Up @@ -1399,6 +1409,36 @@ in
stages = [ "commit-msg" ];
};

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

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

credo = {
name = "credo";
description = "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";
description = "Runs a static code analysis using Dialyzer";
entry = "${pkgs.elixir}/bin/mix dialyzer";
types = [ "elixir" ];
};

crystal = {
name = "crystal";
description = "A tool that automatically formats Crystal source code";
Expand Down