dead-code-detection 0.6 → 0.7
raw patch · 3 files changed
+18/−4 lines, 3 files
Files
- dead-code-detection.cabal +2/−2
- src/Run.hs +5/−2
- test/RunSpec.hs +11/−0
dead-code-detection.cabal view
@@ -1,9 +1,9 @@--- This file has been generated from package.yaml by hpack version 0.10.0.+-- This file has been generated from package.yaml by hpack version 0.13.0. -- -- see: https://github.com/sol/hpack name: dead-code-detection-version: 0.6+version: 0.7 synopsis: detect dead code in haskell projects description: detect dead code in haskell projects category: Development
src/Run.hs view
@@ -24,6 +24,7 @@ data Options = Options { sourceDirs :: [FilePath],+ ignore :: [FilePath], root :: [String], version :: Bool, includeUnderscoreNames :: Bool@@ -34,14 +35,16 @@ run :: IO () run = do- let mods = [AddShortOption "sourceDirs" 'i']+ let mods = [AddShortOption "sourceDirs" 'i',+ AddShortOption "ignore" 'e'] withCliModified mods $ \ options -> do when (version options) $ do putStrLn versionOutput throwIO ExitSuccess when (null $ root options) $ die "missing option: --root=STRING"- files <- findHaskellFiles (sourceDirs options)+ files <- filter (`notElem` ignore options) <$>+ findHaskellFiles (sourceDirs options) deadNames <- deadNamesFromFiles files (map mkModuleName (root options))
test/RunSpec.hs view
@@ -57,6 +57,17 @@ withArgs ["--version"] run output `shouldContain` "version: " + it "ignores files if told to do so" $ do+ let main = ("Main", [i|+ module Main where+ main = return ()+ |])+ b = ("B", [i|+ This is some arbitrary text that is not Haskell.+ |])+ run' = withArgs (words "-i. -e./B.hs --root Main") run+ withModules [main, b] $ run' `shouldReturn` ()+ describe "deadNamesFromFiles" $ do it "should clearly mark ghc's output as such" $ do let a = ("A", [i|