shake-ext 3.0.0.0 → 3.0.1.0
raw patch · 3 files changed
+20/−10 lines, 3 files
Files
- shake-ext.cabal +2/−1
- src/Development/Shake/FileDetect.hs +6/−2
- src/Development/Shake/Linters.hs +12/−7
shake-ext.cabal view
@@ -1,12 +1,13 @@ cabal-version: 1.18 name: shake-ext-version: 3.0.0.0+version: 3.0.1.0 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2018 Vanessa McHale maintainer: vamchale@gmail.com author: Vanessa McHale homepage: https://hub.darcs.net/vmchale/shake-ext+bug-reports: https://hub.darcs.net/vmchale/ats/issues synopsis: Helper functions for linting with shake description: This package provides several linters out of the box, for use with [shake](http://shakebuild.com/).
src/Development/Shake/FileDetect.hs view
@@ -14,9 +14,10 @@ , getDhall , getElm , getMadlang+ , getC ) where -import Control.Monad+import Data.Foldable (fold) import Data.Semigroup ((<>)) import Development.Shake @@ -24,6 +25,9 @@ getMadlang :: Action [FilePath] getMadlang = getAll ["mad"] +getC :: Action [FilePath]+getC = getAll ["c"]+ getElm :: Action [FilePath] getElm = getAll ["elm"] @@ -38,7 +42,7 @@ -- | Get all haskell source files, including module signatures. getHs :: [FilePath] -> Action [FilePath]-getHs files = join <$> mapM (`getAllDir` ["hs", "hs-boot", "hsig", "lhs"]) files+getHs files = fold <$> traverse (`getAllDir` ["hs", "hs-boot", "hsig", "lhs"]) files getHappy :: Action [FilePath] getHappy = getAll ["y", "yl"]
src/Development/Shake/Linters.hs view
@@ -11,18 +11,19 @@ , clangFormat , atsfmt , stylishHaskell+ , cFormat -- * File detection , module Development.Shake.FileDetect ) where -import Control.Monad import Data.Char (isSpace)+import Data.Foldable (traverse_) import Development.Shake import Development.Shake.FileDetect -- | Check all @.dhall@ files. dhall :: Action ()-dhall = mapM_ checkDhall =<< getDhall+dhall = traverse_ checkDhall =<< getDhall checkDhall :: FilePath -> Action () checkDhall dh = do@@ -30,7 +31,7 @@ command [Stdin contents] "dhall" [] trim :: String -> String-trim = join fmap f+trim = f . f where f = reverse . dropWhile isSpace -- | Check a given formatter is idempotent.@@ -42,18 +43,22 @@ -- | Check that given files are formatted according to @stylish-haskell@ stylishHaskell :: [FilePath] -> Action ()-stylishHaskell = mapM_ (checkIdempotent "stylish-haskell")+stylishHaskell = traverse_ (checkIdempotent "stylish-haskell") -- | Check that given files are formatted according to @atsfmt@ atsfmt :: [FilePath] -> Action ()-atsfmt = mapM_ (checkIdempotent "atsfmt")+atsfmt = traverse_ (checkIdempotent "atsfmt") -- | Check that given files are formatted according to @clang-format@ clangFormat :: [FilePath] -> Action ()-clangFormat = mapM_ (checkIdempotent "clang-format")+clangFormat = traverse_ (checkIdempotent "clang-format") +-- | Check all @.c@ files using @clang-format@.+cFormat :: Action ()+cFormat = clangFormat =<< getC+ checkFiles :: String -> [FilePath] -> Action ()-checkFiles str = mapM_ (cmd_ . ((str ++ " ") ++))+checkFiles str = traverse_ (cmd_ . ((str ++ " ") ++)) -- | Check all @.mad@ files. madlang :: [FilePath] -> Action ()