on master help sign in
Merge pull request #3 from digital-asset/hlint

Enable HLint

commit81dd71f47f105646e0b754dd676e0909761c207f authorMoritz Kiefer <moritz.kiefer@purelyfunctional.org> dateTue 10 Sep 2019, 17:03 (7 years ago) parentb8cdaafda5ab70
4 files changed+127
.gitignore+1 .hlint.yaml+120 azure-pipelines.yml+3 fmt.sh+3
.gitignore+1
@@ -2,3 +2,4 @@ dist/
22.stack-work/
33dist-newstyle/
44cabal.project.local
5+*~
.hlint.yamlnew file+120
@@ -0,0 +1,120 @@
1+# HLint configuration file
2+# https://github.com/ndmitchell/hlint
3+##########################
4+
5+# To run HLint do:
6+# $ hlint --git -j4
7+
8+# Warnings currently triggered by our code
9+- ignore: {name: "Use <$>"}
10+- ignore: {name: "Use :"}
11+- ignore: {name: "Redundant do"}
12+- ignore: {name: "Avoid lambda"}
13+- ignore: {name: "Use newtype instead of data"}
14+- ignore: {name: "Use fromMaybe"}
15+- ignore: {name: "Use unless"}
16+- ignore: {name: "Move brackets to avoid $"}
17+- ignore: {name: "Eta reduce"}
18+- ignore: {name: "Parse error"}
19+- ignore: {name: "Reduce duplication"}
20+- ignore: {name: "Use ++"}
21+- ignore: {name: "Use $>"}
22+- ignore: {name: "Use section"}
23+- ignore: {name: "Use record patterns"}
24+- ignore: {name: "Use camelCase"}
25+- ignore: {name: "Use uncurry"}
26+- ignore: {name: "Avoid lambda using `infix`"}
27+
28+# Off by default hints we like
29+- warn: {name: Use module export list}
30+
31+# Condemn nub and friends
32+- warn: {lhs: nub (sort x), rhs: Data.List.Extra.nubSort x}
33+- warn: {lhs: nub, rhs: Data.List.Extra.nubOrd}
34+- warn: {lhs: nubBy, rhs: Data.List.Extra.nubOrdBy}
35+- warn: {lhs: Data.List.Extra.nubOn, rhs: Data.List.Extra.nubOrdOn}
36+
37+# DA specific hints
38+- warn: {lhs: Data.Text.pack (DA.Pretty.renderPlain x), rhs: DA.Pretty.renderPlain x}
39+- warn: {lhs: Data.Text.Extended.pack (DA.Pretty.renderPlain x), rhs: DA.Pretty.renderPlain x}
40+- warn: {lhs: DA.Pretty.renderPlain (DA.Pretty.pretty x), rhs: DA.Pretty.renderPretty x}
41+- warn: {lhs: Data.Text.readFile, rhs: Data.Text.Extended.readFileUtf8}
42+- warn: {lhs: Data.Text.writeFile, rhs: Data.Text.Extended.writeFileUtf8}
43+- warn: {lhs: Data.Text.Lazy.readFile, rhs: Data.Text.Extended.readFileUtf8}
44+- warn: {lhs: Data.Text.Lazy.writeFile, rhs: Data.Text.Extended.writeFileUtf8}
45+- warn: {lhs: System.Environment.setEnv, rhs: System.Environment.Blank.setEnv}
46+
47+# Specify additional command line arguments
48+#
49+# - arguments: [--color, --cpp-simple, -XQuasiQuotes]
50+
51+- extensions:
52+ - default: true
53+
54+ # Extensions enabled by `bazel` and `da-ghci` by default. We ban them here
55+ # to avoid useless pragmas piling up on the top of files.
56+ - {name: BangPatterns, within: []}
57+ - {name: DeriveDataTypeable, within: []}
58+ - {name: DeriveFoldable, within: []}
59+ - {name: DeriveFunctor, within: []}
60+ - {name: DeriveGeneric, within: []}
61+ - {name: DeriveTraversable, within: []}
62+ - {name: FlexibleContexts, within: []}
63+ - {name: GeneralizedNewtypeDeriving, within: []}
64+ - {name: LambdaCase, within: []}
65+ - {name: NamedFieldPuns, within: []}
66+ - {name: OverloadedStrings, within: []}
67+ - {name: PackageImports, within: []}
68+ - {name: RecordWildCards, within: []}
69+ - {name: ScopedTypeVariables, within: []}
70+ - {name: StandaloneDeriving, within: []}
71+ - {name: TupleSections, within: []}
72+ - {name: TypeApplications, within: []}
73+ - {name: ViewPatterns, within: []}
74+
75+ # Shady extensions
76+ - {name: ImplicitParams, within: []}
77+ - name: CPP
78+ within:
79+ - Development.IDE.Core.FileStore
80+ - Development.IDE.Core.Compile
81+ - Development.IDE.GHC.Compat
82+ - Development.IDE.GHC.Util
83+ - Development.IDE.Import.FindImports
84+ - Development.IDE.Spans.Calculate
85+
86+- flags:
87+ - default: false
88+ - {name: [-Wno-missing-signatures, -Wno-orphans, -Wno-overlapping-patterns, -Wno-incomplete-patterns, -Wno-missing-fields, -Wno-unused-matches]}
89+ - {name: [-Wno-dodgy-imports], within: Main}
90+# - modules:
91+# - {name: [Data.Set, Data.HashSet], as: Set} # if you import Data.Set qualified, it must be as 'Set'
92+# - {name: Control.Arrow, within: []} # Certain modules are banned entirely
93+#
94+- functions:
95+ - {name: unsafeInterleaveIO, within: []}
96+ - {name: unsafeDupablePerformIO, within: []}
97+ - {name: unsafeCoerce, within: []}
98+
99+# Add custom hints for this project
100+#
101+# Will suggest replacing "wibbleMany [myvar]" with "wibbleOne myvar"
102+# - error: {lhs: "wibbleMany [x]", rhs: wibbleOne x}
103+
104+# Turn on hints that are off by default
105+#
106+# Ban "module X(module X) where", to require a real export list
107+# - warn: {name: Use explicit module export list}
108+#
109+# Replace a $ b $ c with a . b $ c
110+# - group: {name: dollar, enabled: true}
111+#
112+# Generalise map to fmap, ++ to <>
113+# - group: {name: generalise, enabled: true}
114+
115+# Ignore some builtin hints
116+# - ignore: {name: Use let}
117+# - ignore: {name: Use const, within: SpecialModule} # Only within certain modules
118+
119+# Define some custom infix operators
120+# - fixity: infixr 3 ~^#^~
azure-pipelines.yml+3
@@ -30,6 +30,9 @@ jobs:
3030 tar xzf .azure-cache/stack-root.tar.gz -C $HOME
3131 displayName: "Unpack cache"
3232 condition: eq(variables.CACHE_RESTORED, 'true')
33+ - bash: |
34+ ./fmt.sh
35+ displayName: "HLint via ./fmt.sh"
3336 - bash: |
3437 sudo apt-get install -y g++ gcc libc6-dev libffi-dev libgmp-dev make zlib1g-dev
3538 curl -sSL https://get.haskellstack.org/ | sh
fmt.shnew file+3
@@ -0,0 +1,3 @@
1+#!/usr/bin/env bash
2+set -eou pipefail
3+curl -sSL https://raw.github.com/ndmitchell/hlint/master/misc/run.sh | sh -s .