Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent behaviour with missing "ignore warnings" file #388

Open
legoscia opened this issue Mar 23, 2020 · 0 comments
Open

Inconsistent behaviour with missing "ignore warnings" file #388

legoscia opened this issue Mar 23, 2020 · 0 comments

Comments

@legoscia
Copy link
Contributor

Environment

  • Elixir & Erlang/OTP versions (elixir --version):
Erlang/OTP 22 [erts-10.6.4] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Elixir 1.9.1 (compiled with Erlang/OTP 22)
  • Which version of Dialyxir are you using? (cat mix.lock | grep dialyxir):
  "dialyxir": {:hex, :dialyxir, "1.0.0", "6a1fa629f7881a9f5aaf3a78f094b2a51a0357c843871b8bc98824e7342d00a5", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "aeb06588145fac14ca08d8061a142d52753dbc2cf7f0d00fc1013f53f8654654"},

Current behavior

If you specify a non-existent file in the ignore_warnings option, then Dialyxir will print a warning:

:ignore_warnings opt specified in mix.exs: .dialyzer_ignore, but file does not exist.

Then, the behaviour depends on whether there are any warnings in the code being analysed. If there are no warnings, Dialyxir exits successfully, but if there are warnings, Dialyxir fails with the following error message instead of printing the warnings:

** (File.Error) could not read file ".dialyzer_ignore": no such file or directory
    (elixir) lib/file.ex:353: File.read!/1
    lib/dialyxir/project.ex:132: Dialyxir.Project.filter_legacy_warnings/1
    lib/dialyxir/formatter.ex:243: anonymous fn/2 in Dialyxir.Formatter.filter_legacy_warnings/2
    (elixir) lib/enum.ex:3029: Enum.reject_list/2
    lib/dialyxir/formatter.ex:26: Dialyxir.Formatter.format_and_filter/4
    lib/dialyxir/dialyzer.ex:53: Dialyxir.Dialyzer.Runner.run/2
    lib/dialyxir/dialyzer.ex:75: Dialyxir.Dialyzer.dialyze/3
    lib/mix/tasks/dialyzer.ex:267: Mix.Tasks.Dialyzer.run_dialyzer/2

Expected behavior

I would expect the behaviour in face of a missing ignore file to be independent of whether there are any warnings, i.e. either make the warning about the missing file a fatal error in all cases, or print warnings without ignoring any of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant