dialyzer_json
dialyzer_json is an Elixir library that runs Dialyzer and emits its warnings as
structured JSON, enriched with metadata and fix hints. The goal is to make
Dialyzer output easier to consume programmatically by tools such as AI code
editors, CI systems, and custom analysis pipelines.
Motivation
Dialyzer’s standard output is optimized for humans reading a terminal, for
example:
lib/foo.ex:42:no_return
Function bar/2 has no local return.
While readable, this format is difficult for tools to reliably parse and reason
about. In particular, it makes it hard to:
- Reliably extract file, line, and function information
- Identify warning types programmatically
- Prioritize which warnings to fix first
- Group, filter, or stream warnings
What dialyzer_json provides
dialyzer_json introduces a new Mix task:
mix dialyzer.json
This task runs Dialyzer and outputs warnings as structured JSON, including:
- File, line, column, module, and function
- Dialyzer warning type
- Human-readable message
- A fix hint to help prioritize the warning
- A summary section for aggregation and reporting
Example output:
{
"metadata": {
"schema_version": "1.0",
"dialyzer_version": "5.4",
"elixir_version": "1.19.4",
"otp_version": "28",
"run_at": "2026-02-02T07:00:03Z"
},
"warnings": [
{
"file": "lib/foo.ex",
"line": 42,
"column": 5,
"function": "bar/2",
"module": "Foo",
"warning_type": "no_return",
"message": "Function has no local return",
"fix_hint": "code"
}
],
"summary": {
"total": 1,
"by_type": { "no_return": 1 },
"by_fix_hint": { "code": 1 }
}
}
Fix hints
Each warning includes a fix_hint field intended to help with prioritization:
code— Likely a real bug (e.g. unreachable code, impossible patterns)spec— Typespec mismatch; code is probably correct, the@specis notpattern— Usually safe to ignore (e.g. third-party behaviours)
Useful flags
# Quick health check
mix dialyzer.json --quiet --summary-only
# Group warnings by type
mix dialyzer.json --quiet --group-by-warning
# Group warnings by file
mix dialyzer.json --quiet --group-by-file
# Filter to specific warning types
mix dialyzer.json --quiet --filter-type no_return --filter-type call
# JSONL output (one warning per line)
mix dialyzer.json --quiet --compact
Integration notes
dialyzer_json is designed to work alongside dialyxir. It reuses dialyxir’s PLT
building and invokes :dialyzer.run/1 directly to collect raw warnings before
formatting them.
Installation
def deps do
[
{:dialyzer_json, "~> 0.1.0", only: [:dev, :test], runtime: false}
]
end
def cli do
[preferred_envs: ["dialyzer.json": :dev]]
end
Links
Hex package: dialyzer_json | Hex
Documentation: dialyzer_json v0.1.1 — Documentation






















