Reputation: 671
I have a large Elixir (1.7.4) application and am running dialyzer (with dialyxir's latest version). I get a lot of unknown_function errors for functions that seem to mostly be in modules nested under packages that I have in deps. I found How to fix Dialyzer "Callback info about the '.....' behaviour is not available" error for new Mix.Tasks (errors that I also have and that I expect should share a solution) which says that I should be able to add the apps to my mix.exs file, but that didn't seem to do anything at all.
dialyzer: [
+ plt_add_apps: [:mix, :plug],
plt_add_deps: [:app_tree, :staged_client]
],
I also have numerous errors:
Callback info about the Plug behaviour is not available.
even after adding the plug dep to the apps as above.
Is there something obvious that I'm doing wrong? Can you explain what needs to be listed as apps, if they are also dependencies?
If you have solutions please be specific. I'm very new to dialyzer and pretty new to elixir.
(p.s. Gotta say I'm impressed by the incredible accuracy of dialyzer. So it would be nice if I could get this noise quieted down so I can really go after the problems. Found a few sneaky bugs so far (and a lot of bad specs :-( ).)
Here's my def for project in mix.exs, with my app name changed, and the expression added to try Aleksei's solution for plt_add_apps (which hasn't worked so far).
def project do
[
app: :my_app,
# version: "1.0.0-beta15",
version: version(),
elixir: "~> 1.7",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
start_permanent: Mix.env() == :prod,
dialyzer: [
plt_add_apps: Enum.map(deps(), &elem(&1, 0)) -- [:excoveralls, :hound, :mox],
plt_add_deps: [:app_tree, :staged_client]
],
elixirc_paths: elixirc_paths(Mix.env()),
elixirc_options: [long_compilation_threshold: 120],
test_coverage: [tool: ExCoveralls],
test_paths: ["test" | Path.wildcard("plugins/*/test")],
preferred_cli_env: [
coveralls: :test,
"coveralls.detail": :test,
"coveralls.post": :test,
"coveralls.html": :test
],
aliases: aliases(),
deps: deps(),
build_path: build_path()
]
end
A small sample of the errors, highlighting the mix and plug dependencies that I tried adding as apps, basic types that aren't recognized, and the Plug and Mix behaviours not found.
Finding suitable PLTs
Checking PLT...
[:arc, :arc_ecto, :asn1, :auto_linker, :bcrypt_elixir, :briefly, :certifi, :coherence, :combine, :comeonin, :compiler, :conform, :connection, :cors_plug, :cowboy, :cowlib, :cpu_util, :crypto, :db_connection, :decimal, :distillery, :earmark, :ecto, :eex, :elixir, :elixir_uuid, :etop, :ex_ami, :ex_crypto, :ex_data, :ex_doc, :ex_syslogger, :exactor, :exprintf, :exprof, :faker_elixir_octopus, :file_system, :flip_text, :floki, :gen_smtp, :gen_stage, :gen_state_machine, :gettext, :git_cli, :hackney, :hedwig, :hedwig_simple_responders, :hpack, :html_entities, :html_sanitize_ex, ...]
PLT is up to date!
Total errors: 880, Skipped: 0, Unnecessary Skips: 0
done in 0m59.28s
:0:unknown_function
Function Arc.Actions.Delete.delete/2 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Arc.Actions.Store.store/2 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Arc.Actions.Url.url/4 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Arc.Ecto.Schema.convert_params_to_binary/1 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Arc.Ecto.Type.cast/2 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Arc.Ecto.Type.dump/2 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Arc.Ecto.Type.load/2 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Arc.Ecto.Type.type/0 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Jason.decode/1 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Jason.decode/2 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Jason.decode!/1 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Jason.decode!/2 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Jason.encode/1 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Jason.encode!/1 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Logger.__do_log__/3 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Logger.__should_log__/1 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Logger.add_backend/1 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Logger.configure/1 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Logger.configure_backend/2 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Logger.level/0 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Logger.remove_backend/1 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Logger.remove_backend/2 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Plug.Conn.assign/3 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Plug.Conn.delete_req_header/2 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Plug.Conn.fetch_session/2 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Plug.Conn.get_peer_data/1 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Plug.Conn.get_session/2 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Plug.Conn.halt/1 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Plug.Conn.merge_resp_headers/2 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Plug.Conn.put_private/3 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Plug.Conn.put_resp_cookie/4 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Plug.Conn.put_resp_header/3 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Plug.Conn.put_session/3 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Plug.Conn.put_status/2 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Plug.Conn.register_before_send/2 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Plug.Conn.send_resp/3 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Plug.Conn.Query.decode/1 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Plug.Conn.Query.encode/2 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Plug.Debugger.__catch__/5 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Plug.HTML.html_escape/1 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Plug.HTML.html_escape_to_iodata/1 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Plug.Head.call/2 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Plug.Logger.call/2 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Plug.MethodOverride.call/2 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Plug.Parsers.call/2 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Plug.RequestId.call/2 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Plug.Session.call/2 does not exist.
________________________________________________________________________________
:0:unknown_function
Function Plug.Static.call/2 does not exist.
________________________________________________________________________________
:0:unknown_function
Function :hackney.stream_next/1 does not exist.
________________________________________________________________________________
:0:unknown_function
Function :public_key.decrypt_public/2 does not exist.
________________________________________________________________________________
:0:unknown_function
Function :public_key.encrypt_private/2 does not exist.
________________________________________________________________________________
:0:unknown_function
Function :public_key.pem_decode/1 does not exist.
________________________________________________________________________________
:0:unknown_function
Function :public_key.pem_entry_decode/1 does not exist.
________________________________________________________________________________
:0:unknown_type
Unknown type: Ecto.Changeset.t/0.
________________________________________________________________________________
:0:unknown_type
Unknown type: Ecto.Query.t/0.
________________________________________________________________________________
:0:unknown_type
Unknown type: Ecto.Queryable.all/0.
________________________________________________________________________________
:0:unknown_type
Unknown type: Ecto.Queryable.t/0.
________________________________________________________________________________
:0:unknown_type
Unknown type: Ecto.Schema.t/0.
________________________________________________________________________________
:0:unknown_type
Unknown type: Ecto.Schema.Metadata.t/0.
________________________________________________________________________________
:0:unknown_type
Unknown type: Ecto.UUID.t/0.
________________________________________________________________________________
:0:unknown_type
Unknown type: HTTPPoison.Response.t/0.
________________________________________________________________________________
:0:unknown_type
Unknown type: HTTPoison.AsyncResponse.t/0.
________________________________________________________________________________
:0:unknown_type
Unknown type: HTTPoison.Base.body/0.
________________________________________________________________________________
:0:unknown_type
Unknown type: HTTPoison.Base.headers/0.
________________________________________________________________________________
:0:unknown_type
Unknown type: HTTPoison.Error.t/0.
________________________________________________________________________________
:0:unknown_type
Unknown type: HTTPoison.Response.t/0.
________________________________________________________________________________
:0:unknown_type
Unknown type: Integer.t/0.
________________________________________________________________________________
:0:unknown_type
Unknown type: List.t/0.
________________________________________________________________________________
:0:unknown_type
Unknown type: Logger.level/0.
________________________________________________________________________________
:0:unknown_type
Unknown type: Logger.message/0.
________________________________________________________________________________
:0:unknown_type
Unknown type: Map.t/0.
________________________________________________________________________________
:0:unknown_type
Unknown type: Module.t/0.
________________________________________________________________________________
:0:unknown_type
Unknown type: Phoenix.Socket.t/0.
________________________________________________________________________________
:0:unknown_type
Unknown type: Phoenix.Template.name/0.
________________________________________________________________________________
:0:unknown_type
Unknown type: Pigeon.APNS.Notification.t/0.
________________________________________________________________________________
:0:unknown_type
Unknown type: Pigeon.FCM.Notification.t/0.
________________________________________________________________________________
:0:unknown_type
Unknown type: Plug.Conn.t/0.
________________________________________________________________________________
:0:unknown_type
Unknown type: String.t/1.
________________________________________________________________________________
:0:unknown_type
Unknown type: String.type/0.
________________________________________________________________________________
:0:unknown_type
Unknown type: Struct.t/0.
________________________________________________________________________________
:0:unknown_type
Unknown type: Swoosh.Email.t/0.
________________________________________________________________________________
lib/mix/tasks/one.gen.plugins.ex:1:callback_info_missing
Callback info about the Mix.Task behaviour is not available.
________________________________________________________________________________
lib/phoenix/endpoint.ex:1:callback_info_missing
Callback info about the Plug behaviour is not available.
________________________________________________________________________________
lib/phoenix/endpoint.ex:1:callback_info_missing
Callback info about the Phoenix.Endpoint behaviour is not available.
________________________________________________________________________________
lib/phoenix/endpoint.ex:1:callback_info_missing
Callback info about the Plug behaviour is not available.
________________________________________________________________________________
lib/phoenix/endpoint.ex:1:callback_info_missing
Callback info about the Phoenix.Endpoint behaviour is not available.
________________________________________________________________________________
lib/phoenix/router.ex:1:callback_info_missing
Callback info about the Plug behaviour is not available.
________________________________________________________________________________
lib/phoenix/router.ex:1:callback_info_missing
Callback info about the Plug behaviour is not available.
________________________________________________________________________________
lib/phoenix/router.ex:1:callback_info_missing
Callback info about the Plug behaviour is not available.
________________________________________________________________________________
lib/phoenix/router.ex:1:callback_info_missing
Callback info about the Plug behaviour is not available.
________________________________________________________________________________
lib/phoenix/router.ex:1:callback_info_missing
Callback info about the Plug behaviour is not available.
done (warnings were emitted)
Halting VM with exit status 2
Upvotes: 2
Views: 1577