Hi everyone,
I’m looking for a way to capture compile-time warnings and errors from mix compile in a structured format (e.g., JSON) for use in tooling/CI pipelines.
What I’m trying to achieve
I want to turn compiler output into structured logs like:
[
{
"file": "lib/foo.ex",
"line": 12,
"severity": "warning",
"message": "variable \"x\" is unused"
}
]
What I’ve tried so far
Using Code.with_diagnostics/1
{status, diagnostics} =
Code.with_diagnostics(fn ->
Mix.Task.run("compile.elixir", [])
end)
However, diagnostics is empty even when there are visible warnings during compilation.
My questions
-
Are there existing tools or libraries that provide structured compile-time diagnostics for Elixir/Mix?
-
Is there a more official or robust way to access compiler warnings/errors programmatically?
-
How do tools like Credo or other linters approach this problem?
Context
I’m building tooling around compilation for a no code platform project, so having reliable structured diagnostics would be very helpful.
Thanks in advance for any pointers!






















