Skip to content

Instantly share code, notes, and snippets.

@rnagy
Created April 6, 2018 15:12
Show Gist options
  • Save rnagy/df6c3f5016eec705794669d30a536088 to your computer and use it in GitHub Desktop.
Save rnagy/df6c3f5016eec705794669d30a536088 to your computer and use it in GitHub Desktop.
diff --git a/src/checks.coffee b/src/checks.coffee
index 792032c..e538a9b 100644
--- a/src/checks.coffee
+++ b/src/checks.coffee
@@ -167,6 +167,10 @@ exports.json_array_format = (rules) ->
for r in rule
errmsg = "Arguments to #{i} in exec form must not contain single quotes on line #{r.line}"
for argument in r.arguments
+ try JSON.parse(argument)
+ catch e
+ return 'ok'
+
# Check if we're dealing with Array notation
if argument.match /^\[.*\]/
# Break the literal array into it's logical components
@@ -174,6 +178,7 @@ exports.json_array_format = (rules) ->
if not arg.trim().match /^(\[?(\s+)?\".*\"(\s+)?\]?)|(\[\])$/
utils.log 'ERROR', errmsg
return 'failed'
+
return 'ok'
# Ensure the exec form contains a balanced number of double quotes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment