PhoenixAssets.Doctor.Check (PhoenixAssets v0.1.0)

View Source

A single diagnostic the doctor can run against a context.

Plugins contribute checks from PhoenixAssets.Plugin.doctor_checks/2. A check's run function receives the PhoenixAssets.Context and returns a result map describing its status, a human message, and an optional remediation hint. Checks flagged production?: true also run under mix phoenix_assets.doctor --production.

Summary

Functions

Builds an :error result with an optional remediation hint.

Builds a check from a keyword list or map of attributes.

Builds an :ok result.

Builds a :warn result with an optional remediation hint.

Types

result()

@type result() :: %{status: status(), message: String.t(), hint: String.t() | nil}

status()

@type status() :: :ok | :warn | :error

t()

@type t() :: %PhoenixAssets.Doctor.Check{
  group: atom(),
  id: atom(),
  production?: boolean(),
  run: (PhoenixAssets.Context.t() -> result())
}

Functions

error(message, hint \\ nil)

@spec error(String.t(), String.t() | nil) :: result()

Builds an :error result with an optional remediation hint.

new(attrs)

@spec new(Enumerable.t()) :: t()

Builds a check from a keyword list or map of attributes.

ok(message)

@spec ok(String.t()) :: result()

Builds an :ok result.

warn(message, hint \\ nil)

@spec warn(String.t(), String.t() | nil) :: result()

Builds a :warn result with an optional remediation hint.