a.shaw
November 27, 2024, 2:19pm
1
When running Dialyzer in CI, we use the --format github
option. This formats errors like:
::warning file=lib/file.ex,line=19,title=no_return::Function fail/0 has no local return.
This allows GitHub Actions to parse the errors, and ‘comment’ them inline in Github:
I’m wondering if the Elixir compiler supports this option (I couldn’t find such an option in the mix
docs however), and if not, where the relevant code in the Elixir compiler which emits warnings/errors is located if I wanted to consider contributing this myself.
Thanks!
1 Like
gmile
November 27, 2024, 3:00pm
2
a.shaw:
–format github
Looks like it’s located here:
* `--ignore-exit-status` - display warnings but do not halt the VM or
return an exit status code
* `--list-unused-filters` - list unused ignore filters useful for CI. do
not use with `mix do`.
* `--plt` - only build the required PLT(s) and exit
* `--format <name>` - Specify the format for the warnings, can be specified multiple times to print warnings multiple times in different output formats. Defaults to `dialyxir`.
* `--format short` - format the warnings in a compact format, suitable for ignore file using Elixir term format.
* `--format raw` - format the warnings in format returned before Dialyzer formatting
* `--format dialyxir` - format the warnings in a pretty printed format (default)
* `--format dialyzer` - format the warnings in the original Dialyzer format
* `--format github` - format the warnings in the Github Actions message format
* `--format ignore_file` - format the warnings in {file, warning} format for Elixir Format ignore file
* `--format ignore_file_strict` - format the warnings in {file, short_description} format for Elixir Format ignore file.
* `--quiet` - suppress all informational messages
* `--quiet-with-result` - suppress all informational messages except for the final result message
Warning flags passed to this task are passed on to `:dialyzer` - e.g.
mix dialyzer --unmatched_returns
## Configuration
1 Like
a.shaw
November 27, 2024, 3:26pm
3
Thanks! This is helpful to see how Dialyzer implements it. I wasn’t clear in my message unfortunately - I am interested to see where this could be added to the compiler itself.