diff --git a/change-notes/1.23/analysis-javascript.md b/change-notes/1.23/analysis-javascript.md index c8219fcc39b..bda32d3789a 100644 --- a/change-notes/1.23/analysis-javascript.md +++ b/change-notes/1.23/analysis-javascript.md @@ -42,3 +42,21 @@ ## Changes to QL libraries * `Expr.getDocumentation()` now handles chain assignments. + +## Removal of deprecated queries + +The following queries (deprecated since 1.17) are no longer available in the distribution: + +* Builtin redefined (js/builtin-redefinition) +* Inefficient method definition (js/method-definition-in-constructor) +* Bad parity check (js/incomplete-parity-check) +* Potentially misspelled property or variable name (js/wrong-capitalization) +* Unknown JSDoc tag (js/jsdoc/unknown-tag-type) +* Invalid JSLint directive (js/jslint/invalid-directive) +* Malformed JSLint directive (js/jslint/malformed-directive) +* Use of HTML comments (js/html-comment) +* Multi-line string literal (js/multi-line-string) +* Octal literal (js/octal-literal) +* Reserved word used as variable name (js/use-of-reserved-word) +* Trailing comma in array or object expressions (js/trailing-comma-in-array-or-object) +* Call to parseInt without radix (js/parseint-without-radix) diff --git a/javascript/config/suites/javascript/compatibility b/javascript/config/suites/javascript/compatibility index 10d92d51cd6..e69de29bb2d 100644 --- a/javascript/config/suites/javascript/compatibility +++ b/javascript/config/suites/javascript/compatibility @@ -1,13 +0,0 @@ -+ semmlecode-javascript-queries/Declarations/BuiltinRedefined.ql: /Maintainability/Declarations -+ semmlecode-javascript-queries/Declarations/InefficientMethodDefinition.ql: /Maintainability/Declarations -+ semmlecode-javascript-queries/Expressions/BadParityCheck.ql: /Correctness/Expressions -+ semmlecode-javascript-queries/Expressions/HapaxLegomenon.ql: /Correctness/Expressions -+ semmlecode-javascript-queries/JSDoc/UnknownTagType.ql: /Readability/JSDoc -+ semmlecode-javascript-queries/JSLint/InvalidJSLintDirective.ql: /Frameworks/JSLint -+ semmlecode-javascript-queries/JSLint/MalformedJSLintDirective.ql: /Frameworks/JSLint -+ semmlecode-javascript-queries/LanguageFeatures/HTMLComments.ql: /Maintainability/Language Features -+ semmlecode-javascript-queries/LanguageFeatures/MultilineStringLiteral.ql: /Readability/Language Features -+ semmlecode-javascript-queries/LanguageFeatures/ReservedWords.ql: /Maintainability/Language Features -+ semmlecode-javascript-queries/LanguageFeatures/TrailingComma.ql: /Correctness/Language Features -+ semmlecode-javascript-queries/LanguageFeatures/OctalLiteral.ql: /Maintainability/Language Features -+ semmlecode-javascript-queries/StandardLibrary/ParseIntRadix.ql: /Maintainability/Standard Library diff --git a/javascript/ql/src/Declarations/BuiltinRedefined.qhelp b/javascript/ql/src/Declarations/BuiltinRedefined.qhelp deleted file mode 100644 index f448c81ae7b..00000000000 --- a/javascript/ql/src/Declarations/BuiltinRedefined.qhelp +++ /dev/null @@ -1,37 +0,0 @@ - - - -

-Builtin functions and objects defined in the JavaScript standard library can be shadowed or redefined in user code. -This is confusing and makes code hard to understand, so it should be avoided. -

- -
- - -

-Refactor the code to avoid shadowing or redefinition. For example, if a local variable has the same name as a standard -library builtin, it should be renamed. -

- -
- - -

-In the following example, the user-defined function eval shadows the builtin function eval -defined in the standard library. It could be renamed evaluate to avoid confusion. -

- - - -
- - - -
  • Ecma International, ECMAScript Language Definition, 5.1 Edition, Section 15. ECMA, 2011.
  • - - -
    -
    diff --git a/javascript/ql/src/Declarations/BuiltinRedefined.ql b/javascript/ql/src/Declarations/BuiltinRedefined.ql deleted file mode 100644 index 327dfd9f06e..00000000000 --- a/javascript/ql/src/Declarations/BuiltinRedefined.ql +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @name Builtin redefined - * @description Standard library functions can be redefined, but this should be avoided - * since it makes code hard to read and maintain. - * @kind problem - * @problem.severity recommendation - * @id js/builtin-redefinition - * @tags maintainability - * @precision medium - * @deprecated This query is prone to false positives. Deprecated since 1.17. - */ - -import javascript -import Definitions - -/** - * Holds if `id` is a redefinition of a standard library function that is considered - * acceptable since it merely introduces a local alias to the standard function of - * the same name. - */ -predicate acceptableRedefinition(Identifier id) { - // function(x, y, undefined) { ... }(23, 42) - id.getName() = "undefined" and - exists(ImmediatelyInvokedFunctionExpr iife | - id = iife.getParameter(iife.getInvocation().getNumArgument()) - ) - or - // Date = global.Date - exists(AssignExpr assgn | - id = assgn.getTarget() and - id.getName() = assgn.getRhs().getUnderlyingValue().(PropAccess).getPropertyName() - ) - or - // var Date = global.Date - exists(VariableDeclarator decl | - id = decl.getBindingPattern() and - id.getName() = decl.getInit().getUnderlyingValue().(PropAccess).getPropertyName() - ) -} - -from DefiningIdentifier id, string name -where - not id.inExternsFile() and - name = id.getName() and - name - .regexpMatch("Object|Function|Array|String|Boolean|Number|Math|Date|RegExp|Error|" + - "NaN|Infinity|undefined|eval|parseInt|parseFloat|isNaN|isFinite|" + - "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent") and - not acceptableRedefinition(id) -select id, "Redefinition of " + name + "." diff --git a/javascript/ql/src/Declarations/InefficientMethodDefinition.qhelp b/javascript/ql/src/Declarations/InefficientMethodDefinition.qhelp deleted file mode 100644 index fcad95735be..00000000000 --- a/javascript/ql/src/Declarations/InefficientMethodDefinition.qhelp +++ /dev/null @@ -1,46 +0,0 @@ - - - -

    -Defining a method by assigning a closure to a property of the receiver object in the constructor -is inefficient, since a new closure is created for every instance. This wastes heap space and may -interfere with JIT compilation. -

    - -
    - - -

    -Assign the function to a property of the prototype object instead. That way, all instances share -the same closure. -

    - -
    - - -

    -In the following example, constructor Point defines method move by creating -a new closure and storing it in the move property of each new instance. Consequently, -p.move and q.move are different methods. -

    - - - -

    -It is better to instead define move on the prototype object Point.prototype -like this: -

    - - - -
    - - - -
  • Mozilla Developer Network: Inheritance and the prototype chain.
  • - - -
    -
    diff --git a/javascript/ql/src/Declarations/InefficientMethodDefinition.ql b/javascript/ql/src/Declarations/InefficientMethodDefinition.ql deleted file mode 100644 index fac9046e631..00000000000 --- a/javascript/ql/src/Declarations/InefficientMethodDefinition.ql +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @name Inefficient method definition - * @description Defining methods in the constructor (as opposed to adding them to the - * prototype object) is inefficient. - * @kind problem - * @problem.severity recommendation - * @id js/method-definition-in-constructor - * @tags efficiency - * maintainability - * @precision medium - * @deprecated This query is prone to false positives. Deprecated since 1.17. - */ - -import javascript -import semmle.javascript.RestrictedLocations - -/** - * Holds if `stmt` is of the form `this. = ;`. - */ -predicate methodDefinition(ExprStmt stmt, string name, Function method) { - exists(AssignExpr assgn, PropAccess pacc | - assgn = stmt.getExpr() and - pacc = assgn.getLhs() and - pacc.getBase() instanceof ThisExpr and - name = pacc.getPropertyName() and - method = assgn.getRhs() - ) -} - -from Function ctor, ExprStmt defn, string name, Function method -where - not ctor instanceof ImmediatelyInvokedFunctionExpr and - defn = ctor.getABodyStmt() and - methodDefinition(defn, name, method) and - // if the method captures a local variable of the constructor, it cannot - // easily be moved to the constructor object - not exists(Variable v | v.getScope() = ctor.getScope() | - v.getAnAccess().getContainer().getEnclosingContainer*() = method - ) -select defn.(FirstLineOf), - name + " should be added to the prototype object rather than to each instance." diff --git a/javascript/ql/src/Expressions/BadParityCheck.qhelp b/javascript/ql/src/Expressions/BadParityCheck.qhelp deleted file mode 100644 index d3a053150ff..00000000000 --- a/javascript/ql/src/Expressions/BadParityCheck.qhelp +++ /dev/null @@ -1,45 +0,0 @@ - - - -

    -Avoid using x % 2 === 1 or x % 2 > 0 to check whether a number -x is odd, or x % 2 !== 1 to check whether it is even. -Such code does not work for negative numbers: for example, -5 % 2 equals --1, not 1. -

    - -
    - - -

    -Consider using x % 2 !== 0 to check for odd parity and x % 2 === 0 -to check for even parity. -

    - -
    - - -

    -The following code snippet does not detect -9 as an odd number because -9 % 2 -is -1, not 1.

    - - - -

    -The check should be rewritten as follows: -

    - - - -
    - - - -
  • J. Bloch and N. Gafter, Java Puzzlers: Traps, Pitfalls, and Corner Cases, Puzzle 1. Addison-Wesley, 2005.
  • -
  • Ecma International, ECMAScript Language Definition, 5.1 Edition, Section 11.5.3. ECMA, 2011.
  • - - -
    -
    diff --git a/javascript/ql/src/Expressions/BadParityCheck.ql b/javascript/ql/src/Expressions/BadParityCheck.ql deleted file mode 100644 index 8b591a41763..00000000000 --- a/javascript/ql/src/Expressions/BadParityCheck.ql +++ /dev/null @@ -1,105 +0,0 @@ -/** - * @name Bad parity check - * @description Ensure that parity checks take negative numbers into account. - * @kind problem - * @problem.severity recommendation - * @id js/incomplete-parity-check - * @tags reliability - * correctness - * external/cwe/cwe-480 - * @precision low - * @deprecated This query is prone to false positives. Deprecated since 1.17. - */ - -import javascript - -/* - * The following predicates implement a simple analysis for identifying - * expressions that are guaranteed to only evaluate to non-negative numbers: - * - * - non-negative number literals - * - applications of (), ++, + to expressions known to be non-negative - * - references to local variables that are only assigned non-negative values, - * never decremented, and never subjected to any compound assignments except - * += where the rhs is known to be non-negative - * - * This is a greatest-fixpoint problem: if we have `x = 0`, `y = x`, `x = y`, - * we want to conclude that both `x` and `y` are non-negative. Hence we have - * to implement the analysis the other way around, as a conservative check - * for negativity. - */ - -/** - * Holds if `e` is an expression that is relevant for the maybe-negative analysis. - */ -predicate relevant(Expr e) { - // base case: left operands of `%` - exists(ModExpr me | e = me.getLeftOperand()) - or - // first inductive case: downward AST traversal - relevant(e.getParentExpr()) - or - // second inductive case: following variable assignments - exists(Variable v | relevant(v.getAnAccess()) | e = v.getAnAssignedExpr()) -} - -/** Holds if `e` could evaluate to a negative number. */ -predicate maybeNegative(Expr e) { - relevant(e) and - if exists(e.getIntValue()) - then e.getIntValue() < 0 - else - if e instanceof ParExpr - then maybeNegative(e.(ParExpr).getExpression()) - else - if e instanceof IncExpr - then maybeNegative(e.(IncExpr).getOperand()) - else - if e instanceof VarAccess - then maybeNegativeVar(e.(VarAccess).getVariable()) - else - if e instanceof AddExpr - then maybeNegative(e.(AddExpr).getAnOperand()) - else - // anything else is considered to possibly be negative - any() -} - -/** Holds if `v` could be assigned a negative number. */ -predicate maybeNegativeVar(Variable v) { - v.isGlobal() - or - v.isParameter() - or - // is v ever assigned a potentially negative value? - maybeNegative(v.getAnAssignedExpr()) - or - // is v ever decremented? - exists(DecExpr dec | dec.getOperand().getUnderlyingReference() = v.getAnAccess()) - or - // is v ever subject to a compound assignment other than +=, or to - // += with potentially negative rhs? - exists(CompoundAssignExpr assgn | assgn.getTarget() = v.getAnAccess() | - not assgn instanceof AssignAddExpr or - maybeNegative(assgn.getRhs()) - ) -} - -from Comparison cmp, ModExpr me, int num, string parity -where - cmp.getAnOperand().stripParens() = me and - cmp.getAnOperand().getIntValue() = num and - me.getRightOperand().getIntValue() = 2 and - maybeNegative(me.getLeftOperand()) and - ( - (cmp instanceof EqExpr or cmp instanceof StrictEqExpr) and - num = 1 and - parity = "oddness" - or - (cmp instanceof NEqExpr or cmp instanceof StrictNEqExpr) and - num = 1 and - parity = "evenness" - or - cmp instanceof GTExpr and num = 0 and parity = "oddness" - ) -select cmp, "Test for " + parity + " does not take negative numbers into account." diff --git a/javascript/ql/src/Expressions/HapaxLegomenon.qhelp b/javascript/ql/src/Expressions/HapaxLegomenon.qhelp deleted file mode 100644 index 106ecf7c273..00000000000 --- a/javascript/ql/src/Expressions/HapaxLegomenon.qhelp +++ /dev/null @@ -1,56 +0,0 @@ - - - -

    -In JavaScript, properties of objects do not have to be declared and can be dynamically added -and removed at runtime. Thus, if a property name is misspelled, this is not detected by the -compiler, and may lead to an error at runtime. The same problem occurs with misspelled -global variables. -

    - -

    -This rule flags property names and global variables that are mentioned only once, but where -a different capitalization of the same name is used in multiple other places, suggesting a typo. -

    - -
    - - -

    -Check whether the name has been misspelled. If the name is correct, consider using -a JSLint-style -/*property ...*/ directive to document the existence of this property, -or provide an externs file declaring the property. -

    - -
    - - -

    -The following code snippet contains two uses of the log method, but only -one use of the Log method. This suggests that Log may be a typo -for log. -

    - - - -

    -If the use of Log is, in fact, a typo, it should be corrected. Otherwise, a -properties directive can be introduced to document the fact that both -log and Log properties exist: -

    - - - -
    - - - -
  • JSLint: Property.
  • -
  • Google Closure Tools: Declaring externs.
  • - - -
    -
    diff --git a/javascript/ql/src/Expressions/HapaxLegomenon.ql b/javascript/ql/src/Expressions/HapaxLegomenon.ql deleted file mode 100644 index 8ac7c46890e..00000000000 --- a/javascript/ql/src/Expressions/HapaxLegomenon.ql +++ /dev/null @@ -1,91 +0,0 @@ -/** - * @name Potentially misspelled property or variable name - * @description A property or variable is only mentioned once, but there is one with the same name - * in different capitalization that is mentioned more than once, suggesting that this - * may be a typo. - * @kind problem - * @problem.severity warning - * @id js/wrong-capitalization - * @tags reliability - * @precision low - * @deprecated This query is prone to false positives. Deprecated since 1.17. - */ - -import javascript - -/** Gets the number of identifiers and string literals that refer to `name`. */ -int countOccurrences(string name) { - ( - exists(PropAccess pacc | name = pacc.getPropertyName()) or - exists(VarAccess acc | name = acc.getName()) - ) and - result = strictcount(Expr id | - id.(Identifier).getName() = name - or - // count string literals as well to capture meta-programming - id.getStringValue() = name - ) -} - -/** - * An access to an undeclared variable or property that is only referenced - * once in the entire program. - */ -abstract class Hapax extends @expr { - /** Gets the name of the accessed variable or property. */ - abstract string getName(); - - /** Gets a textual representation of this element. */ - string toString() { result = this.(Expr).toString() } -} - -/** - * An access to a property that is covered neither by a JSLint property declaration - * nor by an externs declaration, and that is only mentioned once in the entire program. - */ -class UndeclaredPropertyAccess extends Hapax, @dotexpr { - UndeclaredPropertyAccess() { - exists(string name | name = this.(DotExpr).getPropertyName() | - countOccurrences(name) = 1 and - not exists(JSLintProperties jslpd | jslpd.appliesTo(this) and jslpd.getAProperty() = name) and - not exists(ExternalMemberDecl emd | emd.getProperty() = this) - ) - } - - override string getName() { result = this.(DotExpr).getPropertyName() } -} - -/** - * An access to a global variable that is neither declared nor covered by a linter - * directive, and that is only mentioned once in the entire program. - */ -class UndeclaredGlobal extends Hapax, @varaccess { - UndeclaredGlobal() { - exists(GlobalVariable gv, string name | this = gv.getAnAccess() and name = gv.getName() | - countOccurrences(name) = 1 and - not exists(Linting::GlobalDeclaration glob | glob.declaresGlobalForAccess(this)) and - not exists(gv.getADeclaration()) - ) - } - - override string getName() { result = this.(VarAccess).getName() } -} - -/** - * Gets the number of occurrences of `m`, which is the same as `hapax` - * except for capitalization, ensuring that it occurs at least twice. - */ -int candidateSpellingCount(Hapax hapax, string m) { - exists(string n | n = hapax.getName() | - m.toLowerCase() = n.toLowerCase() and - m != n and - result = countOccurrences(m) and - result > 1 - ) -} - -from Hapax hapax, string n, string m -where - n = hapax.getName() and - candidateSpellingCount(hapax, m) = max(candidateSpellingCount(hapax, _)) -select hapax.(Expr), "'" + n + "' is mentioned only once; it may be a typo for '" + m + "'." diff --git a/javascript/ql/src/JSDoc/UnknownTagType.qhelp b/javascript/ql/src/JSDoc/UnknownTagType.qhelp deleted file mode 100644 index 0ff16ca28b3..00000000000 --- a/javascript/ql/src/JSDoc/UnknownTagType.qhelp +++ /dev/null @@ -1,38 +0,0 @@ - - - -

    -Non-standard JSDoc tags are undesirable, since JSDoc-processing tools will either ignore -them or treat them as plain text. -

    - -
    - - -

    -Check whether the tag name is misspelled, or consult the JSDoc documentation to find out -what standard tags are available. -

    - -
    - - -

    -In the following example, the constructor Message has a JSDoc comment describing -its parameters, but the second @param tag has been misspelled as -@parma. -

    - - - -
    - - - -
  • Use JSDoc: Tag Dictionary.
  • - - -
    -
    diff --git a/javascript/ql/src/JSDoc/UnknownTagType.ql b/javascript/ql/src/JSDoc/UnknownTagType.ql deleted file mode 100644 index c30e9dd688a..00000000000 --- a/javascript/ql/src/JSDoc/UnknownTagType.ql +++ /dev/null @@ -1,139 +0,0 @@ -/** - * @name Unknown JSDoc tag - * @description A JSDoc tag with a non-standard tag type will either be ignored or treated as plain - * text by JSDoc-processing tools. - * @kind problem - * @problem.severity recommendation - * @id js/jsdoc/unknown-tag-type - * @tags maintainability - * readability - * documentation - * @precision low - * @deprecated This query is prone to false positives. Deprecated since 1.17. - */ - -import javascript - -/** Holds if `tp` is a standard tag type. */ -predicate knownTagType(string tp) { - tp = "abstract" or - tp = "access" or - tp = "alias" or - tp = "api" or - tp = "arg" or - tp = "argument" or - tp = "augments" or - tp = "author" or - tp = "borrows" or - tp = "bug" or - tp = "callback" or - tp = "category" or - tp = "class" or - tp = "classdesc" or - tp = "const" or - tp = "constant" or - tp = "constructor" or - tp = "constructs" or - tp = "copyright" or - tp = "default" or - tp = "defaultvalue" or - tp = "define" or - tp = "depend" or - tp = "depends" or - tp = "deprecated" or - tp = "desc" or - tp = "description" or - tp = "dict" or - tp = "emits" or - tp = "enum" or - tp = "event" or - tp = "example" or - tp = "exception" or - tp = "export" or - tp = "exports" or - tp = "expose" or - tp = "extends" or - tp = "external" or - tp = "externs" or - tp = "field" or - tp = "file" or - tp = "fileoverview" or - tp = "final" or - tp = "fires" or - tp = "flow" or - tp = "func" or - tp = "function" or - tp = "global" or - tp = "host" or - tp = "ignore" or - tp = "implements" or - tp = "implicitCast" or - tp = "inheritDoc" or - tp = "inner" or - tp = "interface" or - tp = "internal" or - tp = "instance" or - tp = "kind" or - tp = "lends" or - tp = "license" or - tp = "link" or - tp = "member" or - tp = "memberof" or - tp = "memberOf" or - tp = "method" or - tp = "mixes" or - tp = "mixin" or - tp = "modifies" or - tp = "module" or - tp = "modName" or - tp = "mods" or - tp = "name" or - tp = "namespace" or - tp = "ngInject" or - tp = "noalias" or - tp = "nocompile" or - tp = "nosideeffects" or - tp = "note" or - tp = "override" or - tp = "overview" or - tp = "owner" or - tp = "package" or - tp = "param" or - tp = "preserve" or - tp = "preserveTry" or - tp = "private" or - tp = "prop" or - tp = "property" or - tp = "protected" or - tp = "providesModule" or - tp = "public" or - tp = "readonly" or - tp = "requires" or - tp = "returns" or - tp = "return" or - tp = "see" or - tp = "since" or - tp = "static" or - tp = "struct" or - tp = "summary" or - tp = "supported" or - tp = "suppress" or - tp = "template" or - tp = "this" or - tp = "throws" or - tp = "todo" or - tp = "tutorial" or - tp = "type" or - tp = "typedef" or - tp = "var" or - tp = "variation" or - tp = "version" or - tp = "virtual" or - tp = "visibility" or - tp = "wizaction" or - tp = "wizmodule" -} - -from JSDocTag tag -where not knownTagType(tag.getTitle()) -select tag, "Unknown tag type '" + tag.getTitle() + "'." diff --git a/javascript/ql/src/JSLint/InvalidJSLintDirective.qhelp b/javascript/ql/src/JSLint/InvalidJSLintDirective.qhelp deleted file mode 100644 index a157a6926c1..00000000000 --- a/javascript/ql/src/JSLint/InvalidJSLintDirective.qhelp +++ /dev/null @@ -1,26 +0,0 @@ - - - -

    -JSLint directives must not start with a space. For example, /* global window*/ -is not a valid directive, and will not be recognized by JSLint. -

    - -
    - - -

    -Remove the space: /*global window*/. -

    - -
    - - - -
  • JSLint: JSLint Help.
  • - - -
    -
    diff --git a/javascript/ql/src/JSLint/InvalidJSLintDirective.ql b/javascript/ql/src/JSLint/InvalidJSLintDirective.ql deleted file mode 100644 index f5a7a73d6fb..00000000000 --- a/javascript/ql/src/JSLint/InvalidJSLintDirective.ql +++ /dev/null @@ -1,21 +0,0 @@ -/** - * @name Invalid JSLint directive - * @description A JSLint directive that has whitespace characters before the - * directive name is not recognized by JSLint. - * @kind problem - * @problem.severity recommendation - * @id js/jslint/invalid-directive - * @tags maintainability - * @precision medium - * @deprecated JSLint is rarely used any more. Deprecated since 1.17. - */ - -import javascript - -from SlashStarComment c -where - // use possessive quantifiers '*+' and '++' to avoid backtracking - c - .getText() - .regexpMatch("\\s+(global|properties|property|jslint)\\s(\\s*+[a-zA-Z$_][a-zA-Z0-9$_]*+(\\s*+:\\s*+\\w++)?\\s*+,?)++\\s*") -select c, "JSLint directives must not have whitespace characters before the directive name." diff --git a/javascript/ql/src/JSLint/MalformedJSLintDirective.qhelp b/javascript/ql/src/JSLint/MalformedJSLintDirective.qhelp deleted file mode 100644 index 62ac5853931..00000000000 --- a/javascript/ql/src/JSLint/MalformedJSLintDirective.qhelp +++ /dev/null @@ -1,49 +0,0 @@ - - - -

    -JSLint directives must consist of a comma-separated list of flags, where each flag -can optionally be followed by a colon and a value. The value may either be a number -or a Boolean (that is, 'true' or 'false'). Directives must not contain other -characters such as '*', which some editors may automatically insert after every line -break when editing a block comment. -

    - -
    - - -

    -Insert commas where necessary and remove stray characters. -

    - -
    - - -

    -For example, /*jslint nomen:true vars:true*/ is not a well-formed -JSLint directive; it should be replaced by /*jslint nomen:true, vars:true*/. -

    - -

    -This is another example of a malformed JSLint directive: -

    - - - -

    -It should be fixed as follows: -

    - - - -
    - - - -
  • JSLint: JSLint Help.
  • - - -
    -
    diff --git a/javascript/ql/src/JSLint/MalformedJSLintDirective.ql b/javascript/ql/src/JSLint/MalformedJSLintDirective.ql deleted file mode 100644 index bf93cf75606..00000000000 --- a/javascript/ql/src/JSLint/MalformedJSLintDirective.ql +++ /dev/null @@ -1,26 +0,0 @@ -/** - * @name Malformed JSLint directive - * @description A malformed JSLint directive will be rejected by JSLint, and may be either - * rejected or ignored by other tools. - * @kind problem - * @problem.severity recommendation - * @id js/jslint/malformed-directive - * @tags maintainability - * @precision medium - * @deprecated JSLint is rarely used any more. Deprecated since 1.17. - */ - -import javascript - -from JSLintDirective dir, string flag, string flags, string directive -where - // a flag, optionally followed by a colon and a value, where the value may be - // a Boolean or a number - flag = "[a-zA-Z$_][a-zA-Z0-9$_]*(\\s*:\\s*(true|false|\\d+))?" and - // a non-empty, comma-separated list of flags - flags = "(" + flag + "\\s*,\\s*)*" + flag and - // a word (which is the directive's name), followed by a possibly empty list of flags - // note that there may be trailing whitespace, but no leading whitespace - directive = "\\s*\\w+\\s+(" + flags + ")?\\s*" and - not dir.getText().regexpMatch(directive) -select dir, "Malformed JSLint directive." diff --git a/javascript/ql/src/LanguageFeatures/HTMLComments.qhelp b/javascript/ql/src/LanguageFeatures/HTMLComments.qhelp deleted file mode 100644 index c0e5d16793e..00000000000 --- a/javascript/ql/src/LanguageFeatures/HTMLComments.qhelp +++ /dev/null @@ -1,42 +0,0 @@ - - - -

    -HTML comments are a technique for hiding JavaScript code from browsers that do not interpret script -tags. Since all popular browsers have supported script tags for many years, this precaution is -not needed any more. -

    - -
    - - -

    -Remove all HTML comments. -

    - -
    - - -

    -The following code block uses HTML comments to hide the script block from ancient browsers. -

    - - - -

    -Since such browsers are no longer widely used, the comments should be removed: -

    - - - -
    - - - -
  • JavaScript Toolbox: JavaScript Best Practices.
  • - - -
    -
    diff --git a/javascript/ql/src/LanguageFeatures/HTMLComments.ql b/javascript/ql/src/LanguageFeatures/HTMLComments.ql deleted file mode 100644 index 67195c7bead..00000000000 --- a/javascript/ql/src/LanguageFeatures/HTMLComments.ql +++ /dev/null @@ -1,18 +0,0 @@ -/** - * @name Use of HTML comments - * @description HTML-style comments are not a standard ECMAScript feature and should be avoided. - * @kind problem - * @problem.severity recommendation - * @id js/html-comment - * @tags maintainability - * language-features - * external/cwe/cwe-758 - * @precision low - * @deprecated HTML comments are recognized in the standard as an additional feature supported by - * web browsers. Deprecated since 1.17. - */ - -import javascript - -from HtmlLineComment c -select c, "Do not use HTML comments." diff --git a/javascript/ql/src/LanguageFeatures/MultilineStringLiteral.qhelp b/javascript/ql/src/LanguageFeatures/MultilineStringLiteral.qhelp deleted file mode 100644 index abd069a6f85..00000000000 --- a/javascript/ql/src/LanguageFeatures/MultilineStringLiteral.qhelp +++ /dev/null @@ -1,40 +0,0 @@ - - - -

    -Multi-line string literals are not supported on all platforms, and thus should be avoided. -

    - -
    - - -

    -Replace multi-line string literals by multiple strings concatenated with the + operator. -

    - -
    - - -

    -The following example contains a string literal spanning three lines: -

    - - - -

    -It should be rewritten like this: -

    - - - -
    - - - -
  • Ecma International, ECMAScript Language Definition, 5.1 Edition, Section 7.8.4. ECMA, 2011.
  • - - -
    -
    diff --git a/javascript/ql/src/LanguageFeatures/MultilineStringLiteral.ql b/javascript/ql/src/LanguageFeatures/MultilineStringLiteral.ql deleted file mode 100644 index 3da685f0ef1..00000000000 --- a/javascript/ql/src/LanguageFeatures/MultilineStringLiteral.ql +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @name Multi-line string literal - * @description Multi-line string literals are non-standard and hard to read, and should be avoided. - * @kind problem - * @problem.severity recommendation - * @id js/multi-line-string - * @tags maintainability - * external/cwe/cwe-758 - * @precision low - * @deprecated Multi-line string literals are now a standard language feature. Deprecated since 1.17. - */ - -import javascript - -from StringLiteral sl, Location l -where - l = sl.getLocation() and - l.getStartLine() != l.getEndLine() -select sl, "Avoid multi-line string literals." diff --git a/javascript/ql/src/LanguageFeatures/OctalLiteral.qhelp b/javascript/ql/src/LanguageFeatures/OctalLiteral.qhelp deleted file mode 100644 index b9d8f779ef5..00000000000 --- a/javascript/ql/src/LanguageFeatures/OctalLiteral.qhelp +++ /dev/null @@ -1,40 +0,0 @@ - - - -

    -Integer literals starting with the digit 0 may be interpreted as octal numbers by some platforms -but not others, and thus should be avoided. This does not make a difference for the literal 0 -itself. -

    - -
    - - -

    -If the literal was meant to be octal, convert it to a decimal or hexadecimal number. Otherwise, remove -the leading zero. -

    - -
    - - -

    -The following example uses the literal 012, which some platforms will interpret as an octal -encoding of the decimal number 10, while others will interpret it as the decimal number -12. Depending on the desired interpretation, it should be replaced with either 10 -or 12. -

    - - - -
    - - - -
  • Ecma International, ECMAScript Language Definition, 5.1 Edition, Annex B.1.1. ECMA, 2011.
  • - - -
    -
    diff --git a/javascript/ql/src/LanguageFeatures/OctalLiteral.ql b/javascript/ql/src/LanguageFeatures/OctalLiteral.ql deleted file mode 100644 index a09406579d5..00000000000 --- a/javascript/ql/src/LanguageFeatures/OctalLiteral.ql +++ /dev/null @@ -1,17 +0,0 @@ -/** - * @name Octal literal - * @description Octal numeric literals are a platform-specific extension and should not be used. - * @kind problem - * @problem.severity recommendation - * @id js/octal-literal - * @tags portability - * external/cwe/cwe-758 - * @precision low - * @deprecated This query is prone to false positives. Deprecated since 1.17. - */ - -import javascript - -from NumberLiteral nl -where nl.getRawValue().regexpMatch("0\\d+") -select nl, "Do not use octal literals." diff --git a/javascript/ql/src/LanguageFeatures/ReservedWords.qhelp b/javascript/ql/src/LanguageFeatures/ReservedWords.qhelp deleted file mode 100644 index faf33ccf0fe..00000000000 --- a/javascript/ql/src/LanguageFeatures/ReservedWords.qhelp +++ /dev/null @@ -1,37 +0,0 @@ - - - -

    -The ECMAScript standard defines a list of future keywords that should not be used as identifiers. -While they may be accepted by current implementations, they may no longer be supported in the future, -so it is best not to rely on them. -

    - -
    - - -

    -Rename the identifier in question. -

    - -
    - - -

    -In the following code snippet, package is used as a variable name. Since package -is a future reserved word, the variable should be renamed, for instance to pkg. -

    - - - -
    - - - -
  • Ecma International, ECMAScript Language Definition, 5.1 Edition, Section 7.6.1.2. ECMA, 2011.
  • - - -
    -
    diff --git a/javascript/ql/src/LanguageFeatures/ReservedWords.ql b/javascript/ql/src/LanguageFeatures/ReservedWords.ql deleted file mode 100644 index 3cd45a2d7ad..00000000000 --- a/javascript/ql/src/LanguageFeatures/ReservedWords.ql +++ /dev/null @@ -1,24 +0,0 @@ -/** - * @name Reserved word used as variable name - * @description Future reserved words should not be used as variable names. - * @kind problem - * @problem.severity recommendation - * @id js/use-of-reserved-word - * @tags maintainability - * language-features - * @precision very-high - * @deprecated This is no longer a problem with modern browsers. Deprecated since 1.17. - */ - -import javascript - -from Identifier id -where - id - .getName() - .regexpMatch("class|const|enum|export|extends|import|super|implements|interface|let|package|private|protected|public|static|yield") and - not exists(DotExpr de | id = de.getProperty()) and - not exists(Property prop | id = prop.getNameExpr()) and - // exclude JSX attribute names - not exists(JSXElement e | id = e.getAnAttribute().getNameExpr()) -select id, "Identifier name is a reserved word." diff --git a/javascript/ql/src/LanguageFeatures/TrailingComma.qhelp b/javascript/ql/src/LanguageFeatures/TrailingComma.qhelp deleted file mode 100644 index a1e2f5e075a..00000000000 --- a/javascript/ql/src/LanguageFeatures/TrailingComma.qhelp +++ /dev/null @@ -1,37 +0,0 @@ - - - -

    -The ECMAScript standard allows trailing commas in array and object literals which are ignored. However, -older versions of Internet Explorer do not recognize this syntax. Moreover, it can lead to confusion -when used in array literals, since spurious commas other than the last one are not ignored but give rise -to additional undefined array elements. For these reasons, trailing commas should always be avoided. -

    - -
    - - -

    -Remove the trailing comma. -

    - -
    - - -

    -The following code snippet shows an object literal with a trailing comma, which should be removed. -

    - - - -
    - - - -
  • Ecma International, ECMAScript Language Definition, 5.1 Edition, Sections 11.1.4 and 11.1.5. ECMA, 2011.
  • - - -
    -
    diff --git a/javascript/ql/src/LanguageFeatures/TrailingComma.ql b/javascript/ql/src/LanguageFeatures/TrailingComma.ql deleted file mode 100644 index e517f509fe7..00000000000 --- a/javascript/ql/src/LanguageFeatures/TrailingComma.ql +++ /dev/null @@ -1,37 +0,0 @@ -/** - * @name Trailing comma in array or object expressions - * @description Trailing commas in array and object expressions are interpreted differently - * by different browsers and should be avoided. - * @kind problem - * @problem.severity recommendation - * @id js/trailing-comma-in-array-or-object - * @tags portability - * external/cwe/cwe-758 - * @precision low - * @deprecated This is no longer a problem with modern browsers. Deprecated since 1.17. - */ - -import javascript - -/** An array or object expression. */ -class ArrayOrObjectExpr extends Expr { - ArrayOrObjectExpr() { - this instanceof ArrayExpr or - this instanceof ObjectExpr - } - - /** Holds if this array or object expression has a trailing comma. */ - predicate hasTrailingComma() { - this.(ArrayExpr).hasTrailingComma() or - this.(ObjectExpr).hasTrailingComma() - } - - /** Gets a short description of this expression. */ - string getShortName() { - if this instanceof ArrayExpr then result = "array expression" else result = "object expression" - } -} - -from ArrayOrObjectExpr e -where e.hasTrailingComma() -select e.getLastToken().getPreviousToken(), "Trailing comma in " + e.getShortName() + "." diff --git a/javascript/ql/src/StandardLibrary/ParseIntRadix.qhelp b/javascript/ql/src/StandardLibrary/ParseIntRadix.qhelp deleted file mode 100644 index 92135e04102..00000000000 --- a/javascript/ql/src/StandardLibrary/ParseIntRadix.qhelp +++ /dev/null @@ -1,51 +0,0 @@ - - - -

    -On some platforms, the builtin function parseInt parses strings starting with the digit -0 as octal values (unless an explicit radix is provided). This can lead to unexpected -results when parsing decimal numbers that may be zero-padded, such as dates. -

    - -
    - - -

    -Provide an explicit radix as the second parameter to parseInt. -

    - -
    - - -

    -In the following example, parseInt is used to convert the contents of a field in an HTML -form to a number: -

    - - - -

    -Now assume that a user has entered a zero-padded decimal number, say 09, into the form. -Since the first digit is a zero, older versions of parseInt interpret this value as an -octal number. When they then encounter 9 (which is not an octal digit), they will stop -parsing and discard the rest of the string, returning the value 0, which is probably not -what was expected. -

    - -

    -To avoid this problem, an explicit radix parameter should be parsed as follows: -

    - - - -
    - - - -
  • D. Crockford, JavaScript: The Good Parts, Appendix A.7. O'Reilly, 2008.
  • - - -
    -
    diff --git a/javascript/ql/src/StandardLibrary/ParseIntRadix.ql b/javascript/ql/src/StandardLibrary/ParseIntRadix.ql deleted file mode 100644 index 409909d45a2..00000000000 --- a/javascript/ql/src/StandardLibrary/ParseIntRadix.ql +++ /dev/null @@ -1,21 +0,0 @@ -/** - * @name Call to parseInt without radix - * @description Calls to the 'parseInt' function should always specify a radix to avoid accidentally - * parsing a number as octal. - * @kind problem - * @problem.severity recommendation - * @id js/parseint-without-radix - * @tags reliability - * maintainability - * external/cwe/cwe-676 - * @precision very-high - * @deprecated This is no longer a problem with modern browsers. Deprecated since 1.17. - */ - -import javascript - -from DataFlow::CallNode parseInt -where - parseInt = DataFlow::globalVarRef("parseInt").getACall() and - parseInt.getNumArgument() = 1 -select parseInt, "Missing radix parameter." diff --git a/javascript/ql/test/query-tests/Declarations/BuiltinRedefined/BuiltinRedefined.expected b/javascript/ql/test/query-tests/Declarations/BuiltinRedefined/BuiltinRedefined.expected deleted file mode 100644 index 4223690fdba..00000000000 --- a/javascript/ql/test/query-tests/Declarations/BuiltinRedefined/BuiltinRedefined.expected +++ /dev/null @@ -1,7 +0,0 @@ -| builtinRedefined.js:1:1:1:4 | eval | Redefinition of eval. | -| builtinRedefined.js:2:3:2:6 | eval | Redefinition of eval. | -| builtinRedefined.js:3:5:3:8 | eval | Redefinition of eval. | -| builtinRedefined.js:4:12:4:15 | eval | Redefinition of eval. | -| builtinRedefined.js:5:18:5:21 | eval | Redefinition of eval. | -| builtinRedefined.js:8:1:8:6 | Object | Redefinition of Object. | -| builtinRedefined.js:10:12:10:20 | undefined | Redefinition of undefined. | \ No newline at end of file diff --git a/javascript/ql/test/query-tests/Declarations/BuiltinRedefined/BuiltinRedefined.qlref b/javascript/ql/test/query-tests/Declarations/BuiltinRedefined/BuiltinRedefined.qlref deleted file mode 100644 index d0bf1d1189c..00000000000 --- a/javascript/ql/test/query-tests/Declarations/BuiltinRedefined/BuiltinRedefined.qlref +++ /dev/null @@ -1 +0,0 @@ -Declarations/BuiltinRedefined.ql diff --git a/javascript/ql/test/query-tests/Declarations/BuiltinRedefined/builtinRedefined.js b/javascript/ql/test/query-tests/Declarations/BuiltinRedefined/builtinRedefined.js deleted file mode 100644 index 31cd9b130a0..00000000000 --- a/javascript/ql/test/query-tests/Declarations/BuiltinRedefined/builtinRedefined.js +++ /dev/null @@ -1,14 +0,0 @@ -eval = 42; -++eval; -var eval; -function x(eval) { } -var y = function eval() { }; -eval(""); - -Object = function(){}; - -function f(undefined) {} -(function f(undefined){}()); - -Date = this.Date; -var Math = this.Math; \ No newline at end of file diff --git a/javascript/ql/test/query-tests/Declarations/BuiltinRedefined/externs.js b/javascript/ql/test/query-tests/Declarations/BuiltinRedefined/externs.js deleted file mode 100644 index c9f7ce90e10..00000000000 --- a/javascript/ql/test/query-tests/Declarations/BuiltinRedefined/externs.js +++ /dev/null @@ -1,3 +0,0 @@ -Object = function(){}; - -//semmle-extractor-options: --externs \ No newline at end of file diff --git a/javascript/ql/test/query-tests/Declarations/InefficientMethodDefinition/InefficientMethodDefinition.expected b/javascript/ql/test/query-tests/Declarations/InefficientMethodDefinition/InefficientMethodDefinition.expected deleted file mode 100644 index 05e426d8a70..00000000000 --- a/javascript/ql/test/query-tests/Declarations/InefficientMethodDefinition/InefficientMethodDefinition.expected +++ /dev/null @@ -1 +0,0 @@ -| tst.js:6:5:6:28 | this.di ... \\n }; | dist should be added to the prototype object rather than to each instance. | diff --git a/javascript/ql/test/query-tests/Declarations/InefficientMethodDefinition/InefficientMethodDefinition.qlref b/javascript/ql/test/query-tests/Declarations/InefficientMethodDefinition/InefficientMethodDefinition.qlref deleted file mode 100644 index 4c3e106244a..00000000000 --- a/javascript/ql/test/query-tests/Declarations/InefficientMethodDefinition/InefficientMethodDefinition.qlref +++ /dev/null @@ -1 +0,0 @@ -Declarations/InefficientMethodDefinition.ql \ No newline at end of file diff --git a/javascript/ql/test/query-tests/Declarations/InefficientMethodDefinition/tst.js b/javascript/ql/test/query-tests/Declarations/InefficientMethodDefinition/tst.js deleted file mode 100644 index becb22103d8..00000000000 --- a/javascript/ql/test/query-tests/Declarations/InefficientMethodDefinition/tst.js +++ /dev/null @@ -1,53 +0,0 @@ -function Point(x, y) { - this.x = x; - this.y = y; - - // NOT OK - this.dist = function() { - return Math.sqrt(this.x*this.x + this.y*this.y); - }; - - // OK - this.getOriginalX = function() { - return x; - }; - - // OK - this.getOriginalXGetter = function() { - return function() { - return x; - }; - }; - - // OK - this.getOtherOriginalXGetter = function() { - function getter() { - return x; - } - - return getter; - }; - - if (x === 0) - // OK - this.dist = function() { - return y; - }; - - var o = {}; - // OK - o.f = function() { return 23; }; -} - -// OK -var o = new(function() { - this.f = function() { return 42 }; -}); - -// OK -(function() { - this.move = function(dx, dy) { - this.x += dx; - this.y += dy; - }; -}).call(Point.prototype); \ No newline at end of file diff --git a/javascript/ql/test/query-tests/Expressions/BadParityCheck/BadParityCheck.expected b/javascript/ql/test/query-tests/Expressions/BadParityCheck/BadParityCheck.expected deleted file mode 100644 index 710f218cee4..00000000000 --- a/javascript/ql/test/query-tests/Expressions/BadParityCheck/BadParityCheck.expected +++ /dev/null @@ -1,9 +0,0 @@ -| tst.js:1:1:1:11 | x % 2 === 1 | Test for oddness does not take negative numbers into account. | -| tst.js:2:1:2:11 | x % 2 !== 1 | Test for evenness does not take negative numbers into account. | -| tst.js:3:1:3:10 | x % 2 == 1 | Test for oddness does not take negative numbers into account. | -| tst.js:4:1:4:10 | x % 2 != 1 | Test for evenness does not take negative numbers into account. | -| tst.js:25:1:25:9 | x % 2 > 0 | Test for oddness does not take negative numbers into account. | -| tst.js:29:1:29:17 | x % (2) === ((1)) | Test for oddness does not take negative numbers into account. | -| tst.js:31:1:31:11 | 1 === x % 2 | Test for oddness does not take negative numbers into account. | -| tst.js:43:1:43:11 | y % 2 === 1 | Test for oddness does not take negative numbers into account. | -| tst.js:47:9:47:17 | i % 2 > 0 | Test for oddness does not take negative numbers into account. | diff --git a/javascript/ql/test/query-tests/Expressions/BadParityCheck/BadParityCheck.qlref b/javascript/ql/test/query-tests/Expressions/BadParityCheck/BadParityCheck.qlref deleted file mode 100644 index cc110f6a8d4..00000000000 --- a/javascript/ql/test/query-tests/Expressions/BadParityCheck/BadParityCheck.qlref +++ /dev/null @@ -1 +0,0 @@ -Expressions/BadParityCheck.ql \ No newline at end of file diff --git a/javascript/ql/test/query-tests/Expressions/BadParityCheck/tst.js b/javascript/ql/test/query-tests/Expressions/BadParityCheck/tst.js deleted file mode 100644 index fd38ccaf242..00000000000 --- a/javascript/ql/test/query-tests/Expressions/BadParityCheck/tst.js +++ /dev/null @@ -1,48 +0,0 @@ -x % 2 === 1; -x % 2 !== 1; -x % 2 == 1; -x % 2 != 1; -x % 2 >= 1; -x % 2 <= 1; -x % 2 > 1; -x % 2 < 1; - -x % 2 === -1; -x % 2 !== -1; -x % 2 == -1; -x % 2 != -1; -x % 2 >= -1; -x % 2 <= -1; -x % 2 > -1; -x % 2 < -1; - -x % 2 === 0; -x % 2 !== 0; -x % 2 == 0; -x % 2 != 0; -x % 2 >= 0; -x % 2 <= 0; -x % 2 > 0; -x % 2 < 0; - -x % 3 === 1; -x % (2) === ((1)); -2 % x == 1; -1 === x % 2; - -x = Math.random() > 0.5 ? -1 : 1; - -// OK -function printOdd(n) { - for (var i=0; i 0; -} \ No newline at end of file diff --git a/javascript/ql/test/query-tests/Expressions/HapaxLegomenon/HapaxLegomenon.expected b/javascript/ql/test/query-tests/Expressions/HapaxLegomenon/HapaxLegomenon.expected deleted file mode 100644 index d3bfff9bd85..00000000000 --- a/javascript/ql/test/query-tests/Expressions/HapaxLegomenon/HapaxLegomenon.expected +++ /dev/null @@ -1,2 +0,0 @@ -| tst.js:9:1:9:5 | o.Foo | 'Foo' is mentioned only once; it may be a typo for 'foo'. | -| tst.js:26:5:26:9 | iccID | 'iccID' is mentioned only once; it may be a typo for 'iccId'. | \ No newline at end of file diff --git a/javascript/ql/test/query-tests/Expressions/HapaxLegomenon/HapaxLegomenon.qlref b/javascript/ql/test/query-tests/Expressions/HapaxLegomenon/HapaxLegomenon.qlref deleted file mode 100644 index 03b4abb6f4b..00000000000 --- a/javascript/ql/test/query-tests/Expressions/HapaxLegomenon/HapaxLegomenon.qlref +++ /dev/null @@ -1 +0,0 @@ -Expressions/HapaxLegomenon.ql diff --git a/javascript/ql/test/query-tests/Expressions/HapaxLegomenon/externs.js b/javascript/ql/test/query-tests/Expressions/HapaxLegomenon/externs.js deleted file mode 100644 index 601e92ae383..00000000000 --- a/javascript/ql/test/query-tests/Expressions/HapaxLegomenon/externs.js +++ /dev/null @@ -1,7 +0,0 @@ -var google; - -google.maps.Marker; - -google.maps.Bar = 23; - -//semmle-extractor-options: --externs \ No newline at end of file diff --git a/javascript/ql/test/query-tests/Expressions/HapaxLegomenon/tst.js b/javascript/ql/test/query-tests/Expressions/HapaxLegomenon/tst.js deleted file mode 100644 index 80ed6c08d7c..00000000000 --- a/javascript/ql/test/query-tests/Expressions/HapaxLegomenon/tst.js +++ /dev/null @@ -1,33 +0,0 @@ -/*properties Map*/ - -var o = { - foo: function() {} -}; - -o.foo(); -o.foo(); -o.Foo(); - -new google.maps.Map(document.getElementById("map"), mapOptions); -[].map(function(){}); -[1, 2, 3].map(function(){}); - -new google.maps.Marker(); -google.maps.marker; -google.maps.marker; - -var q = { bar: 42 }; -q.bar; -q.bar; - -function tst(iccId) { - iccId; - iccId; - iccID; -} - -/*property startsWith*/ -var o = { StartsWith: 42 }; -o.StartsWith; -o.StartsWith; -"hi".startsWith("h"); \ No newline at end of file diff --git a/javascript/ql/test/query-tests/JSDoc/UnknownTagType/UnknownTagType.expected b/javascript/ql/test/query-tests/JSDoc/UnknownTagType/UnknownTagType.expected deleted file mode 100644 index 7cec15ae550..00000000000 --- a/javascript/ql/test/query-tests/JSDoc/UnknownTagType/UnknownTagType.expected +++ /dev/null @@ -1 +0,0 @@ -| tst.js:7:4:7:9 | @parma | Unknown tag type 'parma'. | diff --git a/javascript/ql/test/query-tests/JSDoc/UnknownTagType/UnknownTagType.qlref b/javascript/ql/test/query-tests/JSDoc/UnknownTagType/UnknownTagType.qlref deleted file mode 100644 index 185796b454e..00000000000 --- a/javascript/ql/test/query-tests/JSDoc/UnknownTagType/UnknownTagType.qlref +++ /dev/null @@ -1 +0,0 @@ -JSDoc/UnknownTagType.ql \ No newline at end of file diff --git a/javascript/ql/test/query-tests/JSDoc/UnknownTagType/tst.js b/javascript/ql/test/query-tests/JSDoc/UnknownTagType/tst.js deleted file mode 100644 index d1ced1bc8f1..00000000000 --- a/javascript/ql/test/query-tests/JSDoc/UnknownTagType/tst.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * A message. - * - * @constructor - * - * @param title - * @parma text - */ -function Message(title, body) { - this.title = title; - this.body = body; -} - -/** - * @modifies something - */ -function f() {} \ No newline at end of file diff --git a/javascript/ql/test/query-tests/JSLint/InvalidJSLintDirective/InvalidJSLintDirective.expected b/javascript/ql/test/query-tests/JSLint/InvalidJSLintDirective/InvalidJSLintDirective.expected deleted file mode 100644 index c60fbdd0e4f..00000000000 --- a/javascript/ql/test/query-tests/JSLint/InvalidJSLintDirective/InvalidJSLintDirective.expected +++ /dev/null @@ -1,3 +0,0 @@ -| tst.js:2:1:2:13 | /* global x*/ | JSLint directives must not have whitespace characters before the directive name. | -| tst.js:3:1:3:18 | /* global x,y: z*/ | JSLint directives must not have whitespace characters before the directive name. | -| tst.js:16:1:98:2 | /* glob ... rue,\\n*/ | JSLint directives must not have whitespace characters before the directive name. | diff --git a/javascript/ql/test/query-tests/JSLint/InvalidJSLintDirective/InvalidJSLintDirective.qlref b/javascript/ql/test/query-tests/JSLint/InvalidJSLintDirective/InvalidJSLintDirective.qlref deleted file mode 100644 index 3a5b11c2e91..00000000000 --- a/javascript/ql/test/query-tests/JSLint/InvalidJSLintDirective/InvalidJSLintDirective.qlref +++ /dev/null @@ -1 +0,0 @@ -JSLint/InvalidJSLintDirective.ql \ No newline at end of file diff --git a/javascript/ql/test/query-tests/JSLint/InvalidJSLintDirective/tst.js b/javascript/ql/test/query-tests/JSLint/InvalidJSLintDirective/tst.js deleted file mode 100644 index 0129f46d5d5..00000000000 --- a/javascript/ql/test/query-tests/JSLint/InvalidJSLintDirective/tst.js +++ /dev/null @@ -1,187 +0,0 @@ -// NOT OK -/* global x*/ -/* global x,y: z*/ - -// OK: vacuous directives -/* jslint */ -/* properties*/ - -// OK: not a directive -/* jslint is popular. */ - -// OK: not a directive -// global x - -// NOT OK -/* global angular: true, - msie: true, - jqLite: true, - jQuery: true, - slice: true, - push: true, - toString: true, - ngMinErr: true, - angularModule: true, - nodeName_: true, - uid: true, - VALIDITY_STATE_PROPERTY: true, - - lowercase: true, - uppercase: true, - manualLowercase: true, - manualUppercase: true, - nodeName_: true, - isArrayLike: true, - forEach: true, - sortedKeys: true, - forEachSorted: true, - reverseParams: true, - nextUid: true, - setHashKey: true, - extend: true, - int: true, - inherit: true, - noop: true, - identity: true, - valueFn: true, - isUndefined: true, - isDefined: true, - isObject: true, - isString: true, - isNumber: true, - isDate: true, - isArray: true, - isFunction: true, - isRegExp: true, - isWindow: true, - isScope: true, - isFile: true, - isBlob: true, - isBoolean: true, - isPromiseLike: true, - trim: true, - isElement: true, - makeMap: true, - map: true, - size: true, - includes: true, - indexOf: true, - arrayRemove: true, - isLeafNode: true, - copy: true, - shallowCopy: true, - equals: true, - csp: true, - concat: true, - sliceArgs: true, - bind: true, - toJsonReplacer: true, - toJson: true, - fromJson: true, - toBoolean: true, - startingTag: true, - tryDecodeURIComponent: true, - parseKeyValue: true, - toKeyValue: true, - encodeUriSegment: true, - encodeUriQuery: true, - angularInit: true, - bootstrap: true, - snake_case: true, - bindJQuery: true, - assertArg: true, - assertArgFn: true, - assertNotHasOwnProperty: true, - getter: true, - getBlockElements: true, - hasOwnProperty: true, -*/ - -// OK: not a directive -/*notadirective global x*/ - -// OK: not a directive -/* global angular: true, - msie: true, - jqLite: true, - jQuery: true, - slice: true, - push: true, - toString: true, - ngMinErr: true, - angularModule: true, - nodeName_: true, - uid: true, - VALIDITY_STATE_PROPERTY: true, - - lowercase: true, - uppercase: true, - manualLowercase: true, - manualUppercase: true, - nodeName_: true, - isArrayLike: true, - forEach: true, - sortedKeys: true, - forEachSorted: true, - reverseParams: true, - nextUid: true, - setHashKey: true, - extend: true, - int: true, - inherit: true, - noop: true, - identity: true, - valueFn: true, - isUndefined: true, - isDefined: true, - isObject: true, - isString: true, - isNumber: true, - isDate: true, - isArray: true, - isFunction: true, - isRegExp: true, - isWindow: true, - isScope: true, - isFile: true, - isBlob: true, - isBoolean: true, - isPromiseLike: true, - trim: true, - isElement: true, - makeMap: true, - map: true, - size: true, - includes: true, - indexOf: true, - arrayRemove: true, - isLeafNode: true, - copy: true, - shallowCopy: true, - equals: true, - csp: true, - concat: true, - sliceArgs: true, - bind: true, - toJsonReplacer: true, - toJson: true, - fromJson: true, - toBoolean: true, - startingTag: true, - tryDecodeURIComponent: true, - parseKeyValue: true, - toKeyValue: true, - encodeUriSegment: true, - encodeUriQuery: true, - angularInit: true, - bootstrap: true, - snake_case: true, - bindJQuery: true, - assertArg: true, - assertArgFn: true, - assertNotHasOwnProperty: true, - getter: true, - getBlockElements: true, - hasOwnProperty: true, -@@@ -*/ \ No newline at end of file diff --git a/javascript/ql/test/query-tests/JSLint/MalformedJSLintDirective/MalformedJSLintDirective.expected b/javascript/ql/test/query-tests/JSLint/MalformedJSLintDirective/MalformedJSLintDirective.expected deleted file mode 100644 index f0b89f7d68a..00000000000 --- a/javascript/ql/test/query-tests/JSLint/MalformedJSLintDirective/MalformedJSLintDirective.expected +++ /dev/null @@ -1,3 +0,0 @@ -| tst.js:1:1:1:38 | /*jslin ... true */ | Malformed JSLint directive. | -| tst.js:2:1:3:20 | /*jslin ... true */ | Malformed JSLint directive. | -| tst.js:5:1:5:17 | /*global a:treu*/ | Malformed JSLint directive. | diff --git a/javascript/ql/test/query-tests/JSLint/MalformedJSLintDirective/MalformedJSLintDirective.qlref b/javascript/ql/test/query-tests/JSLint/MalformedJSLintDirective/MalformedJSLintDirective.qlref deleted file mode 100644 index 9817d108294..00000000000 --- a/javascript/ql/test/query-tests/JSLint/MalformedJSLintDirective/MalformedJSLintDirective.qlref +++ /dev/null @@ -1 +0,0 @@ - JSLint/MalformedJSLintDirective.ql \ No newline at end of file diff --git a/javascript/ql/test/query-tests/JSLint/MalformedJSLintDirective/tst.js b/javascript/ql/test/query-tests/JSLint/MalformedJSLintDirective/tst.js deleted file mode 100644 index aa3c53b681f..00000000000 --- a/javascript/ql/test/query-tests/JSLint/MalformedJSLintDirective/tst.js +++ /dev/null @@ -1,9 +0,0 @@ -/*jslint bitwise:true plusplus:true */ -/*jslint bitwise:true, - * plusplus:true */ -/*jslint bitwise:true, plusplus:true */ -/*global a:treu*/ -/*properties */ -/*jslint forin: true, maxlen: 350 */ -/* global x*/ -/* global $*/ \ No newline at end of file diff --git a/javascript/ql/test/query-tests/LanguageFeatures/HTMLComments/HTMLComments.expected b/javascript/ql/test/query-tests/LanguageFeatures/HTMLComments/HTMLComments.expected deleted file mode 100644 index 3f90e408b6f..00000000000 --- a/javascript/ql/test/query-tests/LanguageFeatures/HTMLComments/HTMLComments.expected +++ /dev/null @@ -1 +0,0 @@ -| tst.js:1:1:1:11 |