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

Credo wrongly reports about macro name #1100

Closed
2 tasks done
luigi-discoup opened this issue Jan 2, 2024 · 2 comments
Closed
2 tasks done

Credo wrongly reports about macro name #1100

luigi-discoup opened this issue Jan 2, 2024 · 2 comments

Comments

@luigi-discoup
Copy link

Precheck

Environment

  • Credo version (mix credo -v): 1.7.2-ref.main.312f3a4
  • Erlang/Elixir version (elixir -v): Elixir 1.15.6 (compiled with Erlang/OTP 25) | Erlang/OTP 25 [erts-13.2.2.3] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]
  • Operating system: Debian GNU/Linux 11 (bullseye)

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
Copy link
Owner

rrrene commented Jan 2, 2024

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
Copy link
Author

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

Thank you @rrrene!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants