@@ -1,19 +1,43 @@
1import Language.Haskell.HLint3 (hlint)
4import Language.Haskell.HLint3 (hlint)
5+import System.Directory
2import System.Exit (exitFailure, exitSuccess)
6import System.Exit (exitFailure, exitSuccess)
7+import System.FilePath.Find
4main :: IO ()
10main :: IO ()
6− ideas <- hlint
12+ pwd <- getCurrentDirectory
7− [ "."
13+ let runHlint f = hlint $ f:
8− , "--ignore=Redundant do"
14+ [ "--ignore=Redundant do"
9− , "--ignore=Use camelCase"
15+ , "--ignore=Use camelCase"
10− , "--ignore=Redundant $"
16+ , "--ignore=Redundant $"
11− , "--ignore=Use &&"
17+ , "--ignore=Use &&"
12− , "--ignore=Use &&&"
18+ , "--ignore=Use &&&"
13− , "--ignore=Use const"
19+ , "--ignore=Use const"
14− , "--ignore=Use >=>"
20+ , "--ignore=Use >=>"
15− , "--ignore=Use ."
21+ , "--ignore=Use ."
16− , "--ignore=Use unless"
22+ , "--ignore=Use unless"
17− , "--cpp-define=USE_TEMPLATE_HASKELL"
23+ , "--cpp-define=USE_TEMPLATE_HASKELL"
25+ recurseInto = and <$> sequence
26+ [ fileType ==? Directory
27+ , fileName /=? ".git"
29+ matchFile = and <$> sequence
30+ [ extension ==? ".hs"
31+ , let notElem' = liftOp notElem
32+ in filePath `notElem'` filePathExceptions pwd
34+ files <- find always matchFile pwd
35+ ideas <- fmap concat $ forM files $ \f -> do
36+ putStr $ "linting file " ++ drop (length pwd + 1) f ++ "... "
19 if null ideas then exitSuccess else exitFailure
38 if null ideas then exitSuccess else exitFailure
40+filePathExceptions :: FilePath -> [FilePath]
41+filePathExceptions pwd = map (pwd </>) $
42+ [ "src/Data/AppendMap.hs" -- parse error when hlint runs