CheckEscript (AlCheck v0.1.5)

View Source

Runs all code quality checks in parallel.

Usage

check                                # Run all checks
check --help/-h                      # Show this help message
check --fast                         # Run only fast checks (format, compile, credo)
check --only format,test             # Run only format and test
check --only credo                   # Run credo and credo_strict
check --partitions 2                 # Run tests with 2 partitions (default: 3)
check --dir test/dir                 # Run tests only from specific directory
check --fix                          # Apply fixes from stored credo output
check --failed                       # Re-run only failed tests from previous run
check --watch                        # Monitor test partition files in real-time
check --test-args "--exclude slow"   # Replace default --warnings-as-errors with custom args
check --repeat 10                   # Run tests with --repeat-until-failure 10 (default: 100)

Available checks

  • format - mix format --check-formatted
  • compile - mix compile --warnings-as-errors
  • compile_test - MIX_ENV=test mix compile --warnings-as-errors
  • dialyzer - mix dialyzer
  • credo - mix credo --all
  • credo_strict - mix credo --strict --only readability --all
  • test - mix test (runs in partitions for parallel execution)

Fast checks

The --fast flag runs only: format, compile, compile_test, credo, credo_strict (skips: dialyzer, test)

Test partitioning

Tests run in parallel partitions (default: 5). Each partition uses its own database. Use --partitions N to customize the number of partitions based on your CPU cores.

Failed test workflow

When tests fail, failed test locations are automatically saved to check/failed_tests.txt:

check --only test     # Run tests and save failures
cat .check/failed_tests.txt # View failed tests
check --failed        # Re-run only the failed tests

Auto-fix workflow

Format and credo failures are tracked in .check/ directory for later use with --fix:

check --only format,credo  # Run checks and store failures
check --fix                # Apply fixes from stored failures

The --fix command will:

  • Check if format failed previously (.check/.format_failed marker) and run mix format
  • Apply credo fixes from stored output files (.check/credo.txt, .check/credo_strict.txt)

Configuration file

Create a .check.json in your project root to customize behavior. Override the path via the CHECK_CONFIG environment variable.

{
  "fast": ["format", "compile", "compile_test", "credo"],
  "partitions": 3,
  "max_concurrency": 10,
  "test_args": "--warnings-as-errors",
  "default_repeat": 100,
  "coverage": "native",
  "checks": {
    "format": {"name": "Formatting", "run": "mix format --check-formatted"},
    "sobelow": {"name": "Security", "run": "mix sobelow --config"}
  }
}

Name defaults to a capitalized version of the key (e.g. "compile_test" → "Compile Test").

Coverage modes: false (default), "native" (built-in --cover), or "coveralls" (excoveralls). Both modes automatically merge partition coverage into a single report after all partitions complete.

All fields are optional. CLI flags override config values. When checks is provided, it replaces all built-in checks (test partitions are always added).

Summary

Functions

main(args)

@spec main([String.t()]) :: :ok