我有一个大型 Elixir (1.7.4) 应用程序,并且正在运行透析器(使用 dialyxir 的最新版本)。对于似乎主要位于嵌套在我在 deps 中的包下的模块中的函数,我得到了很多 unknown_function 错误。我发现了新的 Mix.Tasks 的 How to fix Dialyzer "Callback info about the '.....' behavior is not available" 错误(我也有错误,我希望共享一个解决方案),它说我应该能够将应用程序添加到我的 mix.exs 文件中,但这似乎根本没有做任何事情。
dialyzer: [
+ plt_add_apps: [:mix, :plug],
plt_add_deps: [:app_tree, :staged_client]
],
我也有很多错误:
Callback info about the Plug behaviour is not available.
即使在将插件 dep 添加到上述应用程序之后。有什么明显的我做错了吗?如果它们也是依赖项,你能解释一下需要列为应用程序的内容吗?如果您有解决方案,请具体说明。我对透析器很陌生,对长生不老药也很陌生。
(ps 不得不说,透析器令人难以置信的准确性给我留下了深刻的印象。所以如果我能把这种噪音安静下来,这样我就可以真正解决问题了。到目前为止发现了一些偷偷摸摸的错误(还有很多不好的眼镜 :-( )。)
这是我在 mix.exs 中的项目定义,更改了我的应用程序名称,并添加了表达式以尝试 Aleksei 的 plt_add_apps 解决方案(到目前为止还没有工作)。
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
一小部分错误示例,突出显示了我尝试添加为应用程序的混合和插入依赖项、无法识别的基本类型以及未找到即插即用行为。
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