Assay.Config (assay v0.3.0)

View Source

Minimal configuration loader backed directly by Mix.Project.config/0.

The first milestone keeps all user-facing knobs inside the host project's mix.exs. This module extracts that data and normalizes derived paths so the runner can work with a single struct.

Example Configuration

# In mix.exs
def project do
  [
    app: :my_app,
    assay: [
      dialyzer: [
        apps: [:my_app, :my_dep],
        warning_apps: [:my_app],
        ignore_file: "dialyzer_ignore.exs",
        dialyzer_flags: ["--statistics"]
      ]
    ]
  ]
end

The apps list determines which applications are included in the PLT analysis. The warning_apps list determines which applications generate warnings (typically just your project apps, not dependencies).

Use mix assay.install to automatically configure these settings.

Summary

Functions

Reads the host project's :assay configuration and returns a struct that the rest of the system can consume.

Types

t()

@type t() :: %Assay.Config{
  app_sources: list(),
  apps: [atom()],
  build_lib_path: binary(),
  cache_dir: binary(),
  dialyzer_flag_options: keyword(),
  dialyzer_flags: term(),
  dialyzer_init_plt: binary() | nil,
  dialyzer_output_plt: binary() | nil,
  discovery_info: map(),
  elixir_lib_path: binary(),
  ignore_file: binary() | nil,
  plt_path: binary(),
  project_root: binary(),
  warning_app_sources: list(),
  warning_apps: [atom()],
  warnings: [atom()]
}

Functions

from_mix_project(opts \\ [])

@spec from_mix_project(keyword()) :: t()

Reads the host project's :assay configuration and returns a struct that the rest of the system can consume.

Options allow tests or future callers to override derived paths (e.g. when the runner eventually supports daemons or alternate cache directories).

Options

  • :project_root - Override project root (defaults to File.cwd!())
  • :cache_dir - Override cache directory
  • :plt_path - Override PLT path
  • :build_lib_path - Override build lib path
  • :dependency_apps - Override dependency apps list

Examples

# Load from mix.exs
config = Assay.Config.from_mix_project()
config.apps
# => [:my_app, :my_dep, ...]
config.warning_apps
# => [:my_app]

# Override project root for testing
config = Assay.Config.from_mix_project(project_root: "/tmp/test_project")
config.project_root
# => "/tmp/test_project"

# Override cache directory
config = Assay.Config.from_mix_project(cache_dir: "/tmp/assay_cache")
config.cache_dir
# => "/tmp/assay_cache"