JavaScript: Rename sanity -> consistency

This commit is contained in:
Dave Bartolomeo
2020-05-11 13:46:12 -04:00
parent b39d4bc4bd
commit 06783938d3
12 changed files with 34 additions and 34 deletions

View File

@@ -108,7 +108,7 @@ predicate signaturesMatch(MethodSignature method, MethodSignature other) {
method.getBody().getThisTypeAnnotation().getType() =
other.getBody().getThisTypeAnnotation().getType()
) and
// The types are compared in matchingCallSignature. This is sanity-check that the textual representation of the type-annotations are somewhat similar.
// The types are compared in matchingCallSignature. This is a consistency check that the textual representation of the type-annotations are somewhat similar.
forall(int i | i in [0 .. -1 + method.getBody().getNumParameter()] |
getParameterTypeAnnotation(method, i) = getParameterTypeAnnotation(other, i)
) and

View File

@@ -5,8 +5,8 @@
* results.
* @kind table
* @problem.severity error
* @id js/sanity/api-contracts
* @tags sanity
* @id js/consistency/api-contracts
* @tags consistency
*/
import javascript
@@ -66,7 +66,7 @@ predicate uniqueness_error(int number, string what, string problem) {
* is the QL class name of the entity violating the contract, `problem` describes
* the violation, and `what` gives location information where possible.
*/
predicate ast_sanity(string clsname, string problem, string what) {
predicate ast_consistency(string clsname, string problem, string what) {
exists(Locatable l | clsname = l.getAQlClass() |
uniqueness_error(count(l.toString()), "toString", problem) and what = "at " + l.getLocation()
or
@@ -120,7 +120,7 @@ predicate ast_sanity(string clsname, string problem, string what) {
* Holds if a location entity of QL class `clsname` does not have a unique `toString`,
* where `problem` describes the problem and `what` gives location information where possible.
*/
predicate location_sanity(string clsname, string problem, string what) {
predicate location_consistency(string clsname, string problem, string what) {
exists(Location l | clsname = l.getAQlClass() |
uniqueness_error(count(l.toString()), "toString", problem) and what = "at " + l
or
@@ -138,7 +138,7 @@ predicate hasCFG(StmtContainer sc) { not exists(Error err | err.getFile() = sc.g
* is the QL class name of the entity violating the contract, `problem` describes
* the violation, and `what` gives location information.
*/
predicate cfg_sanity(string clsname, string problem, string what) {
predicate cfg_consistency(string clsname, string problem, string what) {
exists(StmtContainer cont | clsname = cont.getAQlClass() and hasCFG(cont) |
uniqueness_error(count(cont.getEntry()), "getEntry", problem) and
what = "at " + cont.getLocation()
@@ -158,7 +158,7 @@ predicate cfg_sanity(string clsname, string problem, string what) {
* is the QL class name of the entity violating the contract, `problem` describes
* the violation, and `what` gives location information.
*/
predicate scope_sanity(string clsname, string problem, string what) {
predicate scope_consistency(string clsname, string problem, string what) {
exists(Scope s | clsname = s.getAQlClass() |
uniqueness_error(count(s.toString()), "toString", problem) and what = "a scope"
or
@@ -180,7 +180,7 @@ predicate scope_sanity(string clsname, string problem, string what) {
* Holds if a JSDoc type expression of QL class `clsname` does not have a unique `toString`,
* where `problem` describes the problem and `what` is the empty string.
*/
predicate jsdoc_sanity(string clsname, string problem, string what) {
predicate jsdoc_consistency(string clsname, string problem, string what) {
exists(JSDocTypeExprParent jsdtep | clsname = jsdtep.getAQlClass() |
uniqueness_error(count(jsdtep.toString()), "toString", problem) and what = ""
)
@@ -190,7 +190,7 @@ predicate jsdoc_sanity(string clsname, string problem, string what) {
* Holds if a variable reference does not refer to a unique variable,
* where `problem` describes the problem and `what` is the name of the variable.
*/
predicate varref_sanity(string clsname, string problem, string what) {
predicate varref_consistency(string clsname, string problem, string what) {
exists(VarRef vr, int n | n = count(vr.getVariable()) and n != 1 |
clsname = vr.getAQlClass() and
what = vr.getName() and
@@ -200,10 +200,10 @@ predicate varref_sanity(string clsname, string problem, string what) {
from string clsname, string problem, string what
where
ast_sanity(clsname, problem, what) or
location_sanity(clsname, problem, what) or
scope_sanity(clsname, problem, what) or
cfg_sanity(clsname, problem, what) or
jsdoc_sanity(clsname, problem, what) or
varref_sanity(clsname, problem, what)
ast_consistency(clsname, problem, what) or
location_consistency(clsname, problem, what) or
scope_consistency(clsname, problem, what) or
cfg_consistency(clsname, problem, what) or
jsdoc_consistency(clsname, problem, what) or
varref_consistency(clsname, problem, what)
select clsname + " " + what + " has " + problem

View File

@@ -3,8 +3,8 @@
* @description Each SSA definition should have at least one use.
* @kind problem
* @problem.severity error
* @id js/sanity/dead-ssa-definition
* @tags sanity
* @id js/consistency/dead-ssa-definition
* @tags consistency
*/
import javascript

View File

@@ -4,8 +4,8 @@
* definition.
* @kind problem
* @problem.severity error
* @id js/sanity/non-dominating-ssa-definition
* @tags sanity
* @id js/consistency/non-dominating-ssa-definition
* @tags consistency
*/
import javascript

View File

@@ -4,8 +4,8 @@
* exactly one SSA variable.
* @kind problem
* @problem.severity error
* @id js/sanity/ambiguous-ssa-definition
* @tags sanity
* @id js/consistency/ambiguous-ssa-definition
* @tags consistency
*/
import javascript

View File

@@ -3,8 +3,8 @@
* @description Every SSA refinement node should have exactly one input.
* @kind problem
* @problem.severity error
* @id js/sanity/ambiguous-refinement-node
* @tags sanity
* @id js/consistency/ambiguous-refinement-node
* @tags consistency
*/
import javascript

View File

@@ -4,8 +4,8 @@
* exactly one SSA variable.
* @kind problem
* @problem.severity error
* @id js/sanity/dead-ssa-use
* @tags sanity
* @id js/consistency/dead-ssa-use
* @tags consistency
*/
import javascript

View File

@@ -3,8 +3,8 @@
* @description Every SSA phi node should have two or more inputs.
* @kind problem
* @problem.severity error
* @id js/sanity/dead-phi-node
* @tags sanity
* @id js/consistency/dead-phi-node
* @tags consistency
*/
import javascript

View File

@@ -3,8 +3,8 @@
* @description Every SSA refinement node should have exactly one input.
* @kind problem
* @problem.severity error
* @id js/sanity/dead-refinement-node
* @tags sanity
* @id js/consistency/dead-refinement-node
* @tags consistency
*/
import javascript

View File

@@ -3,8 +3,8 @@
* @description Every SSA phi node should have two or more inputs.
* @kind problem
* @problem.severity error
* @id js/sanity/trivial-phi-node
* @tags sanity
* @id js/consistency/trivial-phi-node
* @tags consistency
*/
import javascript

View File

@@ -111,11 +111,11 @@ module Internal {
*
* Example: `if (x === null) ...`.
*/
private class SanityCheckingUndefinedNullGuard extends DefensiveExpressionTest {
private class ConsistencyCheckingUndefinedNullGuard extends DefensiveExpressionTest {
UndefinedNullTest test;
boolean polarity;
SanityCheckingUndefinedNullGuard() {
ConsistencyCheckingUndefinedNullGuard() {
exists(IfStmt c |
this = c.getCondition().flow() and
test = stripNotsAndParens(c.getCondition(), polarity) and

View File

@@ -173,7 +173,7 @@ module PrettyPrintCatCall {
callback = "" and not exists(cat.getCallback())
) and
fileArg = createFileArgument(cat).trim() and
// sanity check in case of surprising `toString` results, other uses of `containsNonTrivialBashChar` should ensure that this conjunct will hold most of the time
// consistency check in case of surprising `toString` results, other uses of `containsNonTrivialBashChar` should ensure that this conjunct will hold most of the time
not containsNonTrivialShellChar(fileArg.regexpReplaceAll("\\$|\\`| ", "")) // string concat might contain " ", template strings might contain "$" or `, and that is OK.
|
result = "fs.readFile" + sync + "(" + fileArg + extraArg + callback + ")"