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/Types.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/Types.hs')
-rw-r--r-- | lib/Types.hs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/Types.hs b/lib/Types.hs index b609012..fd2bd20 100644 --- a/lib/Types.hs +++ b/lib/Types.hs @@ -45,11 +45,11 @@ 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 | Lint Hint +data Lint = Depends Dep | Offers Text | Lint Hint -- | TODO: add a reasonable representation of possible urls data Dep = Local RelPath | Link Text | MapLink Text | LocalMap RelPath - deriving (Generic) + deriving (Generic, Ord, Eq) data Hint = Hint { hintLevel :: Level @@ -63,20 +63,25 @@ hint level msg = Lint Hint { hintLevel = level, hintMsg = msg } -- | dependencies just have level Info lintLevel :: Lint -> Level -lintLevel (Lint h) = hintLevel h -lintLevel (Depends _) = Info +lintLevel (Lint h) = hintLevel h +lintLevel _ = Info instance PrettyPrint Lint where prettyprint (Lint Hint { hintMsg, hintLevel } ) = " " <> showText hintLevel <> ": " <> hintMsg prettyprint (Depends dep) = " Info: found dependency: " <> prettyprint dep + prettyprint (Offers dep) = + " Info: map offers entrypoint " <> prettyprint dep instance ToJSON Lint where toJSON (Lint l) = toJSON l toJSON (Depends dep) = A.object [ "hintMsg" .= prettyprint dep , "hintLevel" .= A.String "Dependency Info" ] + toJSON (Offers l) = A.object + [ "hintMsg" .= prettyprint l + , "hintLevel" .= A.String "Entrypoint Info" ] instance ToJSON Dep where toJSON = \case |