拨号器(通过Dialyxir)警告;但这个值是无与伦比的;来自苦艾酒(GraphQL)路线的“前进”命令。如何解决?
我收到一个透析器错误,关于不匹配的返回,我不知道如何正确处理拨号器(通过Dialyxir)警告;但这个值是无与伦比的;来自苦艾酒(GraphQL)路线的“前进”命令。如何解决?,graphql,elixir,phoenix,dialyzer,absinthe,Graphql,Elixir,Phoenix,Dialyzer,Absinthe,我收到一个透析器错误,关于不匹配的返回,我不知道如何正确处理 mix dialyzer --quiet lib/my_app_web/router.ex:1:no_return Function __checks__/0 has no local return. ________________________________________________________________________________ lib/my_app_web/router.ex:21:unmatched
mix dialyzer --quiet
lib/my_app_web/router.ex:1:no_return
Function __checks__/0 has no local return.
________________________________________________________________________________
lib/my_app_web/router.ex:21:unmatched_return
The expression produces a value of type:
%{
:adapter => _,
:before_send => _,
:content_type => _,
:context => _,
:document_providers => _,
:json_codec => _,
:log_level => _,
:no_query_message => _,
:pipeline => _,
:pubsub => _,
:raw_options => Keyword.t(),
:schema_mod => atom(),
:serializer => _
}
but this value is unmatched.
________________________________________________________________________________
lib/my_app_web/router.ex:24:unmatched_return
The expression produces a value of type:
%{
:adapter => _,
:additional_pipeline => _,
:assets => _,
:before_send => _,
:content_type => _,
:context => _,
:default_headers => _,
:default_url => _,
:document_providers => _,
:interface => _,
:json_codec => _,
:log_level => _,
:no_query_message => _,
:pipeline => {Absinthe.Plug.GraphiQL, :pipeline},
:pubsub => _,
:raw_options => [{_, _}],
:schema_mod => atom(),
:serializer => _,
:socket => _,
:socket_url => _
}
but this value is unmatched.
我的mix.exs
如下所示:
def project do
[
app: :my_app,
version: "0.1.0",
elixir: "1.9.4",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
start_permanent: Mix.env() == :prod,
dialyzer: [
plt_add_deps: :transitive,
flags: [:error_handling, :race_conditions, :unmatched_returns, :underspecs]
],
aliases: aliases(),
deps: deps()
]
end
defmodule MyAppWeb.Router do
use MyAppWeb, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
plug MyAppWeb.Auth
end
pipeline :api do
plug :accepts, ["json"]
end
# Other scopes may use custom stacks.
scope "/api" do
pipe_through :api
forward "/graphql", Absinthe.Plug, schema: MyAppWeb.Schema.UserTypes
if Mix.env() == :dev do
forward "/graphiql", Absinthe.Plug.GraphiQL,
schema: MyAppWeb.Schema.UserTypes,
interface: :simple
end
end
scope "/", MyAppWeb do
pipe_through :browser
resources "/users", UserController,
only: [:index, :show, :new, :create, :edit, :delete, :update]
resources "/sessions", SessionController, only: [:new, :create, :delete]
get "/", PageController, :index, as: :home
get "/*path", PageController, :index
end
end
我的router.ex
如下所示:
def project do
[
app: :my_app,
version: "0.1.0",
elixir: "1.9.4",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
start_permanent: Mix.env() == :prod,
dialyzer: [
plt_add_deps: :transitive,
flags: [:error_handling, :race_conditions, :unmatched_returns, :underspecs]
],
aliases: aliases(),
deps: deps()
]
end
defmodule MyAppWeb.Router do
use MyAppWeb, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
plug MyAppWeb.Auth
end
pipeline :api do
plug :accepts, ["json"]
end
# Other scopes may use custom stacks.
scope "/api" do
pipe_through :api
forward "/graphql", Absinthe.Plug, schema: MyAppWeb.Schema.UserTypes
if Mix.env() == :dev do
forward "/graphiql", Absinthe.Plug.GraphiQL,
schema: MyAppWeb.Schema.UserTypes,
interface: :simple
end
end
scope "/", MyAppWeb do
pipe_through :browser
resources "/users", UserController,
only: [:index, :show, :new, :create, :edit, :delete, :update]
resources "/sessions", SessionController, only: [:new, :create, :delete]
get "/", PageController, :index, as: :home
get "/*path", PageController, :index
end
end
我尝试了\u=
技巧,但似乎不起作用。我认为使用不匹配的回报可能会有所帮助,但在这种情况下可能不会。我已经阅读了这个页面(),但我不认为它有助于解决这个问题
任何反馈或指导都将不胜感激
谢谢你我发现问题来自以下几点: 引起警告的可能是Phoenix发行版或Absince.Plug.init/1规格
对于正在解决的时间问题,您可以使用Dialyxir的忽略警告功能:请发布整个
路由器.ex
,以便我们可以检查透析器提到的第1、21、24行。@AlekseiMatiushkin我添加了整个路由器。第21行和第24行或graphql
和graphiql
行。也就是说,透析器不喜欢forward
s。我从未使用过Absinth,但我会去检查他们的密码。