diff options
author | stuebinm | 2022-04-04 00:10:56 +0200 |
---|---|---|
committer | stuebinm | 2022-04-04 00:10:56 +0200 |
commit | 7e9941bf90644120b3627d0f0f66204fed9efb2a (patch) | |
tree | 6189ca6d4f2baab04a6759c9ba934295aa06def9 /lib/LintWriter.hs | |
parent | 1db21885df2bd99d65a5aac43bd7fc35ea0ff767 (diff) |
linter: collect content warnings
Diffstat (limited to '')
-rw-r--r-- | lib/LintWriter.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/LintWriter.hs b/lib/LintWriter.hs index bf2eb3e..87bad02 100644 --- a/lib/LintWriter.hs +++ b/lib/LintWriter.hs @@ -40,7 +40,7 @@ module LintWriter , lintConfig -- * adjust the linter's context , adjust - ) where + ,offersCWs,resultToCWs) where import Universum @@ -122,6 +122,11 @@ resultToBadges (LinterState a) = mapMaybe lintToBadge $ fst a where lintToBadge (Badge badge) = Just badge lintToBadge _ = Nothing +resultToCWs :: LintResult a -> [Text] +resultToCWs (LinterState a) = fold $ mapMaybe lintToCW $ fst a + where lintToCW = \case (CW cw) -> Just cw; _ -> Nothing + + -- | convert a lint result into a flat list of lints resultToLints :: LintResult a -> [Lint] resultToLints (LinterState res) = fst res @@ -152,6 +157,8 @@ offersEntrypoint text = tell' $ Offers text offersBadge :: Badge -> LintWriter a offersBadge badge = tell' $ Badge badge +offersCWs :: [Text] -> LintWriter a +offersCWs = tell' . CW -- | get the context as it was initially, without any modifications |