Continually experimenting with new ideas and techniques — Reconstructing, Developing, Modernising.
With my current level of understanding there are a couple of types of message you can “ignore” when you start your exploration.
A message like Function name/arity has no local return reported for the line containing the head of a function is often caused by a problem somewhere in the function body. In my experience, if you clean up the warnings from the function body successfully then this message should stop being emitted. So I tend to ignore these and look at the warnings indicating “real” problems in the function body.
If you are using other modules from hex.pm then they might not be correctly annotated, and in this case it can be useful to search the web for the message. If the warning is a “known problem” with some external module then it’s possible to tell dialyxir to filter out some of the dialyzer warning messages. The README.md says:
Any line of dialyzer output (partially) matching a line in “dialyzer.ignore-warnings” is filtered.
The way to do this is to add a key/value pair like ignore_warnings: "dialyzer.ignore-warnings" to your project’s mix.exs, and then add the relevant bad lines to the file. If the dialyzer output included:
and the create/4 function included line 39 then some searching might get you to https://github.com/elixir-ecto/ecto/issues/1882, and it might be reasonable to add this to your dialyzer.ignore-warnings file to eliminate warnings from specific lines:
Or if you have a particular set of errors you want to filter out everywhere then you could put this in the file:
It’s not advisable to just ignore everything, but this is a useful way to concentrate on problems over which you have some control.
The process which dialyxir uses to filter lines out of the dialyzer output runs the contents of the ignore file (in patterns through code like this:
lines = Enum.map(output, &String.trim_trailing/1)
patterns = pattern
cp = :binary.compile_pattern(patterns)
Enum.filter(lines, &(not String.contains?(&1, cp)))
_ -> output
so if there are any blank lines in the ignore file then no filtering will be done because :binary.compile_pattern considers an empty string to be an argument error.