jeremyjh / dialyxir

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

Dialyxir fails on phoenix_storybook with tons of unknown_function errors #520

Closed cblavier closed 11 months ago

cblavier commented 12 months ago

Hey there 👋

I'm the maintainer of the author of the phoenix_storybook library, and I used to have dialyxir running well on the project in CI. I had to disable it a few months ago because it stopped working and I just started investigating why.

Here is the branch I'm using for this specific issue.

When running mix dialyzer (erlang 26.0.2 / elixir 1.15.6-otp-26) I have the following output

Any help would be much appreciated 😄 Thanks 🙏

(matching issue on storybook project 👉 #317)

deadshot465 commented 11 months ago

We're in a similar situation here where dialyxir used to run perfectly fine in CI but now no longer works due to a whole bunch of unknown_function errors.

etehtsea commented 11 months ago

Inclusion of :hex into extra_applications introduces this behaviour.

@cblavier git revert of this commit fixes the issue.

From c63e236e8e154233a327d80ca40c32d5e4502d97 Mon Sep 17 00:00:00 2001
From: Christian Blavier <cblavier@gmail.com>
Date: Tue, 11 Jul 2023 15:05:50 +0200
Subject: [PATCH] fixed mix publish alias

---
 mix.exs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mix.exs b/mix.exs
index fb7d9d0..ec922b4 100644
--- a/mix.exs
+++ b/mix.exs
@@ -37,10 +37,13 @@ defmodule PhoenixStorybook.MixProject do
   def application do
     [
       mod: {PhoenixStorybook.Application, []},
-      extra_applications: [:logger]
+      extra_applications: [:logger] ++ extra_applications(Mix.env())
     ]
   end

+  defp extra_applications(env) when env in [:dev, :test], do: [:hex]
+  defp extra_applications(_), do: []
+
   defp elixirc_paths(:test), do: ["lib", "test/fixtures"]
   defp elixirc_paths(_), do: ["lib"] 

Though I haven't debugged why is that.

cblavier commented 11 months ago

You're my hero! It indeed fixed it Thanks!

etehtsea commented 11 months ago

@cblavier you are welcome :)

Also, adding hex to the ignore list seems to resolve the issue:

dialyzer: [
  plt_ignore_apps: [:hex]
]