@abaplint/core 2.106.8 → 2.106.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -11,6 +11,7 @@ const _scope_type_1 = require("../_scope_type");
|
|
|
11
11
|
const sql_source_1 = require("./sql_source");
|
|
12
12
|
const sql_compare_1 = require("./sql_compare");
|
|
13
13
|
const sql_order_by_1 = require("./sql_order_by");
|
|
14
|
+
const dynamic_1 = require("./dynamic");
|
|
14
15
|
const isSimple = /^\w+$/;
|
|
15
16
|
class Select {
|
|
16
17
|
runSyntax(node, scope, filename, skipImplicitInto = false) {
|
|
@@ -21,7 +22,7 @@ class Select {
|
|
|
21
22
|
if (from === undefined) {
|
|
22
23
|
throw new Error(`Missing FROM`);
|
|
23
24
|
}
|
|
24
|
-
const fields = this.findFields(node);
|
|
25
|
+
const fields = this.findFields(node, scope, filename);
|
|
25
26
|
if (fields.length === 0
|
|
26
27
|
&& node.findDirectExpression(Expressions.SQLFieldListLoop) === undefined) {
|
|
27
28
|
throw new Error(`fields missing`);
|
|
@@ -179,17 +180,20 @@ class Select {
|
|
|
179
180
|
}
|
|
180
181
|
return new basic_1.VoidType("SELECT_todo");
|
|
181
182
|
}
|
|
182
|
-
findFields(node) {
|
|
183
|
-
var _a;
|
|
183
|
+
findFields(node, scope, filename) {
|
|
184
|
+
var _a, _b;
|
|
184
185
|
let expr = undefined;
|
|
185
186
|
const ret = [];
|
|
186
187
|
expr = node.findFirstExpression(Expressions.SQLFieldList);
|
|
187
188
|
if (expr === undefined) {
|
|
188
189
|
expr = node.findDirectExpression(Expressions.SQLFieldListLoop);
|
|
189
190
|
}
|
|
191
|
+
if (((_a = expr === null || expr === void 0 ? void 0 : expr.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.Dynamic) {
|
|
192
|
+
new dynamic_1.Dynamic().runSyntax(expr.getFirstChild(), scope, filename);
|
|
193
|
+
}
|
|
190
194
|
for (const field of (expr === null || expr === void 0 ? void 0 : expr.findDirectExpressionsMulti([Expressions.SQLField, Expressions.SQLFieldName])) || []) {
|
|
191
195
|
let code = field.concatTokens().toUpperCase();
|
|
192
|
-
const as = ((
|
|
196
|
+
const as = ((_b = field.findDirectExpression(Expressions.SQLAsName)) === null || _b === void 0 ? void 0 : _b.concatTokens()) || "";
|
|
193
197
|
if (as !== "") {
|
|
194
198
|
code = code.replace(" AS " + as, "");
|
|
195
199
|
}
|
|
@@ -4,13 +4,18 @@ exports.SQLCompare = void 0;
|
|
|
4
4
|
const Expressions = require("../../2_statements/expressions");
|
|
5
5
|
const nodes_1 = require("../../nodes");
|
|
6
6
|
const basic_1 = require("../../types/basic");
|
|
7
|
+
const dynamic_1 = require("./dynamic");
|
|
7
8
|
const source_1 = require("./source");
|
|
8
9
|
const sql_source_1 = require("./sql_source");
|
|
9
10
|
class SQLCompare {
|
|
10
11
|
runSyntax(node, scope, filename, tables) {
|
|
11
|
-
var _a;
|
|
12
|
+
var _a, _b;
|
|
12
13
|
let sourceType;
|
|
13
14
|
let token;
|
|
15
|
+
if (((_a = node.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.Dynamic) {
|
|
16
|
+
new dynamic_1.Dynamic().runSyntax(node.getFirstChild(), scope, filename);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
14
19
|
for (const s of node.findAllExpressions(Expressions.SimpleSource3)) {
|
|
15
20
|
new source_1.Source().runSyntax(s, scope, filename);
|
|
16
21
|
}
|
|
@@ -36,7 +41,7 @@ class SQLCompare {
|
|
|
36
41
|
}
|
|
37
42
|
}
|
|
38
43
|
}
|
|
39
|
-
const fieldName = (
|
|
44
|
+
const fieldName = (_b = node.findDirectExpression(Expressions.SQLFieldName)) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
40
45
|
if (fieldName && sourceType && token) {
|
|
41
46
|
// check compatibility for rule sql_value_conversion
|
|
42
47
|
const targetType = this.findType(fieldName, tables, scope);
|
package/build/src/registry.js
CHANGED
|
@@ -22,6 +22,7 @@ class NoPrefixesConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
|
22
22
|
this.types = "^TY_";
|
|
23
23
|
/** importing, exporting, returning and changing parameters, case insensitive regex */
|
|
24
24
|
this.methodParameters = "^[ICER].?_";
|
|
25
|
+
this.allowIsPrefixBoolean = true;
|
|
25
26
|
// todo, public localClass: string = "";
|
|
26
27
|
// todo, public localInterface: string = "";
|
|
27
28
|
// todo, public functionModuleParameters: string = "";
|
|
@@ -166,12 +167,18 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/sub-sections/AvoidEncodi
|
|
|
166
167
|
return ret;
|
|
167
168
|
}
|
|
168
169
|
checkMethodParameters(topNode, regex, file) {
|
|
170
|
+
var _a, _b;
|
|
169
171
|
const ret = [];
|
|
170
172
|
for (const method of topNode.findAllStatements(Statements.MethodDef)) {
|
|
171
|
-
for (const
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
for (const param of method.findAllExpressionsMulti([Expressions.MethodDefReturning, Expressions.MethodParam])) {
|
|
174
|
+
const nameToken = param === null || param === void 0 ? void 0 : param.findFirstExpression(Expressions.MethodParamName);
|
|
175
|
+
const type = (_b = (_a = param === null || param === void 0 ? void 0 : param.findFirstExpression(Expressions.TypeParam)) === null || _a === void 0 ? void 0 : _a.concatTokens()) === null || _b === void 0 ? void 0 : _b.toUpperCase();
|
|
176
|
+
if (this.getConfig().allowIsPrefixBoolean === true && (type === null || type === void 0 ? void 0 : type.endsWith("TYPE ABAP_BOOL"))) {
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
const name = nameToken === null || nameToken === void 0 ? void 0 : nameToken.concatTokens();
|
|
180
|
+
if (nameToken && name && name !== "" && name.match(regex)) {
|
|
181
|
+
const issue = issue_1.Issue.atToken(file, nameToken.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
|
|
175
182
|
ret.push(issue);
|
|
176
183
|
}
|
|
177
184
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.106.
|
|
3
|
+
"version": "2.106.9",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"mocha": "^10.4.0",
|
|
60
60
|
"c8": "^9.1.0",
|
|
61
61
|
"source-map-support": "^0.5.21",
|
|
62
|
-
"ts-json-schema-generator": "
|
|
62
|
+
"ts-json-schema-generator": "=2.0.1",
|
|
63
63
|
"typescript": "^5.4.5"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|