credo icon indicating copy to clipboard operation
credo copied to clipboard

Predicate callbacks from behavior are not ignored

Open jjcarstens opened this issue 2 years ago • 1 comments

Precheck

  • [X] For bugs, please do a quick search and make sure the bug has not yet been reported here

Environment

  • Credo version (mix credo -v): 1.7.3-ref.dependabot/hex/credo-1.7.3.433dfec
  • Erlang/Elixir version (elixir -v): 1.16.0 OTP 26.2.1
  • Operating system: MacOS Ventura

What were you trying to do?

NervesSSH implements the Erlang :ssh_server_key_api behavior which has an is_auth_key/3 callback definition. The currently fails the predicate check despite it having @impl :ssh_server_key_api.

This might be an extreme edge case and maybe not need to be handled, but wanted to bring attention just in case

Expected outcome

Passing when is_* function is an implementation of a behavior callback.

Actual outcome

> nerves_ssh ?4 % mix credo -a --strict
Checking 11 source files ...

  Code Readability                                                                                                                                                                   
┃ 
┃ [R] ↗ Predicate function names should not start with 'is', and should end in a question mark.
┃       lib/nerves_ssh/keys.ex:14:7 #(NervesSSH.Keys.is_auth_key)

jjcarstens avatar Jan 08 '24 02:01 jjcarstens

Thx for reporting! :+1:

This is definitely an issue that we should solve!

rrrene avatar Jan 09 '24 16:01 rrrene

@jjcarstens 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! 👍

rrrene avatar Mar 31 '24 13:03 rrrene