jeremyjh / dialyxir

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

--format ignore_file not working as intended? #456

Open x-ji opened 2 years ago

x-ji commented 2 years ago

Environment

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)
  "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 commented 2 years ago

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.

jeremyjh commented 2 years ago

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

x-ji commented 2 years ago

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.

jeremyjh commented 2 years ago

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

x-ji commented 2 years ago

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).