Configuration

View Source

Create a .check.json in your project root (check --init generates one with defaults).

Full example

{
  "run": ["format", "compile", "compile_test", "dialyzer", "credo", "credo_strict", "test"],
  "fast": ["format", "compile", "compile_test", "credo", "credo_strict"],
  "partitions": 3,
  "max_concurrency": 10,
  "test_args": "--warnings-as-errors",
  "default_repeat": 100,
  "base_branch": "main",
  "coverage": {
    "mod": "native",
    "limit": 80,
    "html": false,
    "baseline_cmd": "git show origin/main:coverage.txt"
  },
  "fix": [
    {"run": "mix format"},
    {"run": "mix recode", "files": ".check/credo*.txt"}
  ],
  "checks": {
    "format": {"name": "Formatting", "run": "mix format --check-formatted"},
    "compile": {"name": "Compile", "run": "mix compile --warnings-as-errors"},
    "credo": {"name": "Credo", "run": "mix credo --all"},
    "modified_tests": {"name": "Modified Tests", "run": "builtin:modified_tests"},
    "modified_test_modules": {"name": "Modified Test Modules", "run": "builtin:modified_test_modules"}
  }
}

All fields are optional. CLI flags override config values.

Config options

KeyDescription
runChecks to run by default (without --only or --fast)
fastChecks to run with --fast
partitionsNumber of test partitions (default: 3)
max_concurrencyMax parallel checks (default: 10)
test_argsDefault args for mix test (default: --warnings-as-errors)
default_repeatDefault --repeat value when flag is used without a number
base_branchGit branch for modified test detection (auto-detects main/master if not set)
checksCustom check definitions (replaces built-in checks, test partitions always added)
fixCommands to run with --fix
coverageCoverage merging settings
db_setupCommand for --setup-db / --db-setup (default: mix ecto.setup)
db_dropCommand for --drop-db / --db-drop (default: mix ecto.drop)
updateCommands for mix check.update (default: ["mix deps.update al_check", "mix check.install"])

Custom checks

Each check has a run string (shell command) and optional name:

"sobelow": {"name": "Security", "run": "mix sobelow --config"}

If name is omitted, it defaults to a capitalized version of the key (e.g. "compile_test""Compile Test").

Builtin checks

Use the builtin: prefix for checks that need Elixir logic:

"modified_tests": {"run": "builtin:modified_tests"}

Available builtins:

  • builtin:modified_tests - runs only changed test lines vs base branch
  • builtin:modified_test_modules - runs whole modified test files vs base branch

Placeholders

Use {base_branch} in shell commands - replaced at runtime with the configured or auto-detected base branch:

"my_check": {"run": "git diff {base_branch}... --stat"}

Coverage

"coverage": {
  "mod": "native",
  "limit": 80,
  "html": false,
  "baseline_cmd": "git show origin/main:coverage.txt"
}
KeyDescription
mod"native" (built-in --cover) or "coveralls" (excoveralls)
limitMinimum coverage %. Fails the check if below this value
htmlGenerate full HTML report (default: false, kills early after getting %)
baseline_cmdShell command returning baseline coverage % for delta comparison

Use --no-coverage to disable coverage for a single run (overrides this config).

Coverage results are cached based on cover/*.coverdata hashes. Re-running check --coverage is instant if test data hasn't changed.

Fix commands

"fix": [
  {"run": "mix format"},
  {"run": "mix recode", "files": ".check/credo*.txt"}
]

Each entry can have:

  • run - the command to execute
  • files (optional) - glob pointing to output files from previous checks. File paths are extracted from their contents and passed as arguments to the command.

Output files

AlCheck creates a .check/ directory:

FileDescription
.check/credo.txtCredo output for auto-fix
.check/credo_strict.txtStrict credo output for auto-fix
.check/check_tests.txtMerged test output from all partitions
.check/test_partition_N.txtIndividual partition outputs
.check/failed_tests.txtFailed test locations
.check/coverage_cache.*Cached coverage results
.check/test_args.txtSaved test args for --failed