Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UnnecessaryFunctionArguments] Warning on callback implementations #71

Open
pbrudnick opened this issue Jul 30, 2022 · 0 comments
Open
Labels
bug Something isn't working

Comments

@pbrudnick
Copy link
Collaborator

pbrudnick commented Jul 30, 2022

Bug Description

The UnnecessaryFunctionArguments rule is analyzing callback implementations which don't have set @impl before.

To Reproduce

I have this module implementing Plug:

defmodule CoophubWeb.Plug.SubdomainMatcher do
  @behaviour Plug
  import Plug.Conn, only: [put_private: 3, halt: 1]
  import Phoenix.Controller, only: [redirect: 2]

  @spec init(Keyword.t()) :: Keyword.t()
  def init(_opts) do
    Application.get_env(:coophub, CoophubWeb.Endpoint)[:url][:host]
  end

REDACTED
end

And I get:

lib/coophub_web/plug/subdomain_matcher.ex:7 - In module CoophubWeb.Plug.SubdomainMatcher: Argument in position 1 of CoophubWeb.Plug.SubdomainMatcher.init/1 is ignored in all of its clauses

Expected Behavior

Ignore callback implementations without @impl (maybe functions with same name/arity used in the module) or suggest to add it. Besides, e.g, the Plug docs don't suggest that thing https://hexdocs.pm/plug/readme.html#hello-world

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant