jeremyjh / dialyxir

Mix tasks to simplify use of Dialyzer in Elixir projects.
Apache License 2.0
1.71k stars 141 forks source link

Provide more clear explanation for message at the end of PLT generation #345

Open mguimas opened 5 years ago

mguimas commented 5 years ago

Environment

$ elixir --version
Erlang/OTP 21 [erts-10.2.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

Elixir 1.8.1 (compiled with Erlang/OTP 21)

$ cat mix.lock | grep dialyxir
  "dialyxir": {:hex, :dialyxir, "1.0.0-rc.6", "78e97d9c0ff1b5521dd68041193891aebebce52fc3b93463c0a6806874557d7d", [:mix], [{:erlex, "~> 0.2.1", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm"}

Current behavior

The message at the end of this

$ mix dialyzer --plt
Finding suitable PLTs
Checking PLT...
[:asn1, :certifi, :compiler,  ...]
Looking up modules in dialyxir_erlang-21.2.5_elixir-1.8.1_deps-dev.plt
Looking up modules in dialyxir_erlang-21.2.5_elixir-1.8.1.plt
Looking up modules in dialyxir_erlang-21.2.5.plt
Finding applications for dialyxir_erlang-21.2.5.plt
Finding modules for dialyxir_erlang-21.2.5.plt
Checking 14 modules in dialyxir_erlang-21.2.5.plt
Adding 173 modules to dialyxir_erlang-21.2.5.plt
Finding applications for dialyxir_erlang-21.2.5_elixir-1.8.1.plt
Finding modules for dialyxir_erlang-21.2.5_elixir-1.8.1.plt
Copying dialyxir_erlang-21.2.5.plt to dialyxir_erlang-21.2.5_elixir-1.8.1.plt
Looking up modules in dialyxir_erlang-21.2.5_elixir-1.8.1.plt
Checking 187 modules in dialyxir_erlang-21.2.5_elixir-1.8.1.plt
Adding 231 modules to dialyxir_erlang-21.2.5_elixir-1.8.1.plt
Finding applications for dialyxir_erlang-21.2.5_elixir-1.8.1_deps-dev.plt
Finding modules for dialyxir_erlang-21.2.5_elixir-1.8.1_deps-dev.plt
Copying dialyxir_erlang-21.2.5_elixir-1.8.1.plt to dialyxir_erlang-21.2.5_elixir-1.8.1_deps-dev.plt
Looking up modules in dialyxir_erlang-21.2.5_elixir-1.8.1_deps-dev.plt
Checking 418 modules in dialyxir_erlang-21.2.5_elixir-1.8.1_deps-dev.plt
Adding 1055 modules to dialyxir_erlang-21.2.5_elixir-1.8.1_deps-dev.plt
**No :ignore_warnings opt specified in mix.exs and default does not exist.** <-- THIS MESSAGE

is not sufficiently clear to the developer seeing it for the first time. What should the developer do?

Expected behavior

It seems that either Dialyxir should provide a default value for the :ignore_warnings option, or the developer should not be bothered with this message, which should then be cleared.

But if something must be done, please tell what must be done.

jeremyjh commented 5 years ago

See the discussion in https://github.com/jeremyjh/dialyxir/issues/224. I'm kind of leaning to your point of view now though; this message is probably a distraction in most cases. It is there so that if you have an ignore file with the wrong name, you get a clue what the problem is. I'm not sure if there is another way we could help solve that, or maybe we could just make the message sound less like a problem?

mguimas commented 5 years ago

@jeremyjh I believe that if the user did not provide :ignore_warnings in mix.exs is because they simply accept the default or don't care.

Document what is the default value of :ignore_warnings in case this option is not given in mix.exs, or in case the corresponding file does not exist, and document this well in the help docs in mix help dialyzer.

Also, better than the current message, is to present the user with the value being used for the :ignore_warnings option during execution of mix dialyzer.

Both of these should be more than enough.