jeremyjh / dialyxir

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

Ignore only works with absolute path #500

Open maennchen opened 1 year ago

maennchen commented 1 year ago

Precheck

Environment

Erlang/OTP 26 [erts-14.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]

Elixir 1.14.4 (compiled with Erlang/OTP 26)
  "dialyxir": {:hex, :dialyxir, "1.3.0", "fd1672f0922b7648ff9ce7b1b26fcf0ef56dda964a459892ad15f6b4410b5284", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "00b2a4bcd6aa8db9dcb0b38c1225b7277dca9bc370b6438715667071a304696f"},

Current behavior

Ignore

[
  # Phoenix Bug
  {"lib/phoenix/router.ex", :pattern_match, 481}
]

Output

Finding suitable PLTs
Checking PLT...
[:absinthe, :absinthe_error_payload, :absinthe_phoenix, :absinthe_plug, :absinthe_relay, :acme_iam, :asn1, :castore, :certifi, :combine, :compiler, :connection, :cors_plug, :cowboy, :cowboy_telemetry, :cowlib, :crypto, :csv, :customer_book, :dataloader, :db_connection, :decimal, :ecto, :ecto_boot_migration, :ecto_enum, :ecto_sql, :eex, :elixir, :erlsom, :hackney, :httpoison, :idna, :inets, :jason, :jose, :kernel, :libcluster, :logger, :metrics, :mime, :mimerl, :mix, :myxql, :nimble_parsec, :oauth2, :openid_connect, :parse_trans, :phoenix, :phoenix_ecto, :phoenix_pubsub, ...]
PLT is up to date!
ignore_warnings: .dialyzer_ignore.exs

Starting Dialyzer
[
  check_plt: false,
  init_plt: '/home/maennchen/Development/acme_backend/_build/dev/dialyxir_erlang-26.0_elixir-1.14.4_deps-dev.plt',
  files: ['/home/maennchen/Development/acme_backend/_build/dev/lib/customer_book_api/ebin/Elixir.AcmeApi.Schema.Helpers.beam',
   '/home/maennchen/Development/acme_backend/_build/dev/lib/customer_book/ebin/Elixir.Acme.Application.beam',
   '/home/maennchen/Development/acme_backend/_build/dev/consolidated/Elixir.AcmeApi.Exception.beam',
   '/home/maennchen/Development/acme_backend/_build/dev/lib/customer_book_api/ebin/Elixir.AcmeApi.ErrorHelpers.beam',
   '/home/maennchen/Development/acme_backend/_build/dev/lib/customer_book/ebin/Elixir.Acme.HyperlinkManager.Hyperlink.Category.beam',
   ...],
  warnings: [:unknown]
]
Total errors: 1, Skipped: 0, Unnecessary Skips: 1
done in 0m5.58s
deps/phoenix/lib/phoenix/router.ex:481:pattern_match
The pattern can never match the type.

Pattern:
:error

Type:

  {%{
     :conn => nil,
     :log => :debug,
     :path_params => map(),
     :pipe_through => [any(), ...],
     :plug => Absinthe.Plug.GraphiQL,
     :plug_opts => [any(), ...],
     :route => <<_::8>>
   }, (map(), map() -> map()), (map() -> map()), {Phoenix.Router.Route, {_, _, _}}}

________________________________________________________________________________
done (warnings were emitted)
Halting VM with exit status 2

Expected behavior

Ignore is respected

Additional Context

Absolute Path

The following ignore is respected:

[
  # Phoenix Bug
  {Path.absname(Path.join(System.cwd!(), "deps/phoenix/lib/phoenix/router.ex")), :pattern_match, 481}
]

Erlang Version

Also, the error does not happen for OTP 25.3, but happens for 25.3.2 & 26.0.

Umbrella

The command is executed in an umbrella application.

jeremyjh commented 1 year ago

It looks like we're somehow dialyzing your dependencies, have you added paths in your config?

maennchen commented 1 year ago

No, there's only specific dialyzer config in the umbrella root mix.exs:

      dialyzer: [
        ignore_warnings: ".dialyzer_ignore.exs",
        list_unused_filters: true,
        plt_add_apps: [:mix]
      ],

All child mix.exs do not have additional dialyzer config.

maennchen commented 1 year ago

Reproduction Repo: https://github.com/maennchen/dialyzer-absolute-path-bug