Botica.Types (Botica v2.1.0)

Copy Markdown View Source

Shared types and data structures for Botica.

Summary

Types

check_def()

@type check_def() :: %{
  id: check_id(),
  name: String.t(),
  description: String.t(),
  priority: non_neg_integer(),
  tags: [atom()] | [],
  timeout: non_neg_integer() | nil,
  check: (-> check_result()),
  fix: (-> fix_result()) | nil,
  fix_command: String.t() | nil
}

check_id()

@type check_id() :: atom()

check_result()

@type check_result() ::
  {:ok, String.t()} | {:warning, String.t()} | {:error, String.t()}

config()

@type config() :: %{app_name: String.t(), checks: [check_def()]}

executor_option()

@type executor_option() ::
  {:timeout, non_neg_integer()} | :stop_on_first_error | :continue_on_error

executor_options()

@type executor_options() :: [executor_option()]

fix_report()

@type fix_report() :: %{
  applied: [check_id()],
  failed: [{check_id(), String.t()}],
  skipped: [check_id()]
}

fix_result()

@type fix_result() :: {:ok, String.t()} | {:error, String.t()} | :skipped

result()

@type result() :: %{
  id: check_id(),
  name: String.t(),
  status: status(),
  message: String.t(),
  fix_command: String.t() | nil
}

status()

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

summary()

@type summary() :: %{
  ok: non_neg_integer(),
  warning: non_neg_integer(),
  error: non_neg_integer(),
  total: non_neg_integer(),
  passed?: boolean()
}