packages feed

hlint 2.0.8 → 2.0.9

raw patch · 9 files changed

+24/−17 lines, 9 filesdep ~extraPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: extra

API changes (from Hackage documentation)

Files

CHANGES.txt view
@@ -1,5 +1,8 @@ Changelog for HLint +2.0.9+    #346, don't suggest explicit export lists+    #344, fix the API so it works with hlint.yaml by default 2.0.8     #342, add back support for - to mean stdin 2.0.7
README.md view
@@ -68,13 +68,11 @@  The arguments after `-s` are passed to `hlint`, so modify the final `.` if you want other arguments. -**Appveyor:** Add the following statements to `.appveyor.yml`:+**Appveyor:** Add the following statement to `.appveyor.yml`: -    - set PATH=C:\Program Files\Git\mingw64\bin;%PATH%-    - curl -ohlint.bat -L https://raw.githubusercontent.com/ndmitchell/hlint/master/misc/appveyor.bat-    - hlint .+    - ps: Invoke-Command ([Scriptblock]::Create((Invoke-WebRequest 'https://raw.githubusercontent.com/ndmitchell/hlint/master/misc/appveyor.ps1').Content)) -ArgumentList @('.') -The `PATH` modification ensures `curl` is available on Appveyor. The final statement executes `hlint.bat` with whatever arguments you desire.+The arguments inside `@()` are passed to `hlint`, so add new arguments surrounded by `'`, space separated - e.g. `@('.' '--report')`.  ### Automatically Applying Hints 
hlint.cabal view
@@ -1,7 +1,7 @@ cabal-version:      >= 1.18 build-type:         Simple name:               hlint-version:            2.0.8+version:            2.0.9 license:            BSD3 license-file:       LICENSE category:           Development
src/HSE/Util.hs view
@@ -5,6 +5,7 @@ import Control.Monad import Data.List import Data.Maybe+import Data.Data hiding (Fixity) import System.FilePath import HSE.Type import Data.Functor@@ -261,15 +262,15 @@ --------------------------------------------------------------------- -- UNIPLATE FUNCTIONS -universeS :: Biplate x (f S) => x -> [f S]+universeS :: (Data x, Data (f S)) => x -> [f S] universeS = universeBi -childrenS :: Biplate x (f S) => x -> [f S]+childrenS :: (Data x, Data (f S)) => x -> [f S] childrenS = childrenBi   -- return the parent along with the child-universeParentExp :: Biplate a Exp_ => a -> [(Maybe (Int, Exp_), Exp_)]+universeParentExp :: Data a => a -> [(Maybe (Int, Exp_), Exp_)] universeParentExp xs = concat [(Nothing, x) : f x | x <- childrenBi xs]     where f p = concat [(Just (i,p), c) : f c | (i,c) <- zip [0..] $ children p] 
src/Hint/Bracket.hs view
@@ -101,13 +101,13 @@   where     go e = maybe e go (remParen e) -bracket :: (Data (a S), Uniplate (a S), ExactP a, Pretty (a S), Brackets (a S)) => Bool -> a S -> [Idea]+bracket :: (Data (a S), ExactP a, Pretty (a S), Brackets (a S)) => Bool -> a S -> [Idea] bracket bad = f Nothing     where         msg = "Redundant bracket"          -- f (Maybe (index, parent, gen)) child-        f :: (Data (a S), Uniplate (a S), ExactP a, Pretty (a S), Brackets (a S)) => Maybe (Int,a S,a S -> a S) -> a S -> [Idea]+        f :: (Data (a S), ExactP a, Pretty (a S), Brackets (a S)) => Maybe (Int,a S,a S -> a S) -> a S -> [Idea]         f Just{} o@(remParens -> Just x) | isAtom x = bracketError msg o x : g x         f Nothing o@(remParens -> Just x) | bad || isAtom x = (if isAtom x then bracketError else bracketWarning) msg o x : g x         f (Just (i,o,gen)) v@(remParens -> Just x) | not $ needBracket i o x =@@ -117,7 +117,7 @@             r = Replace typ (toSS v) [("x", toSS x)] "x"         f _ x = g x -        g :: (Data (a S), Uniplate (a S), ExactP a, Pretty (a S), Brackets (a S)) => a S -> [Idea]+        g :: (Data (a S), ExactP a, Pretty (a S), Brackets (a S)) => a S -> [Idea]         g o = concat [f (Just (i,o,gen)) x | (i,(x,gen)) <- zip [0..] $ holes o]  bracketWarning msg o x =
src/Hint/Export.hs view
@@ -19,7 +19,7 @@ exportHint _ (Module _ (Just o@(ModuleHead a name warning exports)) _ _ _)     | Nothing <- exports =         let o2 = ModuleHead a name warning $ Just $ ExportSpecList a [EModuleContents a name]-        in [(warn "Use module export list" o o2 []){ideaNote = [Note "An explicit list is usually better"]}]+        in [(ignore "Use module export list" o o2 []){ideaNote = [Note "An explicit list is usually better"]}]     | Just (ExportSpecList _ xs) <- exports, EModuleContents a name `elem_` xs =         let o2 = ModuleHead a name warning $ Just $ ExportSpecList a $ EVar a ellipses : delete_ (EModuleContents a name) xs         in [ignore "Use explicit module export list" o o2 []]
src/Hint/Extensions.hs view
@@ -108,6 +108,7 @@ import Data.Maybe import Data.List.Extra import Data.Ratio+import Data.Data import Refact.Types import Data.Monoid import Prelude@@ -268,7 +269,7 @@ hasT t x = not $ null (universeBi x `asTypeOf` [t]) hasT2 ~(t1,t2) = hasT t1 & hasT t2 -hasS :: Biplate x (f S) => (f S -> Bool) -> x -> Bool+hasS :: (Data x, Data (f S)) => (f S -> Bool) -> x -> Bool hasS test = any test . universeBi  has f = any f . universeBi
src/Hint/Naming.hs view
@@ -39,6 +39,7 @@  import Hint.Type import Data.List+import Data.Data import Data.Char import Data.Maybe import qualified Data.Set as Set@@ -102,7 +103,7 @@         g [] = []  -replaceNames :: Biplate a (Name S) => [(String,String)] -> a -> a+replaceNames :: Data a => [(String,String)] -> a -> a replaceNames rep = descendBi f     where f (Ident _ x) = Ident an $ fromMaybe x $ lookup x rep           f x = x
src/Language/Haskell/HLint3.hs view
@@ -90,6 +90,9 @@ --   argument, and all other files relative to the current directory. readSettingsFile :: Maybe FilePath -> String -> IO (FilePath, Maybe String) readSettingsFile dir x+    | takeExtension x `elem` [".yml",".yaml"] = do+        dir <- maybe getHLintDataDir return dir+        return (dir </> x, Nothing)     | Just x <- "HLint." `stripPrefix` x = do         dir <- maybe getHLintDataDir return dir         return (dir </> x <.> "hs", Nothing)@@ -97,10 +100,10 @@   -- | Given a function to load a module (typically 'readSettingsFile'), and a module to start from---   (defaults to @HLint.HLint@) find the information from all settings files.+--   (defaults to @hlint.yaml@) find the information from all settings files. findSettings :: (String -> IO (FilePath, Maybe String)) -> Maybe String -> IO ([Fixity], [Classify], [Either HintBuiltin HintRule]) findSettings load start = do-    (file,contents) <- load $ fromMaybe "HLint.HLint" start+    (file,contents) <- load $ fromMaybe "hlint.yaml" start     xs <- readFilesConfig [(file,contents)]     return ([x | Infix x <- xs]            ,[x | SettingClassify x <- xs]