From ce700be0f6154754f945b86c6ed986b884746fa2 Mon Sep 17 00:00:00 2001 From: Kieran Eglin Date: Tue, 20 Feb 2024 15:23:17 -0800 Subject: [PATCH] Set up ex_check to run in test env --- .check.exs | 35 +++++++++++++++++++++++++++++++++++ ideas.md | 1 + mix.exs | 8 ++++++-- 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 .check.exs diff --git a/.check.exs b/.check.exs new file mode 100644 index 0000000..b214c41 --- /dev/null +++ b/.check.exs @@ -0,0 +1,35 @@ +[ + ## don't run tools concurrently + # parallel: false, + + ## don't print info about skipped tools + # skipped: false, + + ## always run tools in fix mode (put it in ~/.check.exs locally, not in project config) + # fix: true, + + ## don't retry automatically even if last run resulted in failures + # retry: false, + + ## list of tools (see `mix check` docs for a list of default curated tools) + tools: [ + {:compiler, env: %{"MIX_ENV" => "test"}}, + {:formatter, env: %{"MIX_ENV" => "test"}} + + ## curated tools may be disabled (e.g. the check for compilation warnings) + # {:compiler, false}, + + ## ...or have command & args adjusted (e.g. enable skip comments for sobelow) + # {:sobelow, "mix sobelow --exit --skip"}, + + ## ...or reordered (e.g. to see output from dialyzer before others) + # {:dialyzer, order: -1}, + + ## ...or reconfigured (e.g. disable parallel execution of ex_unit in umbrella) + # {:ex_unit, umbrella: [parallel: false]}, + + ## custom new tools may be added (Mix tasks or arbitrary commands) + # {:my_task, "mix my_task", env: %{"MIX_ENV" => "prod"}}, + # {:my_tool, ["my_tool", "arg with spaces"]} + ] +] diff --git a/ideas.md b/ideas.md index ac5addc..f46a327 100644 --- a/ideas.md +++ b/ideas.md @@ -2,3 +2,4 @@ - Use a UUID for the media database ID (or at least alongside it) - Look into this and its recommended plugins https://hexdocs.pm/ex_check/readme.html - Add output template option for the source's friendly name +- TODO: Install Elixir 1.16.2 when available to fix bug with `ex_check` https://github.com/karolsluszniak/ex_check/issues/41#issuecomment-1921390413 diff --git a/mix.exs b/mix.exs index 1420460..95fda31 100644 --- a/mix.exs +++ b/mix.exs @@ -9,7 +9,11 @@ defmodule Pinchflat.MixProject do elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, aliases: aliases(), - deps: deps() + deps: deps(), + preferred_cli_env: [ + check: :test, + credo: :test + ] ] end @@ -55,7 +59,7 @@ defmodule Pinchflat.MixProject do {:nimble_parsec, "~> 1.4"}, {:mox, "~> 1.0", only: :test}, {:credo, "~> 1.7", only: [:dev, :test], runtime: false}, - {:ex_check, "~> 0.14.0", only: [:dev], runtime: false}, + {:ex_check, "~> 0.14.0", only: [:dev, :test], runtime: false}, {:faker, "~> 0.17", only: :test} ] end