Elixir Collector
Analyze Elixir/Mix projects to collect project metadata, Hex dependencies, CI/CD command tracking, and test coverage. Detects Phoenix, LiveView, and Ecto frameworks, and handles umbrella projects by walking `apps/*/mix.exs`.
elixir to your lunar-config.yml:uses: github://earthly/lunar-lib/collectors/elixir@v1.0.5
What This Integration Collects
This integration includes 4 collectors that gather metadata from your systems.
project
Analyzes Elixir project structure by detecting mix.exs, mix.lock, .credo.exs, .formatter.exs, dialyzer config, and test directory. Parses project name/version, Elixir version requirement, OTP apps, umbrella members, and framework usage (Phoenix, LiveView, Ecto). Writes project metadata to .lang.elixir.
dependencies
Extracts direct dependencies from mix.exs and resolved transitive versions from mix.lock when present. Captures Hex package name and version for each dependency. Writes dependency data to .lang.elixir.dependencies.
cicd
Records every mix command executed in CI pipelines along with the Elixir runtime version. Writes command strings and version info to .lang.elixir.cicd for audit trails and build reproducibility analysis.
test-coverage
Extracts coverage percentage from excoveralls or mix test --cover output after tests complete. Parses coverage reports and writes results to .lang.elixir.tests.coverage.
How Collectors Fit into Lunar
Lunar watches your code and CI/CD systems to collect SDLC data from config files, test results, IaC, deployment configurations, security scans, and more.
Collectors are the automatic data-gathering layer. They extract structured metadata from your repositories and pipelines, feeding it into Lunar's centralized database where guardrails evaluate it to enforce your engineering standards.
Learn How Lunar Works →Example Collected Data
This collector writes structured metadata to the Component JSON. Here's an example of the data it produces:
{
"lang": {
"elixir": {
"version": "1.16.2",
"otp_version": "26",
"build_systems": ["mix"],
"mix_exs_exists": true,
"mix_lock_exists": true,
"project_name": "my_app",
"project_version": "0.1.0",
"elixir_requirement": "~> 1.15",
"otp_apps": ["my_app"],
"test_directory_exists": true,
"credo_configured": true,
"dialyzer_configured": true,
"formatter_configured": true,
"frameworks": ["phoenix", "phoenix_live_view", "ecto"],
"umbrella": {
"is_umbrella": true,
"apps": ["my_app_web", "my_app_core"]
},
"source": { "tool": "mix", "integration": "code" },
"cicd": {
"cmds": [
{ "cmd": "mix test --cover", "version": "1.16.2" },
{ "cmd": "mix deps.get", "version": "1.16.2" }
]
},
"tests": {
"coverage": {
"percentage": 85.0,
"source": { "tool": "excoveralls", "integration": "ci" }
}
},
"dependencies": {
"direct": [
{ "path": "phoenix", "version": "~> 1.7" },
{ "path": "phoenix_live_view", "version": "~> 0.20" },
{ "path": "ecto_sql", "version": "~> 3.10" }
],
"transitive": [
{ "path": "telemetry", "version": "1.2.1" }
],
"source": { "tool": "hex", "integration": "code" }
}
}
},
"testing": {
"coverage": {
"percentage": 85.0,
"source": { "tool": "excoveralls", "integration": "ci" }
}
}
}
Documentation
View on GitHubElixir Collector
Collects Elixir/Mix project information, dependencies, CI/CD commands, and test coverage.
Overview
This collector gathers metadata about Elixir projects including mix project name/version, Elixir version requirement, OTP applications, Hex dependencies, umbrella app layout, and framework detection (Phoenix, LiveView, Ecto). It runs on both code changes (for static analysis) and CI hooks (to capture runtime metrics like test coverage and mix command usage).
Note: The CI-hook collectors (test-coverage, cicd) don't run tests — they observe and collect data from mix test / mix coveralls commands that your CI pipeline already runs.
Collected Data
This collector writes to the following Component JSON paths:
| Path | Type | Description |
|---|---|---|
.lang.elixir |
object | Elixir project metadata |
.lang.elixir.version |
string | Elixir runtime version |
.lang.elixir.otp_version |
string | Erlang/OTP version |
.lang.elixir.build_systems |
array | Build systems detected (e.g., ["mix"]) |
.lang.elixir.mix_exs_exists |
boolean | mix.exs detected |
.lang.elixir.mix_lock_exists |
boolean | mix.lock detected |
.lang.elixir.project_name |
string | Mix project name (from project/0) |
.lang.elixir.project_version |
string | Mix project version |
.lang.elixir.elixir_requirement |
string | Elixir version requirement (e.g. "~> 1.15") |
.lang.elixir.otp_apps |
array | OTP application names (from application/0) |
.lang.elixir.test_directory_exists |
boolean | test/ directory detected |
.lang.elixir.credo_configured |
boolean | .credo.exs detected |
.lang.elixir.dialyzer_configured |
boolean | Dialyzer configured via :dialyxir dep or dialyzer/0 block in mix.exs (file-based signals only). The bundled credo-or-dialyzer-configured policy additionally OR's in mix dialyzer invocations from .lang.elixir.cicd.cmds — custom policies reading this field directly should consult cicd.cmds separately. |
.lang.elixir.formatter_configured |
boolean | .formatter.exs detected |
.lang.elixir.frameworks |
array | Frameworks detected from deps (e.g. ["phoenix", "phoenix_live_view", "ecto"]) |
.lang.elixir.umbrella.is_umbrella |
boolean | Umbrella project flag |
.lang.elixir.umbrella.apps |
array | Umbrella member app names (from apps/*/mix.exs) |
.lang.elixir.cicd |
object | CI/CD command tracking with Elixir version |
.lang.elixir.tests |
object | Test coverage information |
.lang.elixir.dependencies |
object | Direct and transitive Hex dependencies |
.testing.coverage |
object | Normalized cross-language test coverage |
Note: When a project is detected, .lang.elixir is always created (with at minimum source metadata), so policies can use its existence as a signal the component is an Elixir project.
Collectors
This plugin provides the following collectors (use include to select a subset):
| Collector | Hook Type | Description |
|---|---|---|
project |
code | Collects project structure, versions, umbrella info, framework flags |
dependencies |
code | Collects Hex dependencies from mix.exs and mix.lock |
cicd |
ci-before-command | Tracks mix commands run in CI with Elixir version |
test-coverage |
ci-after-command | Extracts coverage from excoveralls or mix test --cover |
Installation
Add to your lunar-config.yml:
collectors:
- uses: github://earthly/lunar-lib/collectors/elixir@main
on: ["domain:your-domain"] # replace with your own domain or tags
# include: [project, dependencies] # Only include specific subcollectors
Open Source
This collector is open source and available on GitHub. Contribute improvements, report issues, or fork it for your own use.
Common Use Cases
Explore guardrails that use data from Elixir Collector.
Ready to Automate Your Standards?
See how Lunar can turn your AGENTS.md, engineering wiki, compliance docs, or postmortem action items into automated guardrails with our 200+ built-in guardrails.