Skip to content
CAI
Software that uses CAICheck a score

hauleth/mix_unused

57.4

Adequate · 18 September 2026

755

lines of production code

Elixir

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

This system is an Elixir static analysis tool that detects unused public functions, private functions, and recursive-only calls during compilation. It operates as a Mix task by tracing function calls via a GenServer-based tracer and comparing them against exported code metadata to report diagnostics as warnings or errors. The tool supports configuration for ignoring specific patterns and handles complex scenarios such as umbrella projects and cyclic dependencies.

How it got here

2019 — Configuration cleanup and documentation

4 changes.

This period focused on modernizing the project's configuration by removing legacy Mix.Config files and the deprecated Mix.Tasks.Unused compiler task. The work also involved standardizing code style with Credo and .formatter.exs, updating the README with usage instructions, and cleaning up obsolete test files.

2021–2023 — unused code detection feature

11 changes.

This period focused on developing and releasing the MixUnused library, a Mix task designed to detect unused public functions, macros, and structs during compilation. The work involved implementing core analysis capabilities, including checks for private functions, recursive-only calls, and transitive unused code, alongside comprehensive test coverage for multi-module and umbrella project scenarios.

Features

Initial release of MixUnused analyzer

This change introduces the MixUnused library, a Mix task compiler that detects unused functions, macros, and structs in your codebase. It works by tracing function calls during compilation via a GenServer-based tracer and comparing them against exported code metadata. Users can configure which checks run (unused, private, recursive-only), set severity levels, and ignore specific patterns or modules. The tool reports diagnostics as compiler warnings or errors based on configuration.

_lib/mix\unused · high confidence

New \`mix compile.unused\` task to detect unused public functions

A new Mix task, \compile.unused\, has been added to identify unused public functions in your project. It operates as a compiler by tracing function calls during compilation and reporting any public functions that are never invoked. Users can configure ignored functions via the \unused: \[ignore: \[...\]\]\ project setting, supporting exact matches, wildcards, regular expressions, and predicate functions. The task also respects \export: true\ metadata to exclude functions intended for external use and allows controlling output severity via the \--severity\ flag.

lib/mix · high confidence

New analyzers for private functions, recursive-only calls, and transitive unused functions

The unused analyzer now includes three new checks: it flags functions that are not called outside their defining module (suggesting they should be private), identifies functions that are only called recursively, and detects functions that are only used by other unused functions (transitive unused). These additions help users clean up code by revealing functions that are effectively dead or should be scoped more narrowly.

_lib/mix\unused/analyzers · high confidence

Removals

Removal of the legacy Mix.Tasks.Unused compiler task

The \lib/mix\_unused.ex\ file, which implemented the \Mix.Tasks.Unused\ command for identifying unused functions via the \compile.elixir\ manifest, has been deleted. This removes the previous mechanism that relied on \Mix.Compilers.Elixir\ internals and manual manifest parsing, aligning with the project's migration to compiler tracers.

lib · high confidence

Behavioural changes

Add Credo configuration and update project documentation

The project now includes a default Credo configuration file (.credo.exs) to standardize code style and static analysis checks. The README has been updated with comprehensive usage instructions, including how to integrate the unused compiler into Mix projects and configure ignored functions. Additionally, the .formatter.exs has been updated to enforce an 80-character line length and import the stream\_data dependency, while the LICENSE file has been added to reflect the MIT license.

(repo-wide) · high confidence

Removal of legacy config/config.exs file

The project has removed the legacy config/config.exs file, which previously used the deprecated Mix.Config module. This change eliminates the default configuration template and any associated environment-specific imports (such as dev.exs or test.exs) that were previously defined in this location, simplifying the configuration structure.

config · high confidence

Test coverage

Added test coverage for MixUnused exports, filtering, and tracing; Added test fixture for cyclic module dependencies; Added test fixture modules for multi-module compilation tracing; Added test fixture modules for umbrella apps a and b; Added test fixtures for code analysis; Added test support module for isolated project execution; Added tests for the unused code analyzer; Added tests for unused, private, and recursive-only function analyzers; Removed unused test file.

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Baseline

  • First survey — no prior run to compare against. CAI 57.

Lenses

  • Code Health 100
  • Architecture 69
  • Maturity 42
  • Readiness 63
  • Security 85

Changes since last survey

  • 104 commits — 89 feature/other, 15 fixes

By area

  • (root) — 44 commits
  • lib/mix_unused — 17 commits
  • .github/workflows — 11 commits
  • lib/mix — 10 commits
  • (repo) — 6 commits
  • test/fixtures — 4 commits
  • test/mix_unused — 4 commits
  • lib/mix_unused.ex — 3 commits
  • .github/FUNDING.yml — 1 commit
  • config/config.exs — 1 commit
  • test/mix — 1 commit
  • test/mix_unused_test.exs — 1 commit
  • test/support — 1 commit

Notable commits

  • fix: chore: fix CHANGELOG name
  • fix: chore: fix labeler
  • fix: chore: fix result labels
  • fix: fix: do not fail if cannot write manifest
  • fix: fix: do not reload application configuration
  • fix: fix: do not stop tracer process after compilation
  • fix: fix: ignore additional flags
  • fix: fix: older Erlang versions do not provide doc chunk
  • fix: fix: print path to file as a relative path
  • fix: fix: properly fail when the severity is high enough
  • fix: fix: relicense to MIT
  • fix: fix: remove inspect
  • fix: fix: resolve issue with unused analyzer reporting false positives
  • fix: fix: test against "textual" representation of atoms as well
  • fix: fix: use documentation chunk for extracting callbacks
  • change: Initial commit
  • change: Merge branch 'misc-doc-changes'
  • change: Merge pull request #11 from hauleth/chore/lint-commit-messages
  • change: Merge pull request #2 from hauleth/ft/migrate-to-compiler-tracers
  • change: Merge pull request #3 from hauleth/chore/add-ci-actions
  • …and 84 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

hauleth/mix_unused was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 18 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 498a4096613df9bb6f81fcf66889477819c056e0 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-5d04157a340d.