OptimumCredo.Check.Readability.BooleanFunctionName (OptimumCredo v0.5.0)
View SourceBasics
This check is disabled by default.
Learn how to enable it via .credo.exs.
This check has a base priority of low and works with any version of Elixir.
Explanation
Functions that return a boolean end in ?.
Bad
def admin(user), do: user.role == :adminGood
def admin?(user), do: user.role == :adminOnly functions whose every clause ends in a certainly-boolean expression are reported. Calls to other functions are not assumed to return booleans.
Check-Specific Parameters
Use the following parameters to configure this check:
:ignore_functions
Function names that are exempt.
This parameter defaults to [].
General Parameters
Like with all checks, general params can be applied.
Parameters can be configured via the .credo.exs config file.