diff options
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 |