Experiences parsing compiler and dialyzer errors and warnings in build system

What are people’s experiences in parsing compiler and dialyzer errors and warnings within their build systems?
I’m using Jenkins myself, and used to use the (now deprecated) Warnings Plugin. I had a small Groovy script setup to collect errors and warnings, but I never got it working perfectly.

Now I’m replacing the deprecated Jenkins plugin with a new one. So now I’m trying to figure out what the best way is to get both errors and warnings from both the Elixir compiler and Dialyzer into Jenkins.
There are many ways to attack this problem, and I guess it’s not unique to Jenkins either. Unfortunately, my Google Search skills have failed me, so I haven’t been able to find anything usable.

What do you guys do?

1 Like

You can always call Dialyzer directly and then format it to whatever format you like instead of parsing text output.

That’s an interesting idea. Seems like a much more stable approach, than parsing the text output.

I wonder if something similar could be done for the Elixir compiler.

In theory - yes. In practice it would be much harder, especially as it will not be able to catch all messages anyway due to fact that Elixir compile time is in fact runtime, so you can always use IO.puts/1 to output additional messages.

1 Like

Yeah, that makes sense. I probably won’t get around parsing the output from the compiler.

It seems that the Jenkins warning plugin has “native” JSON and XML formats. I wonder if there is a more universal format. If that was the case, I could write a script that parses Elixir Compiler output and generates a file that is usable by more systems than just Jenkins.

Microsoft and GitHub are pushing for SARIF, GitLab uses CodeClimate format. I am in the process of publishing my GitLab CI pipeline that does all the magic needed with all different reporting components, so far I have:

  • Code Quality (via Credo)
  • SAST (via Sobelow)
  • coverage (via Covertool)

Parsing compiler output which is produced only in “human friendly” way is PITA even for stuff like Vim quick fix and I was trying to suggest flag for machine readable output for some time now, but never succeeded in any meaningful way.

I kinda of expected to run into multiple standards for this (but hoped that it would not be the case). Thank you for pointing me in some directions.
I’ll have to look into the details and figure out what makes most sense. We also use TypeScript, so I will see which reporting formats works well with that.

I have previously written parser for “human friendly” compiler outputs. Yeah, it’s a pain :slight_smile: , but it looks like there is no easy way around it.

There is to get some messages out of the compiler. This is how ElixirLS is providing diagnostics. Obviously it will not work 100% of the cases (especially with dependencies), but it will provide something. With Dialyzer it will be a little bit harder, but still should be possible to do by “manually” calling Dialyzer instead of relying on the Dialyxir/Dialyzex tasks.

Thank you for all your comments.
You’ve given me quite a bit to think about :slight_smile: .