ExQuality.Tools (ExQuality v0.13.0)

View Source

Detects which quality tools are available in the project.

Checks the project's declared dependencies for tool packages and determines which stages should be enabled by default.

In an umbrella, the root mix.exs usually declares no dependencies, so the root's deps are unioned with every child app's (ExQuality.Umbrella). Reading only the root would report every tool as missing and quietly run a fraction of the checks.

Example

ExQuality.Tools.detect()
#=> %{
  credo: true,
  dialyzer: true,
  doctor: false,
  coverage: true,
  native_coverage: false,
  gettext: false,
  audit: true,
  sobelow: false
}

ExQuality.Tools.available?(:credo)
#=> true

:native_coverage is the exception: it is not a package but the absence of one. Elixir has shipped mix test --cover since 1.11, so a project without :excoveralls still has a coverage tool, and the stage needs to know which of the two it is talking to.

Summary

Functions

Checks if a specific tool is available.

Returns a map of tool availability.

Returns the package a tool is detected from, or nil for an unknown tool.

Functions

available?(tool)

@spec available?(atom()) :: boolean()

Checks if a specific tool is available.

Returns false if the tool is not recognized or not installed.

detect()

@spec detect() :: %{required(atom()) => boolean()}

Returns a map of tool availability.

Scans the project's dependencies to determine which quality checking tools are installed.

package(tool)

@spec package(atom()) :: atom() | nil

Returns the package a tool is detected from, or nil for an unknown tool.

Examples

ExQuality.Tools.package(:dialyzer)
#=> :dialyxir