Statistics
| Branch: | Tag: | Revision:

root / htools / lint-hints.hs @ 638e0a6f

History | View | Annotate | Download (669 Bytes)

1 5b11f8db Iustin Pop
{-| Custom hint lints for Ganeti.
2 2cdaf225 Iustin Pop
3 5b11f8db Iustin Pop
Since passing --hint to hlint will override, not extend the built-in
4 5b11f8db Iustin Pop
hints, we need to import the existing hints so that we get full
5 5b11f8db Iustin Pop
coverage.
6 2cdaf225 Iustin Pop
7 2cdaf225 Iustin Pop
-}
8 2cdaf225 Iustin Pop
9 5b11f8db Iustin Pop
import "hint" HLint.HLint
10 2cdaf225 Iustin Pop
import "hint" HLint.Dollar
11 2cdaf225 Iustin Pop
12 5a1e31b4 Iustin Pop
-- The following two hints warn to simplify e.g. "map (\v -> (v,
13 5a1e31b4 Iustin Pop
-- True)) lst" to "zip lst (repeat True)", which is more abstract
14 5a1e31b4 Iustin Pop
warn = map (\v -> (v, x)) y ==> zip y (repeat x)
15 5a1e31b4 Iustin Pop
  where _ = notIn v x
16 5a1e31b4 Iustin Pop
warn = map (\v -> (x, v)) ==> zip (repeat x)
17 5a1e31b4 Iustin Pop
  where _ = notIn v x
18 0c76f280 Iustin Pop
19 0c76f280 Iustin Pop
-- The following warn on use of length instead of null
20 0c76f280 Iustin Pop
warn = length x > 0 ==> not (null x)
21 0c76f280 Iustin Pop
warn = length x /= 0 ==> not (null x)
22 0c76f280 Iustin Pop
warn = length x == 0 ==> null x