Merge pull request #2581 from erik-krogh/FlowUselessExpr

Approved by max-schaefer
This commit is contained in:
semmle-qlci 2020-01-06 08:33:36 +00:00 коммит произвёл GitHub
Родитель 9b9d7121e8 c22d3d0b3a
Коммит 5dcc5b3b1e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 8 добавлений и 3 удалений

Просмотреть файл

@ -23,6 +23,7 @@
| Clear-text logging of sensitive information (`js/clear-text-logging`) | More results | More results involving `process.env` and indirect calls to logging methods are recognized. |
| Incomplete string escaping or encoding (`js/incomplete-sanitization`) | Fewer false positive results | This query now recognizes additional cases where a single replacement is likely to be intentional. |
| Unbound event handler receiver (`js/unbound-event-handler-receiver`) | Fewer false positive results | This query now recognizes additional ways event handler receivers can be bound. |
| Expression has no effect (`js/useless-expression`) | Fewer false positive results | The query now recognizes block-level flow type annotations. |
## Changes to libraries

Просмотреть файл

@ -40,7 +40,6 @@ predicate inVoidContext(Expr e) {
exists(LogicalBinaryExpr logical | e = logical.getRightOperand() and inVoidContext(logical))
}
/**
* Holds if `e` is of the form `x;` or `e.p;` and has a JSDoc comment containing a tag.
* In that case, it is probably meant as a declaration and shouldn't be flagged by this query.
@ -155,5 +154,7 @@ predicate hasNoEffect(Expr e) {
not exists(FunctionExpr fe, ExprStmt es | fe = e |
fe = es.getExpr() and
not exists(fe.getName())
)
) and
// exclude block-level flow type annotations. For example: `(name: empty)`.
not e.(ParExpr).getExpression().getLastToken().getNextToken().getValue() = ":"
}

Просмотреть файл

@ -0,0 +1 @@
semmle-extractor-options: --experimental

Просмотреть файл

@ -72,4 +72,6 @@ function g() {
Object.defineProperty(o, "nonTrivialGetter2", unknownGetterDef());
o.nonTrivialGetter2; // OK
(o: empty); // OK.
};