Skip to content

Commit 6a05d45

Browse files
Adding custom hlint rules
1 parent fa36970 commit 6a05d45

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

.hlint.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# HLint configuration file
2+
# https://github.com/ndmitchell/hlint
3+
4+
# Optional rules
5+
- warn: { name: Use DerivingStrategies }
6+
7+
# Custom warning hints
8+
- warn: { note: Prefer pure to reduce Monad constraint
9+
, lhs: return x
10+
, rhs: pure x
11+
}
12+
- warn: { note: Use more general Foldable typeclass instance
13+
, lhs: maybeToList x
14+
, rhs: toList x
15+
}
16+
- warn: { note: Use more general Indexable typeclass instance
17+
, lhs: (!!)
18+
, rhs: (!)
19+
}
20+
- warn: { name: Prefer fold to mconcat
21+
, lhs: mconcat
22+
, rhs: fold
23+
}
24+
- warn: { name: Prefer fold1 to sconcat
25+
, lhs: sconcat
26+
, rhs: fold1
27+
}
28+
29+
# Replace a $ b $ c with a . b $ c
30+
- group: { name: dollar, enabled: true }
31+
32+
# Generalise map to fmap, ++ to <>
33+
- group: { name: generalise, enabled: true }
34+
35+
# Generalise Maybe, Either functions to fold, foldMap
36+
- group: { name: generalise-for-conciseness, enabled: true }
37+
38+
# The TupleSections language extension's syntax can be confusing, so we will ignore the hints
39+
- ignore: { name: Use tuple-section }
40+
41+
# Reports language extensions that ARE used, but are implied by other langauge
42+
# extensions. Since this whole implied extension idea is dodgy, we don't eschew
43+
# the extra information regarding what extensions are currently enabled.
44+
- ignore: { name: Unused LANGUAGE pragma }
45+
46+
47+
# Ignore some builtin hint in test modules where we need to test the hint.
48+
# These hints are inapplicable within test modules since the test-suites are
49+
# testing the properties that the hint assumes to be true.
50+
- ignore: { name: Use || }
51+
52+
- ignore: { name: Reduce duplication
53+
, within:
54+
[ Alignment.Pairwise.UnboxedUkkonen
55+
]
56+
}

0 commit comments

Comments
 (0)