diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Properties.hs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/Properties.hs b/lib/Properties.hs index 78993ce..65782c8 100644 --- a/lib/Properties.hs +++ b/lib/Properties.hs @@ -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 "Tilesets 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 "Tilesets 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 type 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 |