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
edf0ac82
Unverified
Commit
edf0ac82
authored
3 years ago
by
stuebinm
Browse files
Options
Downloads
Patches
Plain Diff
re-enable dependency checking
parent
1f18a235
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/CheckMap.hs
+19
-19
19 additions, 19 deletions
lib/CheckMap.hs
lib/Properties.hs
+3
-2
3 additions, 2 deletions
lib/Properties.hs
with
22 additions
and
21 deletions
lib/CheckMap.hs
+
19
−
19
View file @
edf0ac82
...
...
@@ -21,15 +21,14 @@ import GHC.Generics (Generic)
import
Data.Aeson.Types
((
.=
))
import
LintWriter
(
LintWriter
,
askContext
,
filterLintLevel
,
invertLintResult
,
lintToDep
,
resultTo
Lint
s
,
runLintWriter
)
invertLintResult
,
lintToDep
,
resultTo
Dep
s
,
resultToLints
,
resultToOffers
,
runLintWriter
)
import
Properties
(
checkLayerProperty
,
checkMap
,
checkTileset
)
import
Tiled2
(
HasName
(
getName
),
HasProperties
(
getProperties
),
Layer
(
layerName
,
layerProperties
),
HasProperties
(
getProperties
),
Layer
,
LoadResult
(
..
),
Tiledmap
(
tiledmapLayers
,
tiledmapTilesets
),
Tileset
(
tilesetName
)
,
loadTiledmap
)
Tileset
,
loadTiledmap
)
import
Types
(
Dep
,
Hint
(
hintLevel
,
hintMsg
),
Level
(
..
),
Lint
(
..
),
hint
)
import
Util
(
PrettyPrint
(
prettyprint
),
prettyprint
)
...
...
@@ -51,8 +50,8 @@ instance ToJSON MapResult where
,
"tileset"
.=
CollectedLints
(
fmap
getName
<$>
mapresultTileset
res
)
,
"general"
.=
mapresultGeneral
res
-- TODO: not sure if these are necessary of even useful
,
"depends"
.=
mapresultDepends
res
,
"provides"
.=
mapresultProvides
res
--
, "depends" .= mapresultDepends res
--
, "provides" .= mapresultProvides res
]
newtype
CollectedLints
=
CollectedLints
(
Map
Hint
[
Text
])
...
...
@@ -85,23 +84,24 @@ loadAndLintMap path depth = loadTiledmap path >>= pure . \case
-- | lint a loaded map
runLinter
::
Tiledmap
->
Int
->
MapResult
runLinter
tiledmap
depth
=
MapResult
{
mapresultLayer
=
layer
'
,
mapresultTileset
=
tileset'
-- fromList
tileset
{
mapresultLayer
=
invertThing
layer
,
mapresultTileset
=
invertThing
tileset
,
mapresultGeneral
=
generalLints
,
mapresultDepends
=
--concatMap (resultToDeps . snd) layer
{-<>-}
mapMaybe
lintToDep
generalLints
--
<> concatMap
(
resultToDeps
. snd)
tileset
,
mapresultProvides
=
mempty
--
concatMap
(
resultToOffers
. snd)
layer
,
mapresultDepends
=
mapMaybe
lintToDep
generalLints
<>
concatMap
resultToDeps
layer
<>
concatMap
resultToDeps
tileset
,
mapresultProvides
=
concatMap
resultToOffers
layer
}
where
layer
'
=
M
.
unionsWith
(
<>
)
$
fmap
invertLintResult
l
ayer
tileset
'
=
M
.
unionsWith
(
<>
)
$
fmap
invertLintResult
t
ileset
layer
=
checkThing
tiledmapLayers
checkL
ayer
tileset
=
checkThing
tiledmapTilesets
checkT
ileset
layer
=
V
.
toList
.
V
.
map
runCheck
$
tiledmapLayers
tiledmap
where
runCheck
l
=
runLintWriter
l
depth
checkLayer
tileset
=
V
.
toList
.
V
.
map
runCheck
$
tiledmapTilesets
tiledmap
where
runCheck
l
=
runLintWriter
l
depth
(
checkTileset
l
)
checkThing
getter
checker
=
V
.
toList
.
V
.
map
runCheck
$
getter
tiledmap
where
runCheck
thing
=
runLintWriter
thing
depth
checker
-- | "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
$
runLintWriter
tiledmap
depth
checkMap
...
...
This diff is collapsed.
Click to expand it.
lib/Properties.hs
+
3
−
2
View file @
edf0ac82
...
...
@@ -70,8 +70,9 @@ checkMapProperty (Property name _value) = case name of
-- | check an embedded tile set.
--
-- Important to collect dependency files
checkTileset
::
Tileset
->
LintWriter
Tileset
checkTileset
tileset
=
do
checkTileset
::
LintWriter
Tileset
checkTileset
=
do
tileset
<-
askContext
-- TODO: can tilesets be non-local dependencies?
unwrapPath
(
tilesetImage
tileset
)
(
dependsOn
.
Local
)
...
...
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