summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstuebinm2021-11-10 22:00:22 +0100
committerstuebinm2021-11-10 22:00:22 +0100
commit629163381bb67d3435cd40981ebd9544933a0318 (patch)
treeb6f3104aff1f7e16da24a7361029aa9de8e7db86
parent652c2030c5ef39bf1dd34d26064e1059431898f0 (diff)
little code cleanup
-rw-r--r--lib/CheckMap.hs12
-rw-r--r--lib/Properties.hs2
2 files changed, 6 insertions, 8 deletions
diff --git a/lib/CheckMap.hs b/lib/CheckMap.hs
index 73909b9..35c00a1 100644
--- a/lib/CheckMap.hs
+++ b/lib/CheckMap.hs
@@ -89,7 +89,7 @@ runLinter :: Tiledmap -> Int -> MapResult
runLinter tiledmap depth = MapResult
{ mapresultLayer = invertThing layer
, mapresultTileset = invertThing tileset
- , mapresultGeneral = generalLints
+ , mapresultGeneral = resultToLints generalResult
, mapresultDepends = mapMaybe lintToDep generalLints
<> concatMap resultToDeps layer
<> concatMap resultToDeps tileset
@@ -99,6 +99,7 @@ runLinter tiledmap depth = MapResult
where
layer = checkThing tiledmapLayers checkLayer
tileset = checkThing tiledmapTilesets checkTileset
+ generalResult = runLintWriter tiledmap depth checkMap
checkThing getter checker = V.toList . V.map runCheck $ getter tiledmap
where runCheck thing = runLintWriter thing depth checker
@@ -106,15 +107,12 @@ runLinter tiledmap depth = MapResult
-- | "inverts" a LintResult, i.e. groups it by lints instead of
-- layers / maps
invertThing thing = M.unionsWith (<>) $ fmap invertLintResult thing
- -- lints collected from properties
- generalLints =
- resultToLints generalResult
- generalResult = runLintWriter tiledmap depth checkMap
adjustedMap = (resultToAdjusted generalResult)
- { tiledmapLayers = V.fromList . fmap resultToAdjusted $ layer }
- -- TODO: this appears to have reordered map layers???
+ { tiledmapLayers = V.fromList . fmap resultToAdjusted $ layer
+ , tiledmapTilesets = V.fromList . fmap resultToAdjusted $ tileset
+ }
-- human-readable lint output, e.g. for consoles
instance PrettyPrint (Level, MapResult) where
diff --git a/lib/Properties.hs b/lib/Properties.hs
index 97c5189..3ad8af2 100644
--- a/lib/Properties.hs
+++ b/lib/Properties.hs
@@ -98,7 +98,6 @@ checkLayer :: LintWriter Layer
checkLayer = do
layer <- askContext
mapM_ checkLayerProperty (getProperties layer)
- setProperty "jitsiRoomAdminTag" "Hello, World"
@@ -109,6 +108,7 @@ checkLayer = do
checkLayerProperty :: Property -> LintWriter Layer
checkLayerProperty p@(Property name _value) = case name of
"jitsiRoom" -> do
+ setProperty "jitsiRoomAdminTag" "Hello, World"
uselessEmptyLayer
unwrapString p $ \_val -> do
suggestProperty $ Property "jitsiTrigger" (StrProp "onaction")