jeremyjh / dialyxir

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

v1.4.4 fails with error using custom ignore file location #544

Closed randycoulman closed 1 week ago

randycoulman commented 1 month ago

Precheck

Environment

Elixir 1.17.2 (compiled with Erlang/OTP 27)

* Which version of Dialyxir are you using? (cat mix.lock | grep dialyxir): 1.4.4

### Current behavior
 * Describe current behavior. Include errors, stack traces, and any additional information that might be important here.

When I run `mix dialyzer` with v1.4.4, I get the following error. 1.4.3 runs correctly.
```shell
** (File.Error) could not read file stats ".dialyzer_ignore.exs": no such file or directory
    (elixir 1.17.2) lib/file.ex:435: File.stat!/2
    (dialyxir 1.4.4) lib/mix/tasks/dialyzer.ex:191: Mix.Tasks.Dialyzer.run/1
    (mix 1.17.2) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5
    (mix 1.17.2) lib/mix/cli.ex:96: Mix.CLI.run_task/2
    /Users/randy/.asdf/installs/elixir/1.17.2-otp-27/bin/mix:2: (file)

I think that the key thing to note is my dialyzer config, notably the fact that I'm specifying a custom location for the ignore_warnings setting:

  def project do
    [
      # ...
      dialyzer: [
        ignore_warnings: "config/dialyzer_ignore.exs",
        list_unused_filters: true,
        plt_add_apps: [:ex_unit, :mix],
        plt_local_path: "priv/plts"
      ],
      # ...
    ]
  end

Also note that my ignore file has an empty list in it, but I'm not sure that matters here.

If I comment out the ignore_warnings: line, dialyzer 1.4.4 works fine, but adds the No :ignore_warnings opt specified in mix.exs and default does not exist. line to its output.

If I move my ignore file to the standard .dialyzer_ignore.exs location, with or without the ignore_warnings: line, everything works as expected. It seems to be only the case where I specify a non-standard location for the ignore file that is broken.

Expected behavior

I'd expect mix dialyzer to run correctly using my custom ignore file location.

jeremyjh commented 1 month ago

@lnenad would you mind taking a quick look at this, given this is only happening after your changes in #543 ?

lnenad commented 1 month ago

Yes, it was my oversight, sorry @randycoulman! This PR fixes the issue https://github.com/jeremyjh/dialyxir/pull/545

jeremyjh commented 1 month ago

@randycoulman any chance you can test with that branch in your project?

randycoulman commented 1 month ago

@jeremyjh The branch works for me. Thanks!

esambo commented 1 month ago

Any update on this? 1.4.4 is still broken for me too. I would love to see a new release that fixes this issue

epinault commented 1 month ago

Just ran into this too today. And really need the fix to be published @jeremyjh as moving to 1.17/OTP27 is causing issues

scohen commented 3 weeks ago

Peeps, this has also broken Lexical's builds as well, can we get some work on this?

jeremyjh commented 3 weeks ago

Hey everyone, I apologize but I've been slammed at work for last 3 weeks, launching a major platform feature. This is currently stalled in CI failures in #545. If someone wants to take a look at that, I'd be grateful, I think @lnenad is stuck. The build matrix is a bit surprising. Otherwise I will make time for it this weekend.

epinault commented 2 weeks ago

why not retiring some version? the OTP + Elixir is more agressive and maybe it s time to ignore some of the old versions at this point? like OTP23 and lower, elixir 1.12 and lower?

pdm-jd commented 1 week ago

☝️ This PR fixes it and adds tests for the various scenarios.

epinault commented 6 days ago

will you push a new version 1.4.5 soon then?

jeremyjh commented 2 days ago

1.4.5 is released

epinault commented 1 day ago

thank you!

randycoulman commented 17 hours ago

Thanks @jeremyjh! Confirmed that this fixes my original issue.