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
3f5096f3
Unverified
Commit
3f5096f3
authored
3 years ago
by
stuebinm
Browse files
Options
Downloads
Patches
Plain Diff
better lint messages
parent
1d2733c2
No related branches found
No related tags found
No related merge requests found
Pipeline
#8125
failed
3 years ago
Stage: build
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/Properties.hs
+10
-10
10 additions, 10 deletions
lib/Properties.hs
with
10 additions
and
10 deletions
lib/Properties.hs
+
10
−
10
View file @
3f5096f3
...
...
@@ -61,7 +61,7 @@ checkMap = do
checkMapProperty
::
Property
->
LintWriter
Tiledmap
checkMapProperty
(
Property
name
_value
)
=
case
name
of
"script"
->
isForbidden
_
->
complain
$
"unknown map property "
<>
name
_
->
complain
$
"unknown map property "
<>
prettyprint
name
where
-- | this property is forbidden and should not be used
isForbidden
=
forbid
$
"property "
<>
prettyprint
name
<>
" should not be used"
...
...
@@ -78,10 +78,10 @@ checkTileset = do
-- reject tilesets unsuitable for workadventure
unless
(
tilesetTilewidth
tileset
==
32
&&
tilesetTileheight
tileset
==
32
)
$
complain
$
"Tileset
"
<>
tilesetName
tileset
<>
"
must have tile size 32×32"
$
complain
"Tileset
s
must have tile size 32×32"
unless
(
tilesetImageheight
tileset
<
4096
&&
tilesetImagewidth
tileset
<
4096
)
$
warn
$
"Tileset
"
<>
tilesetName
tileset
<>
"
should not be larger than 4096×4096 pixels in total"
$
warn
"Tileset
s
should not be larger than 4096×4096 pixels in total"
-- TODO: check copyright!
requireProperty
"copyright"
...
...
@@ -134,7 +134,7 @@ checkLayerProperty p@(Property name _value) = case name of
"openWebsiteTrigger"
->
do
isString
p
unlessHasProperty
"openWebsiteTriggerMessage"
$
suggest
"set
\"
openWebsiteTriggerMessage
\"
to a custom message to overwrite the
generic
\"
press SPACE to open Website
\"
"
$
suggest
"set
\"
openWebsiteTriggerMessage
\"
to a custom message to overwrite the
default
\"
press SPACE to open Website
\"
"
requireProperty
"openWebsite"
"openWebsiteTriggerMessage"
->
do
isString
p
...
...
@@ -158,7 +158,7 @@ checkLayerProperty p@(Property name _value) = case name of
offersEntrypoint
$
layerName
layer
unwrapBool
p
$
\
case
True
->
pure
()
False
->
complain
"startLayer must be set to true"
False
->
complain
"property
\
"
startLayer
\"
must be set to true"
"silent"
->
do
isBool
p
uselessEmptyLayer
...
...
@@ -172,12 +172,12 @@ checkLayerProperty p@(Property name _value) = case name of
forbidEmptyLayer
=
do
layer
<-
askContext
when
(
layerIsEmpty
layer
)
$
complain
(
"property "
<>
name
<>
" should not be set on an empty layer"
)
$
complain
(
"property "
<>
prettyprint
name
<>
" should not be set on an empty layer"
)
-- | this layer is allowed, but also useless on a layer that contains no tiles
uselessEmptyLayer
=
do
layer
<-
askContext
when
(
layerIsEmpty
layer
)
$
warn
(
"property"
<>
name
<>
"
was
set on an empty layer
and is thereby
useless"
)
$
warn
(
"property
"
<>
prettyprint
name
<>
" set on an empty layer
is
useless"
)
...
...
@@ -232,7 +232,7 @@ containsProperty props name = any
unwrapString
::
Property
->
(
Text
->
LintWriter
a
)
->
LintWriter
a
unwrapString
(
Property
name
value
)
f
=
case
value
of
StrProp
str
->
f
str
_
->
complain
$
"type
mismatch in
property "
<>
name
<>
"
;
should be of type string"
_
->
complain
$
"type
error:
property "
<>
prettyprint
name
<>
" should be of type string"
-- | same as unwrapString, but also forbids http:// as prefix
unwrapLink
::
Property
->
(
Text
->
LintWriter
a
)
->
LintWriter
a
...
...
@@ -240,13 +240,13 @@ unwrapLink (Property name value) f = case value of
StrProp
str
->
if
"http://"
`
isPrefixOf
`
str
then
complain
"cannot access content via http; either use https or include it locally instead."
else
f
str
_
->
complain
$
"type
mismatch in
property "
<>
name
<>
"
;
should be of typ string"
_
->
complain
$
"type
error:
property "
<>
prettyprint
name
<>
" should be of typ
e
string
and contain a valid uri
"
-- | asserts that this property is a boolean, and unwraps it
unwrapBool
::
Property
->
(
Bool
->
LintWriter
a
)
->
LintWriter
a
unwrapBool
(
Property
name
value
)
f
=
case
value
of
BoolProp
b
->
f
b
_
->
complain
$
"type
mismatch in
property "
<>
name
<>
"
;
should be of type bool"
_
->
complain
$
"type
error:
property "
<>
prettyprint
name
<>
" should be of type bool"
unwrapPath
::
Text
->
(
RelPath
->
LintWriter
a
)
->
LintWriter
a
unwrapPath
str
f
=
case
parsePath
str
of
...
...
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