diff options
author | stuebinm | 2022-04-04 00:10:56 +0200 |
---|---|---|
committer | stuebinm | 2022-04-04 00:10:56 +0200 |
commit | 7e9941bf90644120b3627d0f0f66204fed9efb2a (patch) | |
tree | 6189ca6d4f2baab04a6759c9ba934295aa06def9 /lib/CheckMap.hs | |
parent | 1db21885df2bd99d65a5aac43bd7fc35ea0ff767 (diff) |
linter: collect content warnings
Diffstat (limited to 'lib/CheckMap.hs')
-rw-r--r-- | lib/CheckMap.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/CheckMap.hs b/lib/CheckMap.hs index 1d4c404..aa4616a 100644 --- a/lib/CheckMap.hs +++ b/lib/CheckMap.hs @@ -33,7 +33,7 @@ import LintConfig (LintConfig (..), LintConfig') import LintWriter (LintResult, invertLintResult, resultToAdjusted, resultToBadges, resultToDeps, resultToLints, resultToOffers, - runLintWriter) + runLintWriter, resultToCWs) import Properties (checkLayer, checkMap, checkTileset) import System.FilePath (takeFileName) import Types (Dep (MapLink), @@ -62,6 +62,8 @@ data MapResult (kind :: ResultKind) = MapResult -- ^ the loaded map, with adjustments by the linter , mapresultBadges :: [Badge] -- ^ badges that can be found on this map + , mapresultCWs :: [Text] + -- ^ collected CWs that apply to this map , mapresultGeneral :: [Hint] -- ^ general-purpose lints that didn't fit anywhere else } deriving (Generic) @@ -103,7 +105,7 @@ shrinkMapResult !res = res { mapresultAdjusted = () } -- layers upwards in the file hierarchy loadAndLintMap :: LintConfig' -> FilePath -> Int -> IO (Maybe (MapResult Full)) loadAndLintMap config path depth = loadTiledmap path <&> \case - Left err -> Just (MapResult mempty mempty mempty mempty Nothing mempty + Left err -> Just (MapResult mempty mempty mempty mempty Nothing mempty mempty [ Hint Fatal . toText $ path <> ": Fatal: " <> err ]) @@ -124,6 +126,7 @@ runLinter isMain config@LintConfig{..} tiledmap depth = MapResult <> concatMap resultToDeps tileset , mapresultProvides = concatMap resultToOffers layer , mapresultAdjusted = Just adjustedMap + , mapresultCWs = resultToCWs generalResult , mapresultBadges = concatMap resultToBadges layer <> resultToBadges generalResult } |