AlCheck

A parallel code quality checker for Elixir projects. AlCheck runs multiple code quality checks (format, compile, credo, dialyzer, and tests) concurrently with smart test partitioning.

Features

Installation

Add al_check to your list of dependencies in mix.exs:

def deps do
  [
    {:al_check, "~> 0.1.0"}
  ]
end

Then install globally:

mix deps.get
mix check.install
# if u use asdf
asdf reshim

Usage

CLI Usage

Run all checks:

check

Common Options

# Run only fast checks (format, compile, credo)
check --fast

# Run specific checks only
check --only format,test
check --only credo

# Run tests with custom partition count
check --partitions 4

# Run tests from specific directory
check --dir test/my_app/feature/

# Re-run only failed tests from previous run
check --failed

# Apply auto-fixes from stored credo output
check --fix

# Monitor test partition files in real-time
check --watch

Available Checks

Workflows

Failed Test Workflow

When tests fail, failed test locations are automatically saved:

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

Credo output is stored for later use with --fix:

check --only credo    # Run checks and store output
check --fix           # Apply fixes from stored output

Test Partitioning

Tests run in parallel partitions (default: 3). Each partition uses its own database. Customize based on your CPU cores:

check --partitions 3  # Run with 3 partitions

Output Files

AlCheck creates a check/ directory with the following files:

Configuration

Create a .check.json in your project root to customize behavior:

{
  "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"}
  }
}

All fields are optional. CLI flags override config values.

Override the config path via the CHECK_CONFIG environment variable.

Custom checks

Each check is defined with a run string (the shell command to execute) and an optional name for display. If name is omitted, it defaults to a capitalized version of the key (e.g. "compile_test""Compile Test").

When checks is provided, it replaces all built-in checks (test partitions are always added).

Coverage

Set "coverage" to merge partition coverage into a single report:

Requirements

Documentation

Full documentation is available at https://hexdocs.pm/al_check.

License

This project is licensed under the MIT License - see the LICENSE file for details.