serokell / universum

:milky_way: Prelude written in @Serokell
MIT License
174 stars 26 forks source link

Some HLint rules are broken due to extra parenthesis #279

Closed Sorokin-Anton closed 1 year ago

Sorokin-Anton commented 1 year ago

For example, we have a such rule in .hlint.yaml

- warn: {lhs: (maybe pass f m), rhs: Universum.whenJust m f}

but when we use this file, x = maybe pass f m is not reported (while x = foo (maybe pass f m) is reported correctly)

We could remove parenthesis here, i.e. transform this rule to

- warn: {lhs: maybe pass f m, rhs: Universum.whenJust m f}

In this case x = maybe pass f m would be reported, but x = bar maybe pass f m wouldn't, so this is not leading us to false reports.

The same applies to all rules with such parenthesized lhs. I tested also rules with operators and case expressions using HLint versions 3.3.6 and 3.5, and in all cases removing parenthesis allows rules to trigger when we want them to.