Skip to content
Snippets Groups Projects
Commit 2ffe0630 authored by Sven G. Brönstrup's avatar Sven G. Brönstrup
Browse files

Did some of the desired changes

parent c0685792
Branches
No related tags found
1 merge request!1Extended scripts support
...@@ -228,9 +228,12 @@ checkLayer = do ...@@ -228,9 +228,12 @@ checkLayer = do
checkObjectProperty :: Object -> Property -> LintWriter Layer checkObjectProperty :: Object -> Property -> LintWriter Layer
checkObjectProperty obj p@(Property name _) = case name of checkObjectProperty obj p@(Property name _) = case name of
"url" -> do "url" -> do
unwrapURI (Proxy @"website") p unwrapURI' (Proxy @"website") p
(dependsOn . Link) (dependsOn . Link)
(const $ forbid "using \"url\" to open local html files is disallowed.") (const $ forbid "using \"url\" to open local html files is disallowed.")
-- | TODO: The uri should be rewritten if the unwrapURI' did add the wrapper
unless (objectType obj == "website") unless (objectType obj == "website")
$ complain "\"url\" can only be set for objects of type \"website\"" $ complain "\"url\" can only be set for objects of type \"website\""
"allowApi" -> forbidProperty name "allowApi" -> forbidProperty name
...@@ -257,7 +260,7 @@ checkObjectProperty obj p@(Property name _) = case name of ...@@ -257,7 +260,7 @@ checkObjectProperty obj p@(Property name _) = case name of
"door" -> do "door" -> do
isBool p isBool p
unless (objectType obj == "variable") $ unless (objectType obj == "variable") $
complain "Door variables must be of type \"variable\"" complain "the \"door\" property should only be set on objects of type \"variable\""
when (null (objectName obj) || objectName obj == Just mempty) $ when (null (objectName obj) || objectName obj == Just mempty) $
complain "Door variables objects must have a name given" complain "Door variables objects must have a name given"
...@@ -276,7 +279,7 @@ checkObjectProperty obj p@(Property name _) = case name of ...@@ -276,7 +279,7 @@ checkObjectProperty obj p@(Property name _) = case name of
"openSound" -> do "openSound" -> do
isString p isString p
unwrapURI (Proxy @"audio") p unwrapURI' (Proxy @"audio") p
(dependsOn . Link) (dependsOn . Link)
(dependsOn . Local) (dependsOn . Local)
...@@ -287,7 +290,7 @@ checkObjectProperty obj p@(Property name _) = case name of ...@@ -287,7 +290,7 @@ checkObjectProperty obj p@(Property name _) = case name of
"closeSound" -> do "closeSound" -> do
isString p isString p
unwrapURI (Proxy @"audio") p unwrapURI' (Proxy @"audio") p
(dependsOn . Link) (dependsOn . Link)
(dependsOn . Local) (dependsOn . Local)
...@@ -302,13 +305,13 @@ checkObjectProperty obj p@(Property name _) = case name of ...@@ -302,13 +305,13 @@ checkObjectProperty obj p@(Property name _) = case name of
"bell" -> do "bell" -> do
isBool p isBool p
unless (objectType obj == "variable") $ unless (objectType obj == "variable") $
complain "Bell variables must be of type \"variable\"" complain "the \"bell\" property should only be set on objects of type \"variable\""
when (null (objectName obj) || objectName obj == Just mempty) $ when (null (objectName obj) || objectName obj == Just mempty) $
complain "Bell variables objects must have a name given" complain "Bell variables objects must have a name given"
"bellSound" -> do "bellSound" -> do
isString p isString p
unwrapURI (Proxy @"audio") p unwrapURI' (Proxy @"audio") p
(dependsOn . Link) (dependsOn . Link)
(dependsOn . Local) (dependsOn . Local)
...@@ -317,7 +320,7 @@ checkObjectProperty obj p@(Property name _) = case name of ...@@ -317,7 +320,7 @@ checkObjectProperty obj p@(Property name _) = case name of
-- | Applies to doors and bells as well -- | Applies to doors and bells as well
"soundRadius" -> do "soundRadius" -> do
isInt p isInt p
-- requireAnyProperty "door" "bell" -- | maybe we should lint that this property is only used on door and bell variables
_ -> warn $ "unknown object property " <> prettyprint name <> "." _ -> warn $ "unknown object property " <> prettyprint name <> "."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment