summaryrefslogtreecommitdiff
path: root/lib/Types.hs
diff options
context:
space:
mode:
authorstuebinm2021-11-28 22:24:30 +0100
committerstuebinm2021-11-28 22:26:48 +0100
commitefb64e0228c19ef7936446d3ca14a7d7a6e2540b (patch)
treeb9988c843847ed19e1e9fce2f3072a318f489f81 /lib/Types.hs
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 '')
-rw-r--r--lib/Types.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Types.hs b/lib/Types.hs
index 0d35432..1099630 100644
--- a/lib/Types.hs
+++ b/lib/Types.hs
@@ -84,8 +84,7 @@ instance PrettyPrint Hint where
prettyprint (Hint level msg) = " " <> (showText level) <> ": " <> msg
instance ToJSON Lint where
- toJSON (Lint (Hint l m)) = A.object
- [ "msg" .= m, "level" .= l ]
+ toJSON (Lint h) = toJSON h
toJSON (Depends dep) = A.object
[ "msg" .= prettyprint dep
, "level" .= A.String "Dependency Info" ]
@@ -93,6 +92,10 @@ instance ToJSON Lint where
[ "msg" .= prettyprint l
, "level" .= A.String "Entrypoint Info" ]
+instance ToJSON Hint where
+ toJSON (Hint l m) = A.object
+ [ "msg" .= m, "level" .= l ]
+
instance ToJSON Dep where
toJSON = \case
Local text -> json "local" $ prettyprint text