Rule, reporting == when equivalent case of exists
Configuration option for EqualsCaseable.forbid.
Can be either
if" → InIfreported
a =
if list == [] then
"empty"
else
"filled"not reported
a =
case list of
[] ->
"empty"
_ :: _ ->
"filled"Everywherereported
a =
if list == [] then
"empty"
else
"filled"
b =
users |> List.filter (\u -> u.role == Moderator)not reported
a =
users
|> List.filter
(\u ->
case u.role of
Moderator ->
True
_ ->
False
)If (\a -> a.something == Variant) etc is a very common pattern
in your code base, you'll have an easier time
converting all the ifs first.
To get the discussed benefits like "Now the compiler will tell me all the places I need to make a new decision", you do need to refactor all these equality checks.
Your goal should be EqualsCaseable.forbid Everywhere
Reports when
==is used but there's there is an equivalentcase ofavailable.Where the given
ForbiddenLocationcan be eitherif" →InIfEverywherereported
not reported