]> git.rkrishnan.org Git - functorrent.git/commitdiff
Merge pull request #15 from vu3rdd/14-hlint-0
authorRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Tue, 24 Mar 2015 08:05:33 +0000 (13:35 +0530)
committerRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Tue, 24 Mar 2015 08:05:33 +0000 (13:35 +0530)
Run HLint as a test suite.

.travis.yml
functorrent.cabal
test/Hlint.hs [new file with mode: 0644]

index 5d11581d088e408569fdd779ced9c6bc3398b2ec..993167b9cf677d627c21ba269aa4231a50f301da 100644 (file)
@@ -1,2 +1,6 @@
 language: haskell
 ghc: 7.8
+install:
+  # Happy needs to be updated for haskell-src: https://github.com/haskell-suite/haskell-src-exts/issues/64
+  - cabal install happy
+  - cabal install --only-dependencies --enable-tests
\ No newline at end of file
index c70ff4e0c62ced4c1c66029bb15afc8e3d7ee6be..fc4cfb35bb18cc4a28bfb98f4255c952b66776c4 100644 (file)
@@ -42,7 +42,7 @@ executable functorrent
   main-is:             Main.hs
   other-extensions:    OverloadedStrings
   hs-source-dirs:      src
-  ghc-options:         -Wall -fwarn-incomplete-patterns
+  ghc-options:         -Wall -fwarn-incomplete-patterns -optc-Os
   default-language:    Haskell2010
   build-depends:       base,
                        base16-bytestring,
@@ -66,3 +66,11 @@ test-suite functorrent-test
                      doctest,
                      tasty,
                      tasty-hunit
+
+test-suite functorrent-hlint
+  type:              exitcode-stdio-1.0
+  default-language:  Haskell2010
+  hs-source-dirs:    test
+  main-is:           Hlint.hs
+  build-depends:     base,
+                     hlint
diff --git a/test/Hlint.hs b/test/Hlint.hs
new file mode 100644 (file)
index 0000000..0fa2512
--- /dev/null
@@ -0,0 +1,12 @@
+module Main where
+
+import Control.Monad
+import Language.Haskell.HLint
+import System.Environment
+import System.Exit
+
+main :: IO ()
+main = do
+  args <- getArgs
+  hints <- hlint $ ["src", "--cpp-define=HLINT", "--cpp-ansi"] ++ args
+  unless (null hints) exitFailure