diff --git a/.claude/commands/precommit.md b/.claude/commands/precommit.md index 446923f8..a1954145 100644 --- a/.claude/commands/precommit.md +++ b/.claude/commands/precommit.md @@ -1 +1 @@ -Run the full pre-commit check pipeline (`mix precommit`) and report the results. If any check fails, identify the specific failure and suggest a fix. +Run the full pre-commit check pipeline (`mise run dev:precommit`) and report the results. If any check fails, identify the specific failure and suggest a fix. diff --git a/.claude/settings.local.json b/.claude/settings.local.json index ca36b001..e8df53cb 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -34,7 +34,6 @@ "Bash(mix run:*)", "Bash(sqlite3:*)", "WebSearch", - "Bash(mix shellcheck:*)", "Bash(mix compile:*)", "mcp__tidewave__get_docs", "mcp__tidewave__search_package_docs", @@ -69,9 +68,12 @@ "mcp__plugin_chrome-devtools-mcp_chrome-devtools__get_console_message", "mcp__plugin_chrome-devtools-mcp_chrome-devtools__hover", "mcp__plugin_chrome-devtools-mcp_chrome-devtools__press_key", - "mcp__plugin_chrome-devtools-mcp_chrome-devtools__wait_for" + "mcp__plugin_chrome-devtools-mcp_chrome-devtools__wait_for", + "Bash(mise generate:*)", + "Bash(shellcheck:*)" ] }, + "enableAllProjectMcpServers": false, "hooks": { "PostToolUse": [ { @@ -91,6 +93,5 @@ ] } ] - }, - "enableAllProjectMcpServers": false + } } diff --git a/mix.exs b/mix.exs index ea11c416..32fffd07 100644 --- a/mix.exs +++ b/mix.exs @@ -27,12 +27,6 @@ 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"] @@ -142,15 +136,6 @@ defmodule MusicLibrary.MixProject do # See the documentation for `Mix` for more info on aliases. defp aliases do [ - precommit: [ - "shellcheck", - "credo --strict", - "sobelow --compact --exit", - "gettext.extract --check-up-to-date", - "format --check-formatted", - "deps.unlock --unused", - "test" - ], setup: [ "deps.get", "ecto.setup", @@ -161,16 +146,6 @@ defmodule MusicLibrary.MixProject do ], "ecto.setup": ["ecto.create", "ecto.migrate"], "ecto.reset": ["ecto.drop", "ecto.setup"], - shellcheck: [ - "cmd fd . 'scripts/' --exclude '*.hurl' -t file --exec shellcheck --color", - "cmd fd . '.claude/hooks' -t file --exec shellcheck --color" - ], - lint: [ - "format", - "credo", - "gettext.extract --merge", - "shellcheck" - ], # When running the migrate task WITHOUT setting the log_level option, # Ecto defaults to debug IRRESPECTIVELY of the log level set in # config/test.exs. The debug log level persists while the first 2-3 diff --git a/scripts/dev/lint b/scripts/dev/lint index 2c6c1764..8ba360b8 100755 --- a/scripts/dev/lint +++ b/scripts/dev/lint @@ -8,4 +8,15 @@ source "$(git rev-parse --show-toplevel)/scripts/_helpers.sh" ensure_working_directory! -mix lint +debug_msg "Formatting..." +mix format + +debug_msg "Running credo..." +mix credo + +debug_msg "Extracting translations..." +mix gettext.extract --merge + +debug_msg "Running shellcheck..." +fd . 'scripts/' --exclude '*.hurl' -t file --exec shellcheck --color +fd . '.claude/hooks' -t file --exec shellcheck --color diff --git a/scripts/dev/precommit b/scripts/dev/precommit index 7a5c9222..b4e677d3 100755 --- a/scripts/dev/precommit +++ b/scripts/dev/precommit @@ -8,4 +8,24 @@ source "$(git rev-parse --show-toplevel)/scripts/_helpers.sh" ensure_working_directory! -mix precommit +debug_msg "Running shellcheck..." +fd . 'scripts/' --exclude '*.hurl' -t file --exec shellcheck --color +fd . '.claude/hooks' -t file --exec shellcheck --color + +debug_msg "Running credo..." +mix credo --strict + +debug_msg "Running sobelow..." +mix sobelow --compact --exit + +debug_msg "Checking translations..." +mix gettext.extract --check-up-to-date + +debug_msg "Checking formatting..." +mix format --check-formatted + +debug_msg "Checking unused deps..." +mix deps.unlock --unused + +debug_msg "Running tests..." +mix test