-- findExecutable

module Development.Shake.Linters ( tomlcheck
                                 , yamllint
                                 , hlint
                                 , shellcheck
                                 , ghc
                                 , module Development.Shake.FileDetect
                                 ) where

import Development.Shake
import           Development.Shake.FileDetect

checkFiles :: String -> [FilePath] -> Action ()
checkFiles str = mapM_ (cmd_ . ((str ++ " ") ++))

shellcheck :: [FilePath] -> Action ()
shellcheck = checkFiles "shellcheck"

ghc :: Action ()
ghc = checkFiles "ghc -Wall -Werror -Wincomplete-uni-patterns -Wincomplete-record-updates -fno-code" =<< getHs

tomlcheck :: Action ()
tomlcheck = checkFiles "tomlcheck --file" =<< getToml

hlint :: Action ()
hlint = checkFiles "hlint" =<< getHs

yamllint :: Action ()
yamllint = checkFiles "yamllint -s" =<< getYml