jeremyjh / dialyxir

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

Crashes if `mix.lock` does not exist #472

Closed ollien closed 1 year ago

ollien commented 1 year ago

Precheck

Environment

Erlang/OTP 24 [erts-12.3.2.6] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]

Elixir 1.14.1 (compiled with Erlang/OTP 24)

Current behavior

I have mix dialyzer installed globally as an archive task. If I make a new project with mix new, and then run mix dialyzer, `mix crashes with

$ mix dialyzer
Finding suitable PLTs
Checking PLT...
[:compiler, :elixir, :kernel, :logger, :stdlib]
** (File.Error) could not read file "mix.lock": no such file or directory
    (elixir 1.14.1) lib/file.ex:358: File.read!/1
    lib/mix/tasks/dialyzer.ex:385: Mix.Tasks.Dialyzer.dependency_hash/0
    lib/mix/tasks/dialyzer.ex:249: Mix.Tasks.Dialyzer.check_plt/1
    lib/mix/tasks/dialyzer.ex:174: Mix.Tasks.Dialyzer.run/1
    (mix 1.14.1) lib/mix/task.ex:421: anonymous fn/3 in Mix.Task.run_task/4
    (mix 1.14.1) lib/mix/cli.ex:84: Mix.CLI.run_task/2

It looks like if I create a mix.lock file containing %{}, then it runs as expected.

Expected behavior

I'd expect it not to crash with an empty mix.lock.