This repository was archived by the owner on Aug 18, 2020. It is now read-only.
File tree 3 files changed +36
-5
lines changed
3 files changed +36
-5
lines changed Original file line number Diff line number Diff line change 1
1
steps :
2
- - label : ' hlint'
3
- command : ' scripts/ci/nix-shell.sh -p hlint moreutils --run scripts/haskell/lint.sh'
4
- agents :
5
- system : x86_64-linux
6
-
7
2
- label : ' stack2nix'
8
3
command : ' scripts/ci/nix-shell.sh -p cabal2nix stack cabal-install ghc moreutils expect -Q -j 4 --run scripts/check-stack2nix.sh'
9
4
agents :
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
+ # Networking is not in here, because it has a very different codestyle (doesn't use universum).
14
+ # This is bad and should probably be fixed.
15
+ projects=("util" "binary" "crypto" "core" "db" "lrc" "infra" "ssc" "txp" "update" "delegation" "node" "tools" "client" "generator" "auxx" "explorer" "wallet" "wallet-new")
16
+ cd ${ src' }
17
+ hlint lib/src lib/test lib/bench "'' ${projects[@]}"
18
+ EXIT_CODE=$?
19
+ if [[ $EXIT_CODE != 0 ]]
20
+ then
21
+ echo '====================================================================='
22
+ echo 'Note: to ignore a particular hint (e.g. "Reduce duplication"), write'
23
+ echo 'this in the source file:'
24
+ tput bold
25
+ echo '{-# ANN module ("HLint: ignore Reduce duplication" :: Text) #-}'
26
+ tput sgr0
27
+ echo 'You can also apply it just to a particular function, which is better:'
28
+ tput bold
29
+ echo '{-# ANN funcName ("HLint: ignore Reduce duplication" :: Text) #-}'
30
+ tput sgr0
31
+ exit $EXIT_CODE
32
+ else
33
+ echo $EXIT_CODE > $out
34
+ fi
35
+ ''
You can’t perform that action at this time.
0 commit comments