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

Code readability: Predicate function names should not start with 'is', and should end in a question mark. #1106

Closed bradhanks closed 8 months ago

bradhanks commented 8 months ago

I propose changing the function names as follows:

is_selenium? -> selenium? is_sigil -> sigil? is_do -> do_key_member? is_parameter_in_function_call -> function_call_parameter?

Output:

┃ [R] ↗ Predicate function names should not start with 'is', and should end in a question mark.
┃       test/fixtures/example_code/browser2.ex:1516:8 #(Wallaby.Browser.is_selenium?)
┃ [R] ↗ Predicate function names should not start with 'is', and should end in a question mark.
┃       test/fixtures/example_code/browser.ex:1516:8 #(Wallaby.Browser.is_selenium?)
┃ [R] ↗ Predicate function names should not start with 'is', and should end in a question mark.
┃       lib/credo/check/readability/string_sigils.ex:104:8 #(Credo.Check.Readability.StringSigils.is_sigil)
┃ [R] ↗ Predicate function names should not start with 'is', and should end in a question mark.
┃       lib/credo/check/readability/parentheses_in_condition.ex:159:8 #(Credo.Check.Readability.ParenthesesInCondition.is_do)
┃ [R] ↗ Predicate function names should not start with 'is', and should end in a question mark.
┃       lib/credo/check/readability/parentheses_in_condition.ex:158:8 #(Credo.Check.Readability.ParenthesesInCondition.is_do)
┃ [R] ↗ Predicate function names should not start with 'is', and should end in a question mark.
┃       lib/credo/check/consistency/space_around_operators.ex:228:8 #(Credo.Check.Consistency.SpaceAroundOperators.is_parameter_in_function_call)
rrrene commented 8 months ago

I fixed some of those, but the others are not going to be fixed, as explained in #1105 :+1: