diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d238e62..701140b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,8 +32,8 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: rwe/actions-hlint-setup@v1 - - uses: rwe/actions-hlint-run@v2 + - uses: actions/checkout@v3 + - uses: haskell/actions/hlint-setup@v2 + - uses: haskell/actions/hlint-run@v2 with: fail-on: warning diff --git a/.hlint.yaml b/.hlint.yaml new file mode 100644 index 0000000..a26d927 --- /dev/null +++ b/.hlint.yaml @@ -0,0 +1,65 @@ +- ignore: {name: "Redundant do", within: spec} +- ignore: {name: "Eta reduce"} +- ignore: {name: "Use list comprehension"} +- ignore: {name: "Reduce duplication"} +- ignore: {name: "Use fmap"} # we use classy prelude so this would be in error +- ignore: {name: "Avoid restricted function", within: "**.Prelude"} # allow "as X" +- ignore: {name: "Use ."} # commonly broken or less readable +- ignore: {name: "Use &&"} # we like "and" at 3+ elements +- ignore: {name: "Use ||"} # we like "or" at 3+ elements +- ignore: {name: "Use join"} # this often leads to cryptic code when do notation is easier to read +- ignore: {name: "Use Just"} # makes code less readable +- ignore: {name: "Redundant ^."} # commonly broken by esqueleto + +# Custom Warnings +- warn: {lhs: mapM, rhs: traverse} +- warn: {lhs: mapM_, rhs: traverse_} +- warn: {lhs: forM, rhs: for} +- warn: {lhs: forM_, rhs: for_} +- warn: {lhs: return, rhs: pure} + +# Specify additional command line arguments +- arguments: + - -XBangPatterns + - -XDataKinds + - -XDeriveAnyClass + - -XDeriveFoldable + - -XDeriveFunctor + - -XDeriveGeneric + - -XDeriveLift + - -XDeriveTraversable + - -XDerivingStrategies + - -XFlexibleContexts + - -XFlexibleInstances + - -XGADTs + - -XGeneralizedNewtypeDeriving + - -XLambdaCase + - -XMultiParamTypeClasses + - -XNoImplicitPrelude + - -XNoMonomorphismRestriction + - -XOverloadedStrings + - -XQuasiQuotes + - -XRankNTypes + - -XRecordWildCards + - -XScopedTypeVariables + - -XStandaloneDeriving + - -XTypeApplications + - -XTypeFamilies + +- modules: + - {name: [Data.Set], as: Set} + - {name: [Data.Map], as: Map} + - {name: [Data.HashSet], as: HashSet} + - {name: [Data.HashMap.Strict], as: HashMap} + - {name: [Data.Text], as: T} + - {name: [Data.Text.Encoding], as: T} + - {name: [Data.Text.IO], as: T} + - {name: [Data.Text.Lazy], as: TL} + - {name: [Data.Text.Lazy.Encoding], as: TL} + - {name: [Data.Text.IO.Lazy], as: TL} + - {name: [Data.ByteString], as: BS} + - {name: [Data.ByteString.Lazy], as: BSL} + - {name: [Data.ByteString.Char8], as: BS8} + - {name: [Data.ByteString.Lazy.Char8], as: BSL8} + - {name: [Data.List.NonEmpty], as: NE} + - {name: [Data.Sequence], as: Seq} diff --git a/haskell-library-template.cabal b/haskell-library-template.cabal index 9aac4aa..2da0109 100644 --- a/haskell-library-template.cabal +++ b/haskell-library-template.cabal @@ -64,7 +64,7 @@ library test-suite spec type: exitcode-stdio-1.0 - main-is: Main.hs + main-is: Spec.hs other-modules: Paths_haskell_library_template hs-source-dirs: @@ -97,7 +97,6 @@ test-suite spec ghc-options: -Weverything -Wno-missing-exported-signatures -Wno-missing-import-lists -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-unsafe -Wno-safe -threaded -rtsopts "-with-rtsopts=-N" build-depends: base <5 - , haskell-library-template , hspec if impl(ghc >= 8.10) ghc-options: -Wno-missing-safe-haskell-mode -Wno-prepositive-qualified-module diff --git a/package.yaml b/package.yaml index 11f0cbd..2480a19 100644 --- a/package.yaml +++ b/package.yaml @@ -63,7 +63,7 @@ library: tests: spec: - main: Main.hs + main: Spec.hs source-dirs: tests ghc-options: -threaded -rtsopts "-with-rtsopts=-N" dependencies: diff --git a/tests/Main.hs b/tests/Main.hs deleted file mode 100644 index 1fcc19c..0000000 --- a/tests/Main.hs +++ /dev/null @@ -1 +0,0 @@ -{-# OPTIONS_GHC -F -pgmF hspec-discover -optF --module-name=Main -Wno-missing-export-lists #-} diff --git a/tests/Spec.hs b/tests/Spec.hs new file mode 100644 index 0000000..8044961 --- /dev/null +++ b/tests/Spec.hs @@ -0,0 +1 @@ +{-# OPTIONS_GHC -F -pgmF hspec-discover -Wno-missing-export-lists #-}