From: Ramakrishnan Muthukrishnan Date: Tue, 24 Mar 2015 08:05:33 +0000 (+0530) Subject: Merge pull request #15 from vu3rdd/14-hlint-0 X-Git-Url: https://git.rkrishnan.org/?a=commitdiff_plain;h=7ef89b5818542caaf452ee2e6ac444c2f449b28c;hp=7d378fab27eb1339b9e6adb65a829a7446f0b150;p=functorrent.git Merge pull request #15 from vu3rdd/14-hlint-0 Run HLint as a test suite. --- diff --git a/.travis.yml b/.travis.yml index 5d11581..993167b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/functorrent.cabal b/functorrent.cabal index c70ff4e..fc4cfb3 100644 --- a/functorrent.cabal +++ b/functorrent.cabal @@ -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 index 0000000..0fa2512 --- /dev/null +++ b/test/Hlint.hs @@ -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