mix quality (ExQuality v0.8.0)

View Source

Runs code quality checks in parallel with actionable feedback.

Automatically fixes formatting issues, then runs all analysis stages in parallel with streaming output.

Execution Phases

  1. Auto-fix - Runs mix format to fix formatting
  2. Compile - Compiles dev + test environments in parallel
  3. Analysis - Runs enabled checks in parallel (credo, dialyzer, doctor, tests)

Usage

mix quality

Options

  • --quick - Quick mode for development: skips dialyzer and coverage enforcement
  • --skip-dialyzer - Skip Dialyzer type checking
  • --skip-credo - Skip Credo static analysis
  • --skip-doctor - Skip Doctor documentation checks
  • --skip-gettext - Skip Gettext translation checks
  • --skip-sobelow - Skip Sobelow security analysis
  • --skip-dependencies - Skip dependency checks (unused deps and security audit)
  • --verbose - Show full output even on success
  • --format json - Write a JSON report to stdout, human output to stderr
  • --report PATH - Write a JSON report to PATH, human output to stdout

Passing Test Options

You can pass extra arguments to mix test or mix coveralls using --:

mix quality -- --only integration
mix quality --quick -- --include slow --seed 0

Arguments after -- are passed directly to the test command.

Alternatively, configure test args in .quality.exs:

test: [
  args: ["--only", "integration"]
]

CLI args (after --) override config file args (no merge).

Auto-Detection

Stages are automatically enabled based on installed dependencies:

  • :credo → enables Credo stage
  • :dialyxir → enables Dialyzer stage
  • :doctor → enables Doctor stage
  • :gettext → enables Gettext translation checks
  • :sobelow → enables Sobelow security analysis
  • :mix_audit → enables security audit in Dependencies stage
  • :excoveralls → uses mix coveralls instead of mix test

Quick Mode

Use --quick during active development when you haven't finished all implementation tasks (like writing tests). Quick mode:

  • Skips Dialyzer (slow)
  • Runs mix test instead of mix coveralls (tests must pass, but coverage threshold is not enforced)

This lets you iterate quickly while still catching obvious issues.

Configuration

Create .quality.exs in your project root to customize behavior or override auto-detection. See Config for options.

Example Output

Running quality checks...

 Format: No changes needed (0.1s)
 Compile: dev + test compiled (warnings as errors) (1.8s)

Running analysis stages in parallel...

 Doctor: skipped (:doctor not installed)
 Credo: No issues (1.2s)
 Tests: 248 passed, 0 failed, 87.3% coverage (5.2s)
 Dialyzer: No warnings (32.1s)

 All quality checks passed!

Skipped Stages

A stage that is disabled, or whose tool is not installed, prints a line saying so with the reason. A run never leaves out a stage silently: a missing stage would otherwise read as a stage that passed.

Machine-Readable Output

The exit code says the run failed, not what failed. A caller that wants to route on the result asks for a report instead of scraping the console:

mix quality --format json           # report on stdout, human on stderr
mix quality --report .quality.json  # human on stdout, report to a file

--report is usually the more useful of the two, because it leaves the human stream intact. Both can be given at once. See ExQuality.Report for the shape.

Dialyzer PLT

A run that has to build the Dialyzer PLT says so while it happens (⋯ Dialyzer: building PLT (this is a one-time cost)) and reports it in the stage summary, because a multi-minute wait behind a single line of output otherwise reads as a hang. mix quality.plt builds it outside a run, which is what a container image or a CI job should cache.

Summary

Functions

Runs the quality check task.

Functions

run(args)

Runs the quality check task.