Name
consistent_guard_operators
Brief Description
Avoid using a mix of andalso, orelse, ,, and ;, by choosing a consistent coding style for guard expressions.
Problematic code
foo(X) when is_integer(X), X > 0 orelse is_float(X) ->
Correct code
foo(X) when is_integer(X), X > 0; is_float(X) ->
Rationale
Both andalso/orelse, or ,/; provide some intent and short-circuit semantics. Mixing the two, though, can lead to subtle bugs or reduce readability, especially for newcomers.
Choose one style appropriate for the expression and stick to it within a guard to improve code clarity and maintainability.
Option
preferred_syntax => [punctuation | words]
punctuation is [;, ,] (the default)
words is [orelse, andalso] (we're not considering and or or since we already have a rule specific to that)