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
8fc10996
Commit
8fc10996
authored
3 years ago
by
stuebinm
Browse files
Options
Downloads
Patches
Plain Diff
config options: implement script-related options
parent
bb5277dc
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/LintConfig.hs
+2
-0
2 additions, 0 deletions
lib/LintConfig.hs
lib/Properties.hs
+13
-2
13 additions, 2 deletions
lib/Properties.hs
lib/Tiled2.hs
+5
-0
5 additions, 0 deletions
lib/Tiled2.hs
with
20 additions
and
2 deletions
lib/LintConfig.hs
+
2
−
0
View file @
8fc10996
...
@@ -38,6 +38,8 @@ data LintConfig f = LintConfig
...
@@ -38,6 +38,8 @@ data LintConfig f = LintConfig
-- ^ Maximum warn level allowed before the lint fails
-- ^ Maximum warn level allowed before the lint fails
,
configDontCopyAssets
::
HKD
f
Bool
,
configDontCopyAssets
::
HKD
f
Bool
-- ^ Don't copy map assets (mostly useful for development)
-- ^ Don't copy map assets (mostly useful for development)
,
configAllowScripts
::
HKD
f
Bool
-- ^ Allow defining custom scripts in maps
}
deriving
(
Generic
)
}
deriving
(
Generic
)
type
LintConfig'
=
LintConfig
Identity
type
LintConfig'
=
LintConfig
Identity
...
...
This diff is collapsed.
Click to expand it.
lib/Properties.hs
+
13
−
2
View file @
8fc10996
...
@@ -15,7 +15,7 @@ import Tiled2 (HasProperties (adjustProperties, getProperties),
...
@@ -15,7 +15,7 @@ import Tiled2 (HasProperties (adjustProperties, getProperties),
import
Util
(
layerIsEmpty
,
prettyprint
)
import
Util
(
layerIsEmpty
,
prettyprint
)
import
Data.Maybe
(
fromMaybe
)
import
Data.Maybe
(
fromMaybe
)
import
LintConfig
(
LintConfig
(
configAssemblyTag
))
import
LintConfig
(
LintConfig
(
..
))
import
LintWriter
(
LintWriter
,
adjust
,
askContext
,
askFileDepth
,
import
LintWriter
(
LintWriter
,
adjust
,
askContext
,
askFileDepth
,
complain
,
dependsOn
,
forbid
,
lintConfig
,
complain
,
dependsOn
,
forbid
,
lintConfig
,
offersEntrypoint
,
suggest
,
warn
)
offersEntrypoint
,
suggest
,
warn
)
...
@@ -62,7 +62,18 @@ checkMap = do
...
@@ -62,7 +62,18 @@ checkMap = do
-- longer function same as checkLayerProperty.
-- longer function same as checkLayerProperty.
checkMapProperty
::
Property
->
LintWriter
Tiledmap
checkMapProperty
::
Property
->
LintWriter
Tiledmap
checkMapProperty
(
Property
name
_value
)
=
case
name
of
checkMapProperty
(
Property
name
_value
)
=
case
name
of
"script"
->
isForbidden
"script"
->
do
-- this is kind of stupid, since if we also inject script this
-- will be overriden anyways, but it also doesn't really hurt I guess
-- TODO: perhaps include an explanation in the lint, or allow
-- exactly that one value?
lintConfig
configAllowScripts
>>=
\
case
False
->
isForbidden
True
->
pure
()
lintConfig
configScriptInject
>>=
\
case
Nothing
->
pure
()
Just
url
->
setProperty
"script"
url
_
->
complain
$
"unknown map property "
<>
prettyprint
name
_
->
complain
$
"unknown map property "
<>
prettyprint
name
where
where
-- | this property is forbidden and should not be used
-- | this property is forbidden and should not be used
...
...
This diff is collapsed.
Click to expand it.
lib/Tiled2.hs
+
5
−
0
View file @
8fc10996
...
@@ -332,6 +332,11 @@ instance HasProperties Tileset where
...
@@ -332,6 +332,11 @@ instance HasProperties Tileset where
adjustProperties
f
tileset
=
tileset
adjustProperties
f
tileset
=
tileset
{
tilesetProperties
=
f
(
getProperties
tileset
)
}
{
tilesetProperties
=
f
(
getProperties
tileset
)
}
instance
HasProperties
Tiledmap
where
getProperties
=
fromMaybe
[]
.
tiledmapProperties
adjustProperties
f
tiledmap
=
tiledmap
{
tiledmapProperties
=
f
(
getProperties
tiledmap
)
}
class
HasName
a
where
class
HasName
a
where
getName
::
a
->
Text
getName
::
a
->
Text
instance
HasName
Layer
where
instance
HasName
Layer
where
...
...
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