diff options
author | Ben Sima <ben@bsima.me> | 2021-12-21 21:12:41 -0500 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2021-12-21 21:12:41 -0500 |
commit | 9a10f244693f4d0c17f4e758e64dbdc014299c9f (patch) | |
tree | e293cfae8637e54774c4a430b32b12dfcb3a1e2b /Biz/Lint.hs | |
parent | cf3fa3bdfab272151a734fe1b8725226b72f8521 (diff) |
Enable shellcheck lint and fix its warnings
Diffstat (limited to 'Biz/Lint.hs')
-rw-r--r-- | Biz/Lint.hs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Biz/Lint.hs b/Biz/Lint.hs index 38c7403..8d5a757 100644 --- a/Biz/Lint.hs +++ b/Biz/Lint.hs @@ -87,13 +87,13 @@ printResult r@(NoOp path_) = >> pure r changedFiles :: IO [FilePath] -changedFiles = mergeBase +> changed +changedFiles = + git ["merge-base", "HEAD", "origin/master"] + /> filter (/= '\n') + +> (\mb -> git ["diff", "--name-only", "--diff-filter=d", mb]) + /> String.lines where git args = Process.readProcess "git" args "" - mergeBase = git ["merge-base", "HEAD", "origin/master"] /> filter (/= '\n') - changed mb = - String.lines - </ git ["diff", "--name-only", "--diff-filter=d", mb] data Linter = Linter { exe :: Text, @@ -126,6 +126,9 @@ pylint = fixArgs = Nothing } +shellcheck :: Linter +shellcheck = Linter {exe = "shellcheck", args = [], fixArgs = Nothing} + data Status = Good | Bad String deriving (Show) @@ -152,7 +155,7 @@ runOne shouldFix root cwd path_ = results +> traverse_ printResult >> results lint shouldFix hlint path_ ] Just (Namespace _ Py) -> [lint shouldFix pylint path_] - Just (Namespace _ Sh) -> [pure <| NoOp path_] -- [lint "shellcheck" [] path_] + Just (Namespace _ Sh) -> [lint shouldFix shellcheck path_] Just (Namespace _ Nix) -> [pure <| NoOp path_] Just (Namespace _ Scm) -> [pure <| NoOp path_] Just _ -> [pure <. Warn <| "no linter for " <> Text.pack path_] |