mix composer.cookbook.lint (composer v0.2.0)

Copy Markdown View Source

Checks the current project's cookbook (in composer itself, core):

  • every step has a summary, an action and a stability
  • every step has a test at test/composer/<cookbook>/steps/<id>_test.exs
  • every step reference in requires resolves
  • lib/composer/<cookbook>/manifest.exs is up to date
  • every recipe group is well formed (see Composer.Lint)
  • every reference in every recipe resolves, and every recipe resolves as a whole

With --local, checks your local recipes instead: the config directory holds only recipes/, every group is well formed and every recipe resolves against the project's cookbooks.

With --file, checks one recipe group file, local or a cookbook's (found from its path), and reports only the problems in that file, plus one at each {:use, ...} of a recipe that has problems of its own. This is what an editor runs on save; see the lint guide.

Exits non-zero when there is an error, in every format, so it can run in CI.

mix composer.cookbook.lint
mix composer.cookbook.lint --local
mix composer.cookbook.lint --format compact --file ~/.config/composer/recipes/ash.exs
mix composer.cookbook.lint --format github

Formats

  • text (default) - each problem after its path:line:col: location, warnings first; errors make the task fail with the list
  • compact - one line per problem, file:line:col: severity: message [code], for editors
  • json - an array of diagnostics
  • github - GitHub Actions annotations

In every format but text, stdout holds nothing but the diagnostics (compiling runs quietly), and errors end the task with exit status 1. Dependencies that need compiling are compiled by Mix before this task starts; set MIX_QUIET=1 to silence that too.

Options

  • --local - lint your local recipes instead of the project's cookbook
  • --file PATH - lint one recipe group file
  • --format FORMAT - text, compact, json or github
  • -c, --config - the local config directory (see Composer.Local)