Restore pre-commit hooks
This commit is contained in:
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#MISE description="Run checks before a commit"
|
||||
|
||||
set -e
|
||||
|
||||
mix precommit
|
||||
@@ -46,7 +46,7 @@ hurl --test --progress-bar scripts/deploy.hurl
|
||||
description = '''
|
||||
Pre-commit task to ensure code conforms to static checks policies.
|
||||
|
||||
Install with `mise generate git-pre-commit --write --task=static-checks-hook`
|
||||
Install with `mise generate git-pre-commit --write --task=dev:precommit`
|
||||
'''
|
||||
run = 'mix do format --check-formatted, credo --strict, gettext.extract --check-up-to-date'
|
||||
hide = true
|
||||
|
||||
@@ -26,6 +26,12 @@ defmodule MusicLibrary.MixProject do
|
||||
]
|
||||
end
|
||||
|
||||
def cli do
|
||||
[
|
||||
preferred_envs: [precommit: :test]
|
||||
]
|
||||
end
|
||||
|
||||
# Specifies which paths to compile per environment.
|
||||
defp elixirc_paths(:test), do: ["lib", "test/support"]
|
||||
defp elixirc_paths(_), do: ["lib"]
|
||||
@@ -125,6 +131,12 @@ defmodule MusicLibrary.MixProject do
|
||||
# See the documentation for `Mix` for more info on aliases.
|
||||
defp aliases do
|
||||
[
|
||||
precommit: [
|
||||
"credo --strict",
|
||||
"gettext.extract --check-up-to-date",
|
||||
"deps.unlock --unused",
|
||||
"test"
|
||||
],
|
||||
setup: [
|
||||
"deps.get",
|
||||
"ecto.setup",
|
||||
|
||||
Reference in New Issue
Block a user