hlint 1.9.6 → 1.9.7
raw patch · 4 files changed
+14/−9 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGES.txt +2/−0
- README.md +1/−1
- hlint.cabal +1/−1
- src/CmdLine.hs +10/−7
CHANGES.txt view
@@ -1,5 +1,7 @@ Changelog for HLint +1.9.7+ #86, don't use color unless $TERM claims to support it 1.9.6 #85, fix the free variable matching check for lambda #84, suggest fmap for Either
README.md view
@@ -8,7 +8,7 @@ ### Acknowledgements -This program has only been made possible by the presence of the [haskell-src-exts](https://github.com/haskell-suite/haskell-src-exts) package, and many improvements have been made by [Niklas Broberg](http://www.nbroberg.se) in response to feature requests. Additionally, many people have provided help and patches, including Lennart Augustsson, Malcolm Wallace, Henk-Jan van Tuyl, Gwern Branwen, Alex Ott, Andy Stewart, Roman Leshchinskiy, Johannes Lippmann and others.+This program has only been made possible by the presence of the [haskell-src-exts](https://github.com/haskell-suite/haskell-src-exts) package, and many improvements have been made by [Niklas Broberg](http://www.nbroberg.se) in response to feature requests. Additionally, many people have provided help and patches, including Lennart Augustsson, Malcolm Wallace, Henk-Jan van Tuyl, Gwern Branwen, Alex Ott, Andy Stewart, Roman Leshchinskiy, Johannes Lippmann, Iustin Pop, Steve Purcell and others. ### Bugs and limitations
hlint.cabal view
@@ -1,7 +1,7 @@ cabal-version: >= 1.6 build-type: Simple name: hlint-version: 1.9.6+version: 1.9.7 license: BSD3 license-file: LICENSE category: Development
src/CmdLine.hs view
@@ -58,7 +58,7 @@ data ColorMode = Never -- ^ Terminal output will never be coloured. | Always -- ^ Terminal output will always be coloured.- | Auto -- ^ Terminal output will be coloured if stdout is a terminal.+ | Auto -- ^ Terminal output will be coloured if $TERM and stdout appear to support it. deriving (Show, Typeable, Data) @@ -128,7 +128,7 @@ ,cmdReports = nam "report" &= opt "report.html" &= typFile &= help "Generate a report in HTML" ,cmdGivenHints = nam "hint" &= typFile &= help "Hint/ignore file to use" ,cmdWithHints = nam "with" &= typ "HINT" &= help "Extra hints to use"- ,cmdColor = nam "colour" &= name "color" &= opt Always &= typ "always/never/auto" &= help "Color output (requires ANSI terminal; auto means on when stdout is a terminal; by itself, selects always)"+ ,cmdColor = nam "colour" &= name "color" &= opt Always &= typ "always/never/auto" &= help "Color output (requires ANSI terminal; auto means on when $TERM is supported; by itself, selects always)" ,cmdIgnore = nam "ignore" &= typ "HINT" &= help "Ignore a particular hint" ,cmdShowAll = nam "show" &= help "Show all ignored ideas" ,cmdExtension = nam "extension" &= typ "EXT" &= help "File extensions to search (default hs/lhs)"@@ -189,11 +189,14 @@ -- | Determines whether to use colour or not. cmdUseColour :: Cmd -> IO Bool-cmdUseColour cmd =- case cmdColor cmd of- Auto -> hIsTerminalDevice stdout- Never -> return False- Always -> return True+cmdUseColour cmd = case cmdColor cmd of+ Always -> return True+ Never -> return False+ Auto -> do+ stdoutIsTerminal <- hIsTerminalDevice stdout+ termType <- lookup "TERM" `fmap` getEnvironment+ return $ stdoutIsTerminal && maybe False isColorTerm termType+ where isColorTerm t = t == "ansi" || "xterm" `isPrefixOf` t || "xvt" `isSuffixOf` t "." <\> x = x