Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
walint
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
hub
walint
Commits
12025514
Commit
12025514
authored
3 years ago
by
stuebinm
Browse files
Options
Downloads
Patches
Plain Diff
fix group layer handling
we don't want to accidentally copy maps, whoopsie
parent
1734d1bd
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/CheckMap.hs
+22
-9
22 additions, 9 deletions
lib/CheckMap.hs
with
22 additions
and
9 deletions
lib/CheckMap.hs
+
22
−
9
View file @
12025514
...
@@ -105,15 +105,17 @@ runLinter config tiledmap depth = MapResult
...
@@ -105,15 +105,17 @@ runLinter config tiledmap depth = MapResult
checkThing
getter
checker
=
V
.
toList
.
V
.
map
runCheck
$
getter
tiledmap
checkThing
getter
checker
=
V
.
toList
.
V
.
map
runCheck
$
getter
tiledmap
where
runCheck
thing
=
runLintWriter
config
thing
depth
checker
where
runCheck
thing
=
runLintWriter
config
thing
depth
checker
-- | "inverts" a LintResult, i.e. groups it by lints instead of
-- | "inverts" a LintResult, i.e. groups it by lints instead of
-- layers / maps
-- layers / maps
invertThing
thing
=
M
.
unionsWith
(
<>
)
$
fmap
invertLintResult
thing
invertThing
thing
=
M
.
unionsWith
(
<>
)
$
fmap
invertLintResult
thing
adjustedMap
=
(
resultToAdjusted
generalResult
)
adjustedMap
=
(
resultToAdjusted
generalResult
)
{
tiledmapLayers
=
V
.
fromList
$
fmap
resultToAdjusted
layer
{
tiledmapLayers
=
V
.
fromList
,
tiledmapTilesets
=
V
.
fromList
.
fmap
resultToAdjusted
$
tileset
.
fmap
resultToAdjusted
$
take
(
length
(
tiledmapLayers
tiledmap
))
layer
,
tiledmapTilesets
=
V
.
fromList
.
fmap
resultToAdjusted
$
tileset
}
}
-- | Recursively checks a layer.
-- | Recursively checks a layer.
...
@@ -121,15 +123,26 @@ runLinter config tiledmap depth = MapResult
...
@@ -121,15 +123,26 @@ runLinter config tiledmap depth = MapResult
-- This is apparently necessary because someone thought it would be a good
-- This is apparently necessary because someone thought it would be a good
-- idea to have group layers, even if their entire semantics appear to be
-- idea to have group layers, even if their entire semantics appear to be
-- "they're group layers"; they don't seem to /do/ anything …
-- "they're group layers"; they don't seem to /do/ anything …
--
-- Note that this will flatten the layer structure and give them all back
-- in a single list, but the ones that were passed in will always be at
-- the head of the list.
checkLayerRec
::
LintConfig'
->
Int
->
[
Layer
]
->
[
LintResult
Layer
]
checkLayerRec
::
LintConfig'
->
Int
->
[
Layer
]
->
[
LintResult
Layer
]
checkLayerRec
config
depth
=
concatMap
$
\
parent
->
checkLayerRec
config
depth
layers
=
-- reordering to get the correct ones back up front
(
\
rs
->
fmap
fst
rs
<>
concatMap
snd
rs
)
-- map over all input layers
$
flip
fmap
layers
$
\
parent
->
case
layerLayers
parent
of
case
layerLayers
parent
of
-- not a group layer; just lint this one
Nothing
->
Nothing
->
[
runLintWriter
config
parent
depth
checkLayer
]
(
runLintWriter
config
parent
depth
checkLayer
,
[]
)
-- this is a group layer. Fun!
Just
sublayers
->
Just
sublayers
->
let
let
-- before linting, append the group's top-level name to that of sublayers
-- before linting, append the group's top-level name to that of sublayers
results
=
checkLayerRec
config
depth
$
sublayers
results
=
take
(
length
sublayers
)
$
checkLayerRec
config
depth
$
sublayers
<&>
\
l
->
l
{
layerName
=
layerName
parent
<>
"/"
<>
layerName
l
}
<&>
\
l
->
l
{
layerName
=
layerName
parent
<>
"/"
<>
layerName
l
}
-- get the original sublayer names
-- get the original sublayer names
names
=
fmap
layerName
sublayers
names
=
fmap
layerName
sublayers
...
@@ -141,7 +154,7 @@ checkLayerRec config depth = concatMap $ \parent ->
...
@@ -141,7 +154,7 @@ checkLayerRec config depth = concatMap $ \parent ->
names
results
names
results
}
}
)
depth
checkLayer
)
depth
checkLayer
in
result
:
results
in
(
result
,
results
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment