diff options
author | stuebinm | 2021-09-30 02:02:29 +0200 |
---|---|---|
committer | stuebinm | 2021-09-30 02:02:29 +0200 |
commit | ca8552c4eb69b2b8267fe0046320bccf9f547b52 (patch) | |
tree | efda222c28b3d6267c89dd8b1793e4c6c259e53d /lib/LintWriter.hs | |
parent | 68af04a4da6ba4ec61d1469337ce53457526d861 (diff) |
simple map-map link dependency checking
This is purely based on a set difference, i.e. it won't catch stupid
things like a map linking to itself, a map link going only one-way, etc.
Also, it only handles map links; it doesn't check if all ressource files
referenced by a map actually exist.
Diffstat (limited to 'lib/LintWriter.hs')
-rw-r--r-- | lib/LintWriter.hs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/LintWriter.hs b/lib/LintWriter.hs index e704a3c..cdec972 100644 --- a/lib/LintWriter.hs +++ b/lib/LintWriter.hs @@ -53,6 +53,11 @@ lintToDep = \case Depends dep -> Just dep _ -> Nothing +lintToOffer :: Lint -> Maybe Text +lintToOffer = \case + Offers frag -> Just frag + _ -> Nothing + filterLintLevel :: Level -> [Lint] -> [Lint] filterLintLevel level = mapMaybe $ \l -> if level <= lintLevel l then Just l @@ -61,6 +66,9 @@ filterLintLevel level = mapMaybe $ \l -> if level <= lintLevel l resultToDeps :: LintResult a -> [Dep] resultToDeps (LintResult a) = mapMaybe lintToDep $ snd a +resultToOffers :: LintResult a -> [Text] +resultToOffers (LintResult a) = mapMaybe lintToOffer $ snd a + -- | convert a lint result into a flat list of lints -- (throwing away information on if a single error was fatal) resultToLints :: LintResult a -> [Lint] @@ -78,6 +86,10 @@ lint level = tell . (: []) . hint level dependsOn :: Dep -> LintWriter a dependsOn dep = tell . (: []) $ Depends dep +offersEntrypoint :: Text -> LintWriter a +offersEntrypoint = tell . (: []) . Offers + + info = lint Info suggest = lint Suggestion |