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 = '''
|
description = '''
|
||||||
Pre-commit task to ensure code conforms to static checks policies.
|
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'
|
run = 'mix do format --check-formatted, credo --strict, gettext.extract --check-up-to-date'
|
||||||
hide = true
|
hide = true
|
||||||
|
|||||||
@@ -26,6 +26,12 @@ defmodule MusicLibrary.MixProject do
|
|||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def cli do
|
||||||
|
[
|
||||||
|
preferred_envs: [precommit: :test]
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
# Specifies which paths to compile per environment.
|
# Specifies which paths to compile per environment.
|
||||||
defp elixirc_paths(:test), do: ["lib", "test/support"]
|
defp elixirc_paths(:test), do: ["lib", "test/support"]
|
||||||
defp elixirc_paths(_), do: ["lib"]
|
defp elixirc_paths(_), do: ["lib"]
|
||||||
@@ -125,6 +131,12 @@ defmodule MusicLibrary.MixProject do
|
|||||||
# See the documentation for `Mix` for more info on aliases.
|
# See the documentation for `Mix` for more info on aliases.
|
||||||
defp aliases do
|
defp aliases do
|
||||||
[
|
[
|
||||||
|
precommit: [
|
||||||
|
"credo --strict",
|
||||||
|
"gettext.extract --check-up-to-date",
|
||||||
|
"deps.unlock --unused",
|
||||||
|
"test"
|
||||||
|
],
|
||||||
setup: [
|
setup: [
|
||||||
"deps.get",
|
"deps.get",
|
||||||
"ecto.setup",
|
"ecto.setup",
|
||||||
|
|||||||
Reference in New Issue
Block a user