diff options
Diffstat (limited to 'lib/CheckMap.hs')
-rw-r--r-- | lib/CheckMap.hs | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/lib/CheckMap.hs b/lib/CheckMap.hs index 3966988..c03197c 100644 --- a/lib/CheckMap.hs +++ b/lib/CheckMap.hs @@ -5,7 +5,6 @@ {-# LANGUAGE OverloadedStrings #-} -- | Module that contains the high-level checking functions -{-# OPTIONS_GHC -Wno-deferred-out-of-scope-variables #-} module CheckMap (loadAndLintMap) where import Data.Aeson (ToJSON) @@ -22,7 +21,7 @@ import LintWriter (LintResult (..), LintWriter, askContext, import Properties (checkLayerProperty, checkMap) import Tiled2 (Layer (layerName, layerProperties), Tiledmap (tiledmapLayers), loadTiledmap) -import Types (Dep, Level (..), Lint (..), hint, lintLevel) +import Types (Dep, Level (..), Lint (..), hint) import Util (PrettyPrint (prettyprint), prettyprint) @@ -81,26 +80,9 @@ instance PrettyPrint a => PrettyPrint (MapResult a) where where -- TODO: this can be simplified further prettyLayer :: [Text] - prettyLayer = mapMaybe - (uncurry showResult) + prettyLayer = map + (prettyprint . snd) (maybe [] toList . mapresultLayer $ mapResult) prettyGeneral :: [Text] prettyGeneral = flip (<>) "\n" . prettyprint <$> mapresultGeneral mapResult - --- TODO: possibly expand this to something more detailed? -showContext :: Text -> Text -showContext ctxt = " (in layer " <> ctxt <> ")\n" - --- | pretty-printer for a LintResult. Isn't an instance of PrettyPrint since --- it needs to know about the result's context (yes, there could be --- a wrapper type for that – but I wasn't really in the mood) -showResult :: Text -> LintResult c -> Maybe Text -showResult ctxt (LintResult (_, lints)) = - Just $ T.concat (mapMaybe showHint lints) - where - -- TODO: make the "log level" configurable - showHint hint = case lintLevel hint of - Info -> Nothing - _ -> Just $ prettyprint hint <> ctxtHint - ctxtHint = showContext ctxt |