From 7e9941bf90644120b3627d0f0f66204fed9efb2a Mon Sep 17 00:00:00 2001 From: stuebinm Date: Mon, 4 Apr 2022 00:10:56 +0200 Subject: linter: collect content warnings --- lib/Types.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/Types.hs') diff --git a/lib/Types.hs b/lib/Types.hs index f58705a..d737392 100644 --- a/lib/Types.hs +++ b/lib/Types.hs @@ -54,7 +54,7 @@ instance HasArguments Level where -- | a hint comes with an explanation (and a level), or is a dependency -- (in which case it'll be otherwise treated as an info hint) -data Lint = Depends Dep | Offers Text | Lint Hint | Badge Badge +data Lint = Depends Dep | Offers Text | Lint Hint | Badge Badge | CW [Text] deriving (Ord, Eq, Generic, ToJSONKey) data Dep = Local RelPath | Link Text | MapLink Text | LocalMap RelPath @@ -87,6 +87,8 @@ instance PrettyPrint Lint where " Info: map offers entrypoint " <> prettyprint dep prettyprint (Badge _) = " Info: found a badge." + prettyprint (CW cws) = + " CWs: " <> show cws instance PrettyPrint Hint where prettyprint (Hint level msg) = " " <> show level <> ": " <> msg @@ -102,6 +104,9 @@ instance ToJSON Lint where toJSON (Badge _) = A.object [ "msg" .= A.String "found a badge" , "level" .= A.String "Badge Info"] + toJSON (CW cws) = A.object + [ "msg" .= A.String "Content Warning" + , "level" .= A.String "CW Info" ] instance ToJSON Hint where toJSON (Hint l m) = A.object -- cgit v1.2.3