From efb64e0228c19ef7936446d3ca14a7d7a6e2540b Mon Sep 17 00:00:00 2001 From: stuebinm Date: Sun, 28 Nov 2021 22:24:30 +0100 Subject: various fixes to bugs Among them - always set correct exit codes - refuse to write out files if the out path already exists - calculate the overall severity correctly - slightly changed the json output schema - also output the text output format in json - make the default config.json suitable for a production environment --- src/Main.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/Main.hs') diff --git a/src/Main.hs b/src/Main.hs index d115660..572dc76 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -13,10 +13,10 @@ import Data.Aeson.KeyMap (coercionToHashMap) import qualified Data.ByteString.Char8 as C8 import qualified Data.ByteString.Lazy as LB import Data.Maybe (fromMaybe) -import System.Exit (exitWith) +import System.Exit (exitWith, ExitCode (..)) import WithCli -import CheckDir (recursiveCheckDir) +import CheckDir (recursiveCheckDir, resultIsFatal) import LintConfig (LintConfig (..), patch) import Types (Level (..)) import Util (printPretty) @@ -74,7 +74,9 @@ run options = do case out options of Just outpath -> writeAdjustedRepository lintconfig repo outpath lints >>= exitWith - Nothing -> pure () + Nothing -> exitWith $ case resultIsFatal lintconfig lints of + False -> ExitSuccess + True -> ExitFailure 1 -- | haskell's many string types are FUN … printLB :: LB.ByteString -> IO () -- cgit v1.2.3