rrrene / credo

A static code analysis tool for the Elixir language with a focus on code consistency and teaching.
http://credo-ci.org/
MIT License
4.91k stars 414 forks source link

Credo wrongly reports about macro name #1100

Closed luigi-discoup closed 8 months ago

luigi-discoup commented 8 months ago

Precheck

Environment

What were you trying to do?

I'm trying to define a macro predicate using the is_something naming convention. I've made a test with a sample code:

test "it should NOT report a violation with defmacro" do
  """
  defmacro is_user(cookie) do
  end
  """
  |> to_source_file
  |> run_check(@described_check)
  |> refute_issues()
end

Expected outcome

I believe that no issue should be reported

Actual outcome

Credo reports the following readability issue:

Predicate function names should not start with 'is', and should end in a question mark.
rrrene commented 8 months ago

Thanks for reporting this 😀 It is now fixed on master.

You can try this by setting the Credo dep to

{:credo, github: "rrrene/credo"}

Please report back if your issue is solved! 👍

luigi-discoup commented 8 months ago

Tested with version on master and now it works as expected. Waiting for the new release.

Thank you @rrrene!