mix spec_lint (spec_lint v0.1.0)

Copy Markdown View Source

Compiles the project and checks exported functions with readable specs and stored compiler-inferred signatures in the project's own applications.

mix spec_lint [--warnings-as-errors] [--format json] [--output FILE]
              [--module Mod ...] [--config FILE]

Errors are contradictions in the compiler's types (a return disjoint from the spec, a spec domain no clause accepts). Warnings are clauses and return values the spec does not declare; see SpecLint for the checks.

JSON output requires --output FILE; that file contains only the findings array. Compilation output and the summary remain on the console.

Configuration

.spec_lint.exs in the project root (or --config FILE) evaluates to a keyword list:

[
  ignore: [
    MyApp.Generated,            # a whole module
    {MyApp.Legacy, :parse},     # a function, any arity
    {MyApp.Legacy, :parse, 2},  # one function
    ~r/^MyApp\.Proto\./        # a regex on "Module.function/arity"
  ],
  warnings_as_errors: false
]

Exit status

0 when there is no error (and no warning with --warnings-as-errors), 1 otherwise.