summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2023-05-03 11:29:01 -0400
committerBen Sima <ben@bsima.me>2023-05-03 11:29:01 -0400
commitc434004f4f69f3b4c5349add0703285d36b3ac5c (patch)
treea07a3849043e40d7c8f4a75fa6afbfe6ec96f72a
parent232ec32f9b7a9aacc0a5c8741dacdaccf03c80fd (diff)
Add C indent linter
-rw-r--r--Biz/Bild.nix2
-rw-r--r--Biz/Lint.hs4
2 files changed, 5 insertions, 1 deletions
diff --git a/Biz/Bild.nix b/Biz/Bild.nix
index 5774950..69fe5e1 100644
--- a/Biz/Bild.nix
+++ b/Biz/Bild.nix
@@ -137,7 +137,7 @@ rec {
} // { env = ghc; };
env = let
- linters = with nixpkgs.pkgs; [ ormolu hlint deadnix ];
+ linters = with nixpkgs.pkgs; [ ormolu hlint deadnix indent ];
in nixpkgs.pkgs.mkShell {
name = "bizdev";
# this should just be dev tools
diff --git a/Biz/Lint.hs b/Biz/Lint.hs
index 39c42db..d44e465 100644
--- a/Biz/Lint.hs
+++ b/Biz/Lint.hs
@@ -152,6 +152,9 @@ deadnix =
shellcheck :: Linter
shellcheck = Linter {exe = "shellcheck", checkArgs = [], fixArgs = Nothing}
+indent :: Linter
+indent = Linter {exe = "indent", checkArgs = [], fixArgs = Nothing}
+
data Status = Good | Bad String
deriving (Show)
@@ -181,6 +184,7 @@ runOne mode root cwd path_ = results +> traverse_ printResult >> results
Just (Namespace _ Sh) -> [lint mode shellcheck path_]
Just (Namespace _ Nix) -> [lint mode deadnix path_]
Just (Namespace _ Scm) -> [pure <| NoOp path_]
+ Just (Namespace _ C) -> [lint mode indent path_]
Just _ -> [pure <. Warn <| "no linter for " <> Text.pack path_]
lint :: Mode -> Linter -> FilePath -> IO Result