mix live_style.audit (LiveStyle v0.13.0)
View SourceAudits LiveStyle class definitions to find potentially unused classes.
This task scans your codebase for class/2 definitions and checks if
they are referenced anywhere in templates or code.
Usage
mix live_style.audit
mix live_style.audit --path lib/my_app_webOptions
--path- Directory to scan (default: "lib")--format- Output format: "text" or "json" (default: "text")
How It Works
- Finds all modules that
use LiveStyle - Extracts class names defined via
class/2 - Searches for references to those classes in
.ex,.exs, and.heexfiles - Reports classes that have no apparent references
Limitations
- Dynamic class references (e.g.,
css(assigns.variant)) cannot be detected - Classes referenced via variables may show as unused
- This is a heuristic tool - manual review is recommended before removing classes
Examples
$ mix live_style.audit
Scanning lib/ for LiveStyle classes...
Found 3 potentially unused classes:
MyAppWeb.CoreComponents
:deprecated_button (lib/my_app_web/components/core_components.ex:45)
:old_card (lib/my_app_web/components/core_components.ex:89)
MyAppWeb.Layouts
:legacy_header (lib/my_app_web/components/layouts.ex:12)
$ mix live_style.audit --format json
[{"module":"MyAppWeb.CoreComponents","class":"deprecated_button","file":"...","line":45}]