diff options
Diffstat (limited to 'lib/LintWriter.hs')
-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 |