This repository was archived by the owner on Aug 18, 2020. It is now read-only.
File tree 2 files changed +37
-0
lines changed
2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 156
156
demoCluster = pkgs . callPackage ./scripts/launch/demo-cluster { inherit gitrev ; } ;
157
157
tests = {
158
158
shellcheck = pkgs . callPackage ./scripts/test/shellcheck.nix { src = ./. ; } ;
159
+ hlint = pkgs . callPackage ./scripts/test/hlint.nix { src = ./. ; } ;
159
160
stylishHaskell = pkgs . callPackage ./scripts/test/stylish.nix { src = ./. ; stylish-haskell = cardanoPkgs . stylish-haskell ; } ;
160
161
buildWalletIntegration = pkgs . callPackage ./scripts/test/wallet/integration/build-test.nix { inherit walletIntegrationTests pkgs ; } ;
161
162
swaggerSchemaValidation = pkgs . callPackage ./scripts/test/wallet/swaggerSchemaValidation.nix { inherit gitrev ; } ;
Original file line number Diff line number Diff line change
1
+ { runCommand , hlint , src , lib } :
2
+
3
+ let
4
+ cleanSourceFilter = with lib ;
5
+ name : type : let baseName = baseNameOf ( toString name ) ; in (
6
+ ( type == "regular" && hasSuffix ".hs" baseName ) ||
7
+ ( type == "regular" && hasSuffix ".yaml" baseName ) ||
8
+ ( type == "directory" )
9
+ ) ;
10
+ src' = builtins . filterSource cleanSourceFilter src ;
11
+ in
12
+ runCommand "cardano-hlint-check" { buildInputs = [ hlint ] ; } ''
13
+ set +e
14
+ # Networking is not in here, because it has a very different codestyle (doesn't use universum).
15
+ # This is bad and should probably be fixed.
16
+ projects=("util" "binary" "crypto" "core" "db" "lrc" "infra" "ssc" "txp" "update" "delegation" "node" "tools" "client" "generator" "auxx" "explorer" "wallet" "wallet-new")
17
+ cd ${ src' }
18
+ hlint lib/src lib/test lib/bench "'' ${projects[@]}"
19
+ EXIT_CODE=$?
20
+ if [[ $EXIT_CODE != 0 ]]
21
+ then
22
+ echo '====================================================================='
23
+ echo 'Note: to ignore a particular hint (e.g. "Reduce duplication"), write'
24
+ echo 'this in the source file:'
25
+ tput bold
26
+ echo '{-# ANN module ("HLint: ignore Reduce duplication" :: Text) #-}'
27
+ tput sgr0
28
+ echo 'You can also apply it just to a particular function, which is better:'
29
+ tput bold
30
+ echo '{-# ANN funcName ("HLint: ignore Reduce duplication" :: Text) #-}'
31
+ tput sgr0
32
+ exit $EXIT_CODE
33
+ else
34
+ echo $EXIT_CODE > $out
35
+ fi
36
+ ''
You can’t perform that action at this time.
0 commit comments