summaryrefslogtreecommitdiff
path: root/Biz/Lint.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Biz/Lint.hs')
-rw-r--r--Biz/Lint.hs15
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_]