From 917adf41b984a12f1cd6d03cc3bfc1576b50738f Mon Sep 17 00:00:00 2001 From: Alexandre Hamez Date: Thu, 28 Nov 2024 13:51:25 +0100 Subject: [PATCH] chore: switch to lefthook for git hooks --- .lefthook.yml | 24 ++++++++++++++++++++++++ .pre-commit-config.yaml | 24 ------------------------ 2 files changed, 24 insertions(+), 24 deletions(-) create mode 100644 .lefthook.yml delete mode 100644 .pre-commit-config.yaml diff --git a/.lefthook.yml b/.lefthook.yml new file mode 100644 index 0000000..b68b4af --- /dev/null +++ b/.lefthook.yml @@ -0,0 +1,24 @@ +pre-commit: + parallel: true + commands: + mix_format: + glob: "**/*.{ex,exs}" + run: mix format {staged_files} + mix_credo: + glob: "**/*.{ex,exs}" + run: mix credo + trailing_whitespaces_and_merge_conflicts: + run: git diff --check --cached + +pre-push: + parallel: true + commands: + mix_check_deps: + glob: "**/*.{ex,exs}" + run: mix deps.unlock --check-unused + mix_dialyzer: + glob: "**/*.{ex,exs}" + run: mix dialyzer + mix_test: + glob: "**/*.{ex,exs}" + run: mix test diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index a5e3f74..0000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,24 +0,0 @@ -repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 - hooks: - - id: trailing-whitespace - - id: end-of-file-fixer - - id: check-added-large-files - args: ["--maxkb=500"] - - id: check-merge-conflict - - id: mixed-line-ending - - repo: https://github.com/ahamez/pre-commit-elixir-hooks.git - rev: v1.0.0 - hooks: - - id: elixir-mix-format - stages: [pre-commit] - - id: elixir-mix-credo - stages: [pre-commit] - - id: elixir-mix-deps-check-unused - stages: [pre-push] - - id: elixir-mix-dialyzer - stages: [pre-push] - - id: elixir-mix-test - args: ["--exclude", "properties"] - stages: [pre-push]