View Source Credo.Check.Readability.PredicateFunctionNames (Credo v1.7.5)
This check is enabled by default.
Learn how to disable it via
This check has a base priority of
high and works with any version of Elixir.
Predicate functions/macros should be named accordingly:
For functions, they should end in a question mark.
# preferred defp user?(cookie) do end defp has_attachment?(mail) do end # NOT preferred defp is_user?(cookie) do end defp is_user(cookie) do end
For guard-safe macros they should have the prefix
is_and not end in a question mark.
# preferred defmacro is_user(cookie) do end # NOT preferred defmacro is_user?(cookie) do end defmacro user?(cookie) do end
Readability issues, this one is not a technical concern.
But you can improve the odds of others reading and liking your code by making
it easier to follow.
There are no specific parameters for this check.
Like with all checks, general params can be applied.
Parameters can be configured via the
.credo.exs config file.