diff options
author | stuebinm | 2021-09-18 01:59:00 +0200 |
---|---|---|
committer | stuebinm | 2021-09-18 01:59:00 +0200 |
commit | 1c82540aeea7636a6cfd25acfdd28c1029f5669f (patch) | |
tree | afdf9cdf8f33dfeffc2478b3e1e069748497b687 /lib/CheckMap.hs | |
parent | 77d1f4ce4eb3ba40d884cc4ed7fa693e16538c8d (diff) |
can collect dependencies!
There's now a Lint type, which may be either a "true lint" (which is a
Hint, which contains some message and level of severity), or a Depends,
which indicates that this map depends on some ressource or other (and is
otherwise treated as a special info Hint in all other cases)
Diffstat (limited to '')
-rw-r--r-- | lib/CheckMap.hs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/CheckMap.hs b/lib/CheckMap.hs index 0ff3fae..36cbf9d 100644 --- a/lib/CheckMap.hs +++ b/lib/CheckMap.hs @@ -16,18 +16,20 @@ import qualified Data.Text as T import qualified Data.Vector as V import GHC.Generics (Generic) -import LintWriter (Hint (..), Level (..), - LintResult (..), LintWriter, hint) +import LintWriter (Level (..), Lint (..), + LintResult (..), LintWriter, hint, + lintLevel) import Properties (checkProperty) import Tiled2 (Layer (layerName, layerProperties), Tiledmap (tiledmapLayers), loadTiledmap) -import Util (prettyprint, PrettyPrint (prettyprint)) +import Util (PrettyPrint (prettyprint), + prettyprint) -- | What this linter produces: lints for a single map data MapResult a = MapResult { mapresultLayer :: Maybe (Map Text (LintResult a)) - , mapresultGeneral :: [Hint] + , mapresultGeneral :: [Lint] } deriving (Generic, ToJSON) @@ -83,12 +85,12 @@ showContext ctxt = " (in layer " <> ctxt <> ")\n" -- a wrapper type for that – but I wasn't really in the mood) showResult :: Text -> LintResult a -> Maybe Text showResult ctxt (LintResult res) = case res of - Left hint -> Just $ "ERROR: " <> hintMsg hint <> showContext ctxt - Right (_, []) -> Nothing + Left hint -> Just $ "Fatal: " <> prettyprint hint + Right (_, []) -> Nothing Right (_, hints) -> Just $ T.concat (mapMaybe showHint hints) where -- TODO: make the "log level" configurable - showHint hint = case hintLevel hint of + showHint hint = case lintLevel hint of Info -> Nothing _ -> Just $ prettyprint hint <> ctxtHint ctxtHint = showContext ctxt |