From ca8552c4eb69b2b8267fe0046320bccf9f547b52 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Thu, 30 Sep 2021 02:02:29 +0200 Subject: 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. --- lib/LintWriter.hs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/LintWriter.hs') 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 -- cgit v1.2.3