diff --git a/docs/labs/assert.js b/docs/labs/assert.js index 04c28787..98851ae0 100644 --- a/docs/labs/assert.js +++ b/docs/labs/assert.js @@ -4,14 +4,14 @@ info = { present: "assert", text: "The whole point of this exercise is to NOT use `assert` as a way to validate input from untrusted users.", - "examples": [ + examples: [ [ "assert !bindingResult.hasErrors();\n" ] ] }, { absent: String.raw`^\s* if `, text: "Begin with `if` so you can return a result if there are errors.", - "examples": [ + examples: [ [ "return \"form\";" ] ] }, @@ -26,14 +26,14 @@ info = { present: String.raw`^\s*if\s*[^\(\s]`, text: "In Java, after the keyword `if` you must have an open left parenthesis. Conventionally there is one space between the `if` keyword and the open left parenthesis.", - "examples": [ + examples: [ [ "if bindingResult.hasErrors" ] ] }, { present: String.raw`^\s*if\s*\(\s*\!binding`, text: "You have an extraneous `!` (not operator). Use the expression if (bindingResult.hasErrors()) ...", - "examples": [ + examples: [ [ "if (!bindingResult.hasErrors())" ] ] }, diff --git a/docs/labs/input1.js b/docs/labs/input1.js index 36f50346..5af0ae82 100644 --- a/docs/labs/input1.js +++ b/docs/labs/input1.js @@ -4,14 +4,14 @@ info = { absent: ", $", text: "This is a parameter, it must end with a comma.", - "examples": [ + examples: [ [ " " ] ] }, { absent: String.raw`query \( ["'${BACKQUOTE}]id["'${BACKQUOTE}] \)`, text: "Add query(\"id\") to verify its value.", - "examples": [ + examples: [ [ "," ], [ " query()," ] ] @@ -19,14 +19,14 @@ info = { present: String.raw`query \( ["'${BACKQUOTE}]id["'${BACKQUOTE}] \) [^. ]`, text: "After query(\"id\") use a period to invoke a verification method.", - "examples": [ + examples: [ [ " query('id')," ] ] }, { present: "(isint|Isint|IsInt|ISINT)", text: "JavaScript is case-sensitive. Use isInt instead of the case you have.", - "examples": [ + examples: [ [ " query('id').isint()," ], [ " query('id').IsInt()," ] ] @@ -34,56 +34,56 @@ info = { absent: "isInt", text: "Use isInt to determine if the parameter is an integer.", - "examples": [ + examples: [ [ " query('id').," ] ] }, { present: String.raw` query \( ["'${BACKQUOTE}]id["'${BACKQUOTE}] \).*\([^)]*$`, text: "After query(\"id\") you have an ( but there's no matching ).", - "examples": [ + examples: [ [ " query('id').isInt(," ] ] }, { absent: String.raw`isInt \(.*\)`, text: "isInt should be followed by (...).", - "examples": [ + examples: [ [ " query('id').isInt," ] ] }, { present: String.raw`\{[^}]*$`, text: "You have started an object using { but there's no matching }.", - "examples": [ + examples: [ [ " query('id').isInt({)," ] ] }, { absent: String.raw`isInt \( \{.*\} \)`, text: "Inside the parenthesis of isInt() you should have an object like {...}.", - "examples": [ + examples: [ [ " query('id').isInt()," ] ] }, { absent: "min", text: "Use min: to specify a minimum value.", - "examples": [ + examples: [ [ " query('id').isInt({})," ] ] }, { absent: "max", text: "Use max: to specify a minimum value.", - "examples": [ + examples: [ [ " query('id').isInt({min: 1})," ] ] }, { present: "max.*min", text: "JavaScript allows hash entries to be in any order, but this can be confusing to humans. Conventionally minimum values are given before maximum values; please follow that convention.", - "examples": [ + examples: [ [ " query('id').isInt({max: 9999, min: 1})," ] ] } diff --git a/docs/labs/regex0.js b/docs/labs/regex0.js index 0b46d752..9bef0547 100644 --- a/docs/labs/regex0.js +++ b/docs/labs/regex0.js @@ -12,14 +12,14 @@ info = { present: "C", text: "Regexes are normally case-sensitive. Use a lowercase c.", - "examples": [ + examples: [ [ "C" ] ] }, { absent: "c", text: "If you are searching for \"cat\" you need to look for a \"c\"", - "examples": [ + examples: [ [ "x" ] ] }, @@ -29,22 +29,22 @@ info = }, { absent: "A", - "index": 1, + index: 1, text: "You need to mention A." }, { absent: "B", - "index": 1, + index: 1, text: "You need to mention B." }, { absent: String.raw`A(\+|A\*)`, - "index": 1, + index: 1, text: "Use \"A+\" to indicate \"one or more A\". You could also write \"AA*\"." }, { absent: String.raw`B(\+|B\*)`, - "index": 1, + index: 1, text: "Use \"B+\" to indicate \"one or more B\". You could also write \"BB*\"." } ], diff --git a/docs/labs/regex1.js b/docs/labs/regex1.js index 540f5be4..4ff53da5 100644 --- a/docs/labs/regex1.js +++ b/docs/labs/regex1.js @@ -4,42 +4,42 @@ info = { present: "/", text: "In JavaScript a constant regular expression is surrounded by forward slashes like /PATTERN/. However, for this exercise we only want the text inside the slashes (the pattern itself).", - "examples": [ + examples: [ [ "/" ] ] }, { present: "[\"'`]", text: "In this exercise we only want the regular expression pattern itself. There is no need to use any kind of quote mark.", - "examples": [ + examples: [ [ "'" ] ] }, { absent: String.raw`^\^`, text: "For input validation, start with '^' to indicate a full match.", - "examples": [ + examples: [ [ "(Y|N)" ] ] }, { present: String.raw`\\[Zz]`, text: "The ECMAScript (JavaScript) specification does not support \\Z or \\z.", - "examples": [ + examples: [ [ "^Y|N\\z" ] ] }, { absent: String.raw`\$$`, text: "For input validation, end with '$' to indicate a full match.", - "examples": [ + examples: [ [ "^(Y|N)" ] ] }, { absent: String.raw`[\|\[]`, text: "Consider using [YN], to match either a Y or an N.", - "examples": [ + examples: [ [ "^$" ] ] }, @@ -47,118 +47,118 @@ info = present: String.raw`\|`, absent: String.raw`\(`, text: "If you use \"|\" you must parentheses or the precedence will be wrong. For example, \"^A|B$\" accepts anything beginning with A, and it also accepts anything ending with B. That is not what you want.", - "examples": [ + examples: [ [ "^Y|N$" ] ] }, { present: " ", text: "Spaces normally match spaces in a regex. Do not use them in this case, because a space is not one of the allowed characters.", - "examples": [ + examples: [ [ "^[YN] $" ] ] }, { absent: String.raw`^\^`, - "index": 1, + index: 1, text: "For input validation, start with '^' to indicate a full match.", - "examples": [ + examples: [ [ "^[YN]$", "" ] ] }, { absent: String.raw`\$$`, - "index": 1, + index: 1, text: "For input validation, end with '$' to indicate a full match.", - "examples": [ + examples: [ [ "^[YN]$", "^" ] ] }, { absent: String.raw`\[A-Z\]`, - "index": 1, + index: 1, text: "You can use [A-Z] to match one uppercase Latin letter (A through Z).", - "examples": [ + examples: [ [ "^[YN]$", "^$" ] ] }, { present: String.raw`\^\[A-Z\]\*`, - "index": 1, + index: 1, text: "A \"*\" matches one or more, not one or more." }, { present: String.raw`\(`, - "index": 1, + index: 1, text: "You do not need parentheses to solve this problem." }, { absent: String.raw`(\[A-Z\]\+| \[A-Z\]\[A-Z\]\*)`, - "index": 1, + index: 1, text: "You can use [A-Z]+ to match one or more uppercase Latin letters.", - "examples": [ + examples: [ [ "^[YN]$", "^[A-Z]$" ] ] }, { present: "True", - "index": 2, + index: 2, text: "Regular expressions are case-sensitive by default; use \"true\"." }, { present: "False", - "index": 2, + index: 2, text: "Regular expressions are case-sensitive by default; use \"false\"." }, { absent: String.raw`\|`, - "index": 2, + index: 2, text: "Use \"|\" to express alternatives." }, { present: String.raw`^\^true\|false\$$`, - "index": 2, + index: 2, text: "No. This would match anything beginning with the term true, or anything ending with the term false. Use parenthesis." }, { present: String.raw`^\^false\|true\$$`, - "index": 2, + index: 2, text: "No. This would match anything beginning with the term false, or anything ending with the term true. Use parenthesis." }, { absent: String.raw`\(`, - "index": 2, + index: 2, text: "Use parentheses." }, { present: String.raw`\$`, - "index": 3, + index: 3, text: "This is Python, not ECMAScript (JavaScript). Use \\Z at the end, not $." }, { present: String.raw`\\z`, - "index": 3, + index: 3, text: "This is Python. Use \\Z at the end, not \\z." }, { absent: String.raw`^\\A`, - "index": 4, + index: 4, text: "This is Ruby. Use \\A at the beginning." }, { absent: String.raw`\\z$`, - "index": 4, + index: 4, text: "This is Ruby. Use \\z at the end." }, { absent: String.raw`\[A-Z\]`, - "index": 4, + index: 4, text: "Use [A-Z] to match one uppercase Latin letter." }, { present: String.raw`\[A-Z\](\*|\+)`, - "index": 4, + index: 4, text: "In this case we are only matching one letter, not many of them. Do not use \"*\" or \"+\" after [A-Z]." } ],