on develop help sign in
reflex/test/hlint.hs
39 lines 1.2 kB history raw
1module Main where
3import Control.Monad
4import Language.Haskell.HLint (hlint)
5import System.Directory
6import System.Exit (exitFailure, exitSuccess)
7import System.FilePath
8import System.FilePath.Find
10main :: IO ()
11main = do
12 pwd <- getCurrentDirectory
13 let runHlint f = hlint $ f:
14 [ "--ignore=Redundant do"
15 , "--ignore=Use camelCase"
16 , "--ignore=Redundant $"
17 , "--ignore=Use &&"
18 , "--ignore=Use &&&"
19 , "--ignore=Use const"
20 , "--ignore=Use >=>"
21 , "--ignore=Use ."
22 , "--ignore=Use unless"
23 , "--ignore=Reduce duplication"
24 , "--cpp-define=USE_TEMPLATE_HASKELL"
25 , "--cpp-define=DEBUG"
26 , "--ignore=Use tuple-section"
27 ]
28 recurseInto = and <$> sequence
29 [ fileType ==? Directory
30 , fileName /=? ".git"
31 ]
32 matchFile = and <$> sequence
33 [ extension ==? ".hs"
34 ]
35 files <- find recurseInto matchFile (pwd </> "src") --TODO: Someday fix all hints in tests, etc.
36 ideas <- fmap concat $ forM files $ \f -> do
37 putStr $ "linting file " ++ drop (length pwd + 1) f ++ "... "
38 runHlint f
39 if null ideas then exitSuccess else exitFailure