5
5
* results.
6
6
* @kind table
7
7
* @problem.severity error
8
- * @id js/sanity /api-contracts
9
- * @tags sanity
8
+ * @id js/consistency /api-contracts
9
+ * @tags consistency
10
10
*/
11
11
12
12
import javascript
@@ -66,7 +66,7 @@ predicate uniqueness_error(int number, string what, string problem) {
66
66
* is the QL class name of the entity violating the contract, `problem` describes
67
67
* the violation, and `what` gives location information where possible.
68
68
*/
69
- predicate ast_sanity ( string clsname , string problem , string what ) {
69
+ predicate ast_consistency ( string clsname , string problem , string what ) {
70
70
exists ( Locatable l | clsname = l .getAQlClass ( ) |
71
71
uniqueness_error ( count ( l .toString ( ) ) , "toString" , problem ) and what = "at " + l .getLocation ( )
72
72
or
@@ -120,7 +120,7 @@ predicate ast_sanity(string clsname, string problem, string what) {
120
120
* Holds if a location entity of QL class `clsname` does not have a unique `toString`,
121
121
* where `problem` describes the problem and `what` gives location information where possible.
122
122
*/
123
- predicate location_sanity ( string clsname , string problem , string what ) {
123
+ predicate location_consistency ( string clsname , string problem , string what ) {
124
124
exists ( Location l | clsname = l .getAQlClass ( ) |
125
125
uniqueness_error ( count ( l .toString ( ) ) , "toString" , problem ) and what = "at " + l
126
126
or
@@ -138,7 +138,7 @@ predicate hasCFG(StmtContainer sc) { not exists(Error err | err.getFile() = sc.g
138
138
* is the QL class name of the entity violating the contract, `problem` describes
139
139
* the violation, and `what` gives location information.
140
140
*/
141
- predicate cfg_sanity ( string clsname , string problem , string what ) {
141
+ predicate cfg_consistency ( string clsname , string problem , string what ) {
142
142
exists ( StmtContainer cont | clsname = cont .getAQlClass ( ) and hasCFG ( cont ) |
143
143
uniqueness_error ( count ( cont .getEntry ( ) ) , "getEntry" , problem ) and
144
144
what = "at " + cont .getLocation ( )
@@ -158,7 +158,7 @@ predicate cfg_sanity(string clsname, string problem, string what) {
158
158
* is the QL class name of the entity violating the contract, `problem` describes
159
159
* the violation, and `what` gives location information.
160
160
*/
161
- predicate scope_sanity ( string clsname , string problem , string what ) {
161
+ predicate scope_consistency ( string clsname , string problem , string what ) {
162
162
exists ( Scope s | clsname = s .getAQlClass ( ) |
163
163
uniqueness_error ( count ( s .toString ( ) ) , "toString" , problem ) and what = "a scope"
164
164
or
@@ -180,7 +180,7 @@ predicate scope_sanity(string clsname, string problem, string what) {
180
180
* Holds if a JSDoc type expression of QL class `clsname` does not have a unique `toString`,
181
181
* where `problem` describes the problem and `what` is the empty string.
182
182
*/
183
- predicate jsdoc_sanity ( string clsname , string problem , string what ) {
183
+ predicate jsdoc_consistency ( string clsname , string problem , string what ) {
184
184
exists ( JSDocTypeExprParent jsdtep | clsname = jsdtep .getAQlClass ( ) |
185
185
uniqueness_error ( count ( jsdtep .toString ( ) ) , "toString" , problem ) and what = ""
186
186
)
@@ -190,7 +190,7 @@ predicate jsdoc_sanity(string clsname, string problem, string what) {
190
190
* Holds if a variable reference does not refer to a unique variable,
191
191
* where `problem` describes the problem and `what` is the name of the variable.
192
192
*/
193
- predicate varref_sanity ( string clsname , string problem , string what ) {
193
+ predicate varref_consistency ( string clsname , string problem , string what ) {
194
194
exists ( VarRef vr , int n | n = count ( vr .getVariable ( ) ) and n != 1 |
195
195
clsname = vr .getAQlClass ( ) and
196
196
what = vr .getName ( ) and
@@ -200,10 +200,10 @@ predicate varref_sanity(string clsname, string problem, string what) {
200
200
201
201
from string clsname , string problem , string what
202
202
where
203
- ast_sanity ( clsname , problem , what ) or
204
- location_sanity ( clsname , problem , what ) or
205
- scope_sanity ( clsname , problem , what ) or
206
- cfg_sanity ( clsname , problem , what ) or
207
- jsdoc_sanity ( clsname , problem , what ) or
208
- varref_sanity ( clsname , problem , what )
203
+ ast_consistency ( clsname , problem , what ) or
204
+ location_consistency ( clsname , problem , what ) or
205
+ scope_consistency ( clsname , problem , what ) or
206
+ cfg_consistency ( clsname , problem , what ) or
207
+ jsdoc_consistency ( clsname , problem , what ) or
208
+ varref_consistency ( clsname , problem , what )
209
209
select clsname + " " + what + " has " + problem
0 commit comments