fsprojects / FSharpLint

Lint tool for F#
https://fsprojects.github.io/FSharpLint/
MIT License
300 stars 73 forks source link

ExplicitPrecedenceViaParentheses rule #700

Open knocte opened 4 months ago

knocte commented 4 months ago

Even if F# follows strict precedence rules, programmers are not infallible and might not know them.

Therefore, for code like this:

let it = 1 |> (fun a b -> a) <| 2

It would be better to recommend parentheses:

let it = (1 |> (fun a b -> a)) <| 2
knocte commented 4 months ago

More testcases:

a || b && c

(should give suggestion)

(a || b) && c

(should not give suggestion)

a || (b && c)

(should not give suggestion)