packages feed

hlint 1.7 → 1.7.1

raw patch · 3 files changed

+17/−9 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

hlint.cabal view
@@ -1,7 +1,7 @@ cabal-version:      >= 1.6 build-type:         Simple name:               hlint-version:            1.7+version:            1.7.1 -- license is GPL v2 only license:            GPL license-file:       LICENSE
src/CmdLine.hs view
@@ -30,13 +30,17 @@     ,cmdEncoding :: String           -- ^ the text encoding     ,cmdFindHints :: [FilePath]      -- ^ source files to look for hints in     ,cmdLanguage :: [Extension]      -- ^ the extensions (may be prefixed by "No")+    ,cmdQuiet :: Bool                -- ^ supress all console output     }  -data Opts = Help | Ver | Test+data Opts = Help+          | Ver+          | Test           | Hints FilePath           | Report FilePath-          | Skip String | ShowAll+          | Skip String+          | ShowAll           | Color           | Define String           | Include String@@ -45,6 +49,7 @@           | Encoding String           | FindHints FilePath           | Language String+          | Quiet             deriving Eq  @@ -62,6 +67,7 @@        ,Option "f" ["find"] (ReqArg FindHints "file") "Find hints in a Haskell file"        ,Option "t" ["test"] (NoArg Test) "Run in test mode"        ,Option "d" ["datadir"] (ReqArg DataDir "dir") "Override the data directory"+       ,Option "q" ["quiet"] (NoArg Quiet) "Supress most console output"        ,Option ""  ["cpp-define"] (ReqArg Define "name[=value]") "CPP #define"        ,Option ""  ["cpp-include"] (ReqArg Include "dir") "CPP include path"        ]@@ -116,6 +122,7 @@         ,cmdEncoding = encoding         ,cmdFindHints = findHints         ,cmdLanguage = languages+        ,cmdQuiet = Quiet `elem` opt         }  
src/HLint.hs view
@@ -31,11 +31,11 @@  -- | This function takes a list of command line arguments, and returns the given suggestions. --   To see a list of arguments type @hlint --help@ at the console.---   This function usually writes to the stdout/stderr streams.+--   This function writes to the stdout/stderr streams, unless @--quiet@ is specified. -- --   As an example: ----- > do hints <- hlint ["src", "--ignore=Use map"]+-- > do hints <- hlint ["src", "--ignore=Use map","--quiet"] -- >    when (length hints > 3) $ error "Too many hints!" hlint :: [String] -> IO [Suggestion] hlint args = do@@ -53,6 +53,7 @@  runHints :: Cmd -> ParseFlags -> IO [Suggestion] runHints Cmd{..} flags = do+    let outStrLn x = unless cmdQuiet $ putStrLn x     settings1 <- readSettings cmdDataDir cmdHintFiles     settings2 <- concatMapM (fmap snd . findSettings flags) cmdFindHints     settings3 <- return [Classify Ignore x ("","") | x <- cmdIgnore]@@ -61,15 +62,15 @@     ideas <- fmap concat $ parallel [listM' =<< applyHint flags settings x | x <- cmdFiles]     let (showideas,hideideas) = partition (\i -> cmdShowAll || rank i /= Ignore) ideas     showItem <- if cmdColor then showANSI else return show-    mapM_ (putStrLn . showItem) showideas+    mapM_ (outStrLn . showItem) showideas      if null showideas then-        when (cmdReports /= []) $ putStrLn "Skipping writing reports"+        when (cmdReports /= []) $ outStrLn "Skipping writing reports"      else         forM_ cmdReports $ \x -> do-            putStrLn $ "Writing report to " ++ x ++ " ..."+            outStrLn $ "Writing report to " ++ x ++ " ..."             writeReport cmdDataDir x showideas-    putStrLn $+    outStrLn $         (let i = length showideas in if i == 0 then "No suggestions" else show i ++ " suggestion" ++ ['s'|i/=1]) ++         (let i = length hideideas in if i == 0 then "" else " (" ++ show i ++ " ignored)")     return $ map Suggestion showideas