aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/hlint-ci.yml26
-rw-r--r--.hlint.yaml82
-rw-r--r--haddock-api/src/Haddock/Convert.hs2
-rw-r--r--haddock-api/src/Haddock/InterfaceFile.hs1
-rw-r--r--haddock-library/src/CompatPrelude.hs3
5 files changed, 113 insertions, 1 deletions
diff --git a/.github/workflows/hlint-ci.yml b/.github/workflows/hlint-ci.yml
new file mode 100644
index 00000000..b6bdc029
--- /dev/null
+++ b/.github/workflows/hlint-ci.yml
@@ -0,0 +1,26 @@
+name: hlint
+
+on:
+ pull_request:
+ push:
+
+jobs:
+ build:
+ name: hlint
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ submodules: true
+
+ - uses: rwe/actions-hlint-setup@v1
+ name: Set up HLint
+ with:
+ version: "3.3.6"
+
+ - uses: rwe/actions-hlint-run@v2
+ name: hlint
+ with:
+ path: '[ "haddock-library/", "haddock-api/", "haddock-test/", "hoogle-test/", "html-test/", "hypsrc-test/", "latex-test/" ]'
+ fail-on: suggestion \ No newline at end of file
diff --git a/.hlint.yaml b/.hlint.yaml
new file mode 100644
index 00000000..e84b286e
--- /dev/null
+++ b/.hlint.yaml
@@ -0,0 +1,82 @@
+# Warnings currently triggered
+- ignore: {name: "Avoid lambda"} # 3 hints
+- ignore: {name: "Avoid lambda using `infix`"} # 5 hints
+- ignore: {name: "Eta reduce"} # 18 hints
+- ignore: {name: "Functor law"} # 3 hints
+- ignore: {name: "Fuse concatMap/map"} # 1 hint
+- ignore: {name: "Fuse foldr/map"} # 2 hints
+- ignore: {name: "Fuse mapM/map"} # 2 hints
+- ignore: {name: "Hoist not"} # 1 hint
+- ignore: {name: "Move brackets to avoid $"} # 7 hints
+- ignore: {name: "Move guards forward"} # 1 hint
+- ignore: {name: "Move map inside list comprehension"} # 2 hints
+- ignore: {name: "Redundant $"} # 11 hints
+- ignore: {name: "Redundant <$>"} # 3 hints
+- ignore: {name: "Redundant bang pattern"} # 1 hint
+- ignore: {name: "Redundant bracket"} # 44 hints
+- ignore: {name: "Redundant id"} # 1 hint
+- ignore: {name: "Redundant if"} # 3 hints
+- ignore: {name: "Redundant lambda"} # 2 hints
+- ignore: {name: "Redundant map"} # 3 hints
+- ignore: {name: "Redundant return"} # 1 hint
+- ignore: {name: "Replace case with fromMaybe"} # 2 hints
+- ignore: {name: "Replace case with maybe"} # 4 hints
+- ignore: {name: "Unused LANGUAGE pragma"} # 21 hints
+- ignore: {name: "Use $>"} # 4 hints
+- ignore: {name: "Use ++"} # 3 hints
+- ignore: {name: "Use :"} # 3 hints
+- ignore: {name: "Use <$>"} # 12 hints
+- ignore: {name: "Use <&>"} # 1 hint
+- ignore: {name: "Use <|>"} # 1 hint
+- ignore: {name: "Use =<<"} # 1 hint
+- ignore: {name: "Use all"} # 1 hint
+- ignore: {name: "Use bimap"} # 1 hint
+- ignore: {name: "Use camelCase"} # 31 hints
+- ignore: {name: "Use concatMap"} # 1 hint
+- ignore: {name: "Use const"} # 4 hints
+- ignore: {name: "Use fewer LANGUAGE pragmas"} # 1 hint
+- ignore: {name: "Use fewer imports"} # 1 hint
+- ignore: {name: "Use find"} # 1 hint
+- ignore: {name: "Use fmap"} # 12 hints
+- ignore: {name: "Use foldr"} # 1 hint
+- ignore: {name: "Use fromMaybe"} # 2 hints
+- ignore: {name: "Use infix"} # 2 hints
+- ignore: {name: "Use intercalate"} # 1 hint
+- ignore: {name: "Use isAsciiLower"} # 1 hint
+- ignore: {name: "Use isAsciiUpper"} # 1 hint
+- ignore: {name: "Use isDigit"} # 1 hint
+- ignore: {name: "Use lambda-case"} # 4 hints
+- ignore: {name: "Use let"} # 2 hints
+- ignore: {name: "Use list comprehension"} # 2 hints
+- ignore: {name: "Use list literal pattern"} # 1 hint
+- ignore: {name: "Use map once"} # 1 hint
+- ignore: {name: "Use maybe"} # 2 hints
+- ignore: {name: "Use newtype instead of data"} # 13 hints
+- ignore: {name: "Use notElem"} # 2 hints
+- ignore: {name: "Use print"} # 3 hints
+- ignore: {name: "Use record patterns"} # 5 hints
+- ignore: {name: "Use sortOn"} # 3 hints
+- ignore: {name: "Use tuple-section"} # 2 hints
+- ignore: {name: "Use unless"} # 1 hint
+- ignore: {name: "Use void"} # 1 hint
+# Module names (not all unique) where CPP can be used
+- extensions:
+ - name: CPP
+ within:
+ - Bug1091
+ - CompatPrelude
+ - CPP
+ - Documentation.Haddock.Parser.UtilSpec
+ - Documentation.Haddock.Types
+ - Haddock
+ - Haddock.Config
+ - Haddock.Convert
+ - Haddock.Interface
+ - Haddock.Interface.Create
+ - Haddock.InterfaceFile
+ - Haddock.Types
+ - Haddock.Utils
+ - Haddock.Version
+ - Haddock.Backends.Xhtml
+ - Main
+ - Test.Haddock.Config
diff --git a/haddock-api/src/Haddock/Convert.hs b/haddock-api/src/Haddock/Convert.hs
index 69af8045..10180361 100644
--- a/haddock-api/src/Haddock/Convert.hs
+++ b/haddock-api/src/Haddock/Convert.hs
@@ -19,7 +19,9 @@ module Haddock.Convert (
PrintRuntimeReps(..),
) where
+#ifndef __HLINT__
#include "HsVersions.h"
+#endif
import GHC.Data.Bag ( emptyBag )
import GHC.Types.Basic ( TupleSort(..), PromotionFlag(..), DefMethSpec(..), TopLevelFlag(..) )
diff --git a/haddock-api/src/Haddock/InterfaceFile.hs b/haddock-api/src/Haddock/InterfaceFile.hs
index 70d3407f..bd83e734 100644
--- a/haddock-api/src/Haddock/InterfaceFile.hs
+++ b/haddock-api/src/Haddock/InterfaceFile.hs
@@ -99,6 +99,7 @@ binaryInterfaceVersion = 38
binaryInterfaceVersionCompatibility :: [Word16]
binaryInterfaceVersionCompatibility = [37, binaryInterfaceVersion]
+#elif defined(__HLINT__)
#else
#error Unsupported GHC version
#endif
diff --git a/haddock-library/src/CompatPrelude.hs b/haddock-library/src/CompatPrelude.hs
index 60fa94d9..71a99559 100644
--- a/haddock-library/src/CompatPrelude.hs
+++ b/haddock-library/src/CompatPrelude.hs
@@ -1,6 +1,7 @@
{-# LANGUAGE CPP #-}
-#if !MIN_VERSION_base(4,5,0)
+#ifdef __HLINT__
+#elif !MIN_VERSION_base(4,5,0)
# error This module doesn't provide compat-shims for versions prior to base-4.5
#endif