dialyxir icon indicating copy to clipboard operation
dialyxir copied to clipboard

--format ignore_file not working as intended?

Open x-ji opened this issue 2 years ago • 5 comments

Environment

  • Elixir & Erlang/OTP versions (elixir --version):
Erlang/OTP 24 [erts-12.2] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1]
Elixir 1.13.3 (compiled with Erlang/OTP 24)
  • Which version of Dialyxir are you using? (cat mix.lock | grep dialyxir):
  "dialyxir": {:hex, :dialyxir, "1.1.0", "c5aab0d6e71e5522e77beff7ba9e08f8e02bad90dfbeffae60eaf0cb47e29488",
[:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "07ea8e49c45f15264ebe6d5b93799d4dd56a44036cf42d0ad9c960bc266c0b9a"},

Current behavior

I'm not sure if I didn't correctly understand how it's supposed to work, it seems to me that when I pass in the option --format ignore_file, the output is the same as when I don't pass in any --format option, and thus cannot be used for .dialyzer_ignore.exs?

I'm looking at the output to stderr.

Expected behavior

The output by mix dialyzer --format ignore_file can be used in the ignore file.

x-ji avatar Mar 29 '22 11:03 x-ji

Putting the output of mix dialyzer --format dialyzer in a dialyzer.ignore-warnings file worked. Not sure if the new format would be preferred though.

x-ji avatar Mar 29 '22 11:03 x-ji

Yeah I think the docs could definitely be improved regarding this - its for the legacy warning format.

jeremyjh avatar Mar 29 '22 16:03 jeremyjh

Thanks. Does it mean I should actually use mix dialyzer --format short for the format corresponding to .dialyzer_ignore.exs, and mix dialyzer --format dialyzer for the old format (dialyzer.ignore-warnings)? Does the flag --format ignore_file still have an effect/purpose? (I seem to still see it in the source code of dialyxir, but the output seems to be the same as when dialyzer is run without the flag, which confuses me. Sorry if I still didn't get it right 😅 .)

I can also make a small PR to fix the docs.

x-ji avatar Mar 29 '22 17:03 x-ji

Yes --format short can be used to get the description, you just have to put it in quotes/braces for .dialyzer_ignore.exs.

jeremyjh avatar Apr 01 '22 13:04 jeremyjh

I made a PR at https://github.com/jeremyjh/dialyxir/pull/457. Hope it makes sense (I removed the mention of --format ignore_file from the README, though the option ignore_file still remains in the code).

x-ji avatar Apr 01 '22 23:04 x-ji