summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorstuebinm2021-11-28 22:24:30 +0100
committerstuebinm2021-11-28 22:26:48 +0100
commitefb64e0228c19ef7936446d3ca14a7d7a6e2540b (patch)
treeb9988c843847ed19e1e9fce2f3072a318f489f81 /src
parenta683b00fa1bc506be76919f4f0b166e595ef7a5b (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/Main.hs8
1 files changed, 5 insertions, 3 deletions
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 ()