@abaplint/cli 2.120.70 → 2.120.71
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.
- package/build/cli.js +119 -6
- package/package.json +2 -2
package/build/cli.js
CHANGED
|
@@ -10389,7 +10389,7 @@ class StringTemplateFormatting extends combi_1.Expression {
|
|
|
10389
10389
|
const alpha = (0, combi_1.ver)(version_1.Release.v740sp02, (0, combi_1.seq)("ALPHA =", alphaOptions), { also: combi_1.AlsoIn.OpenABAP });
|
|
10390
10390
|
const xsd = (0, combi_1.ver)(version_1.Release.v740sp02, (0, combi_1.seq)("XSD =", zeroXSDOptions));
|
|
10391
10391
|
const country = (0, combi_1.seq)("COUNTRY =", _1.Source);
|
|
10392
|
-
const formatting = (0, combi_1.altPrio)((0, combi_1.seq)("TIME =", dateTimeOptions), (0, combi_1.seq)("DATE =", dateTimeOptions), (0, combi_1.seq)("CASE =", caseOptions), (0, combi_1.seq)("
|
|
10392
|
+
const formatting = (0, combi_1.altPrio)((0, combi_1.seq)("TIME =", dateTimeOptions), (0, combi_1.seq)("DATE =", dateTimeOptions), (0, combi_1.seq)("CASE =", caseOptions), (0, combi_1.seq)("ZERO =", zeroXSDOptions), xsd, (0, combi_1.seq)("STYLE =", styleOptions), (0, combi_1.seq)("CURRENCY =", _1.Source), (0, combi_1.per)(sign, number, decimals, width, pad, alpha, align, country, (0, combi_1.seq)("EXPONENT =", _1.Source)), (0, combi_1.per)(timezone, timestamp));
|
|
10393
10393
|
return formatting;
|
|
10394
10394
|
}
|
|
10395
10395
|
}
|
|
@@ -30121,12 +30121,15 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
30121
30121
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
30122
30122
|
exports.Compare = void 0;
|
|
30123
30123
|
const Expressions = __importStar(__webpack_require__(/*! ../../2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
30124
|
+
const nodes_1 = __webpack_require__(/*! ../../nodes */ "../core/build/src/abap/nodes/index.js");
|
|
30124
30125
|
const source_1 = __webpack_require__(/*! ./source */ "../core/build/src/abap/5_syntax/expressions/source.js");
|
|
30125
30126
|
const method_call_chain_1 = __webpack_require__(/*! ./method_call_chain */ "../core/build/src/abap/5_syntax/expressions/method_call_chain.js");
|
|
30126
30127
|
const source_field_symbol_1 = __webpack_require__(/*! ./source_field_symbol */ "../core/build/src/abap/5_syntax/expressions/source_field_symbol.js");
|
|
30127
30128
|
const _syntax_input_1 = __webpack_require__(/*! ../_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
30128
30129
|
const basic_1 = __webpack_require__(/*! ../../types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
30129
30130
|
const _type_utils_1 = __webpack_require__(/*! ../_type_utils */ "../core/build/src/abap/5_syntax/_type_utils.js");
|
|
30131
|
+
const _builtin_1 = __webpack_require__(/*! ../_builtin */ "../core/build/src/abap/5_syntax/_builtin.js");
|
|
30132
|
+
const _object_oriented_1 = __webpack_require__(/*! ../_object_oriented */ "../core/build/src/abap/5_syntax/_object_oriented.js");
|
|
30130
30133
|
class Compare {
|
|
30131
30134
|
static runSyntax(node, input) {
|
|
30132
30135
|
var _a;
|
|
@@ -30141,6 +30144,11 @@ class Compare {
|
|
|
30141
30144
|
for (const t of node.findDirectExpressions(Expressions.MethodCallChain)) {
|
|
30142
30145
|
method_call_chain_1.MethodCallChain.runSyntax(t, input);
|
|
30143
30146
|
}
|
|
30147
|
+
const initialMessage = this.checkInitialOperand(node, input);
|
|
30148
|
+
if (initialMessage !== undefined) {
|
|
30149
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), initialMessage));
|
|
30150
|
+
return;
|
|
30151
|
+
}
|
|
30144
30152
|
const typeUtils = new _type_utils_1.TypeUtils(input.scope);
|
|
30145
30153
|
const compareOperator = (_a = node.findDirectExpression(Expressions.CompareOperator)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
|
|
30146
30154
|
if (compareOperator === "CS"
|
|
@@ -30164,6 +30172,46 @@ class Compare {
|
|
|
30164
30172
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
30165
30173
|
}
|
|
30166
30174
|
}
|
|
30175
|
+
// a built-in function with a character-like result cannot be the operand of IS [NOT] INITIAL,
|
|
30176
|
+
// "Unexpected operator IS" on a system, while one with a numeric result, lines( ), can
|
|
30177
|
+
static checkInitialOperand(node, input) {
|
|
30178
|
+
var _a, _b, _c, _d;
|
|
30179
|
+
if (input.scope.getOpenABAP()) {
|
|
30180
|
+
return undefined;
|
|
30181
|
+
}
|
|
30182
|
+
const tokens = node.getChildren().filter(c => c instanceof nodes_1.TokenNode).map(c => c.getFirstToken().getStr().toUpperCase());
|
|
30183
|
+
if (tokens.includes("IS") === false || tokens[tokens.length - 1] !== "INITIAL") {
|
|
30184
|
+
return undefined;
|
|
30185
|
+
}
|
|
30186
|
+
const chain = (_a = node.findDirectExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.getChildren();
|
|
30187
|
+
// xsdbool( ) and boolc( ) are their own form in the Source grammar, a condition in parentheses
|
|
30188
|
+
const first = (_b = chain === null || chain === void 0 ? void 0 : chain[0]) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr().toUpperCase();
|
|
30189
|
+
if ((chain === null || chain === void 0 ? void 0 : chain.length) === 4 && chain[0] instanceof nodes_1.TokenNode && (first === "XSDBOOL" || first === "BOOLC")) {
|
|
30190
|
+
return `Built-in function "${chain[0].getFirstToken().getStr()}" cannot be the operand of IS INITIAL`;
|
|
30191
|
+
}
|
|
30192
|
+
if ((chain === null || chain === void 0 ? void 0 : chain.length) !== 1 || !(chain[0] instanceof nodes_1.ExpressionNode) || !(chain[0].get() instanceof Expressions.MethodCallChain)) {
|
|
30193
|
+
return undefined;
|
|
30194
|
+
}
|
|
30195
|
+
const calls = chain[0].getChildren();
|
|
30196
|
+
if (calls.length !== 1 || !(calls[0] instanceof nodes_1.ExpressionNode) || !(calls[0].get() instanceof Expressions.MethodCall)) {
|
|
30197
|
+
return undefined;
|
|
30198
|
+
}
|
|
30199
|
+
const name = (_c = calls[0].findDirectExpression(Expressions.MethodName)) === null || _c === void 0 ? void 0 : _c.concatTokens();
|
|
30200
|
+
const builtin = _builtin_1.BuiltIn.searchBuiltin(name);
|
|
30201
|
+
if (name === undefined || builtin === undefined) {
|
|
30202
|
+
return undefined;
|
|
30203
|
+
}
|
|
30204
|
+
// a method of the same name hides the built-in function
|
|
30205
|
+
const enclosing = input.scope.findClassDefinition(input.scope.getEnclosingClassName());
|
|
30206
|
+
if (enclosing !== undefined && new _object_oriented_1.ObjectOriented(input.scope).searchMethodName(enclosing, name).method !== undefined) {
|
|
30207
|
+
return undefined;
|
|
30208
|
+
}
|
|
30209
|
+
const returning = (_d = builtin.getParameters().getReturning()) === null || _d === void 0 ? void 0 : _d.getType();
|
|
30210
|
+
if (returning instanceof basic_1.StringType || returning instanceof basic_1.CharacterType) {
|
|
30211
|
+
return `Built-in function "${name}" cannot be the operand of IS INITIAL`;
|
|
30212
|
+
}
|
|
30213
|
+
return undefined;
|
|
30214
|
+
}
|
|
30167
30215
|
}
|
|
30168
30216
|
exports.Compare = Compare;
|
|
30169
30217
|
//# sourceMappingURL=compare.js.map
|
|
@@ -70525,7 +70573,7 @@ class Registry {
|
|
|
70525
70573
|
}
|
|
70526
70574
|
static abaplintVersion() {
|
|
70527
70575
|
// magic, see build script "version.js"
|
|
70528
|
-
return "2.120.
|
|
70576
|
+
return "2.120.71";
|
|
70529
70577
|
}
|
|
70530
70578
|
getDDICReferences() {
|
|
70531
70579
|
return this.ddicReferences;
|
|
@@ -73214,7 +73262,7 @@ exports.CDSCheckSyntaxConf = CDSCheckSyntaxConf;
|
|
|
73214
73262
|
const KNOWN_QUAN_DATA_ELEMENTS = ["MENGE_D"];
|
|
73215
73263
|
const KNOWN_CURR_DATA_ELEMENTS = ["BWERT", "DZWERT"];
|
|
73216
73264
|
// Reserved names, cannot be used as element names, see DDIC table TRESE
|
|
73217
|
-
const RESERVED_ELEMENT_NAMES = ["BEGIN", "NUMBER", "POSITION"];
|
|
73265
|
+
const RESERVED_ELEMENT_NAMES = ["BEGIN", "NUMBER", "POSITION", "ZONE", "HANDLER", "SECTION"];
|
|
73218
73266
|
const MAX_LABEL_LENGTH = 40;
|
|
73219
73267
|
// Annotations which are not supported in CDS view entities
|
|
73220
73268
|
const VIEW_ENTITY_FORBIDDEN_ANNOTATIONS = ["Semantics.unitOfMeasure", "Semantics.currencyCode"];
|
|
@@ -94924,7 +94972,8 @@ class RedundantConversion {
|
|
|
94924
94972
|
key: "redundant_conversion",
|
|
94925
94973
|
title: "Redundant Conversion",
|
|
94926
94974
|
shortDescription: `Find redundant CONV expressions`,
|
|
94927
|
-
extendedInformation: `Reports CONV expressions whose operand already has the conversion's target type
|
|
94975
|
+
extendedInformation: `Reports CONV expressions whose operand already has the conversion's target type,
|
|
94976
|
+
including the result of a built-in function with a fixed result type, like to_upper( ) or strlen( ).`,
|
|
94928
94977
|
tags: [_irule_1.RuleTag.Quickfix],
|
|
94929
94978
|
badExample: `DATA text TYPE string.
|
|
94930
94979
|
text = CONV string( text ).`,
|
|
@@ -94961,7 +95010,8 @@ text = text.`,
|
|
|
94961
95010
|
if (structure === undefined) {
|
|
94962
95011
|
continue;
|
|
94963
95012
|
}
|
|
94964
|
-
|
|
95013
|
+
// recursive, a CONV can be the argument of a built-in function, which is itself a Source
|
|
95014
|
+
for (const source of structure.findAllExpressionsRecursive(Expressions.Source)) {
|
|
94965
95015
|
if (source.getFirstToken().getStr().toUpperCase() !== "CONV") {
|
|
94966
95016
|
continue;
|
|
94967
95017
|
}
|
|
@@ -95020,6 +95070,15 @@ text = text.`,
|
|
|
95020
95070
|
}
|
|
95021
95071
|
sourceType(source, scope) {
|
|
95022
95072
|
let context;
|
|
95073
|
+
// boolc( <condition> ) is not a MethodCallChain, xsdbool( ) has the same shape but is not reported
|
|
95074
|
+
const first = source.getFirstToken();
|
|
95075
|
+
if (first.getStr().toUpperCase() === "BOOLC"
|
|
95076
|
+
&& source.findDirectExpression(Expressions.Cond) !== undefined
|
|
95077
|
+
&& source.getChildren().length === 4
|
|
95078
|
+
&& scope.getData().references.some(reference => reference.referenceType === _reference_1.ReferenceType.BuiltinMethodReference
|
|
95079
|
+
&& reference.position.getStart().equals(first.getStart()))) {
|
|
95080
|
+
return basic_1.StringType.get();
|
|
95081
|
+
}
|
|
95023
95082
|
for (const child of source.getChildren()) {
|
|
95024
95083
|
if (!(child instanceof nodes_1.ExpressionNode)) {
|
|
95025
95084
|
continue;
|
|
@@ -95030,6 +95089,15 @@ text = text.`,
|
|
|
95030
95089
|
return undefined;
|
|
95031
95090
|
}
|
|
95032
95091
|
}
|
|
95092
|
+
else if (child.get() instanceof Expressions.MethodCallChain) {
|
|
95093
|
+
if (source.getChildren().length !== 1) {
|
|
95094
|
+
return undefined;
|
|
95095
|
+
}
|
|
95096
|
+
context = this.builtinResultType(child, scope);
|
|
95097
|
+
if (context === undefined) {
|
|
95098
|
+
return undefined;
|
|
95099
|
+
}
|
|
95100
|
+
}
|
|
95033
95101
|
else if (child.get() instanceof Expressions.Constant) {
|
|
95034
95102
|
context = this.infer(context, constant_1.Constant.runSyntax(child));
|
|
95035
95103
|
}
|
|
@@ -95050,6 +95118,32 @@ text = text.`,
|
|
|
95050
95118
|
}
|
|
95051
95119
|
return context;
|
|
95052
95120
|
}
|
|
95121
|
+
/** The result type of a call to a built-in function whose result type does not depend on its arguments,
|
|
95122
|
+
* undefined for anything else, e.g. abs( ) or xsdbool( ), or a method of the same name */
|
|
95123
|
+
builtinResultType(chain, scope) {
|
|
95124
|
+
var _a;
|
|
95125
|
+
const children = chain.getChildren();
|
|
95126
|
+
if (children.length !== 1 || !(children[0].get() instanceof Expressions.MethodCall)) {
|
|
95127
|
+
return undefined;
|
|
95128
|
+
}
|
|
95129
|
+
const name = (_a = children[0].findDirectExpression(Expressions.MethodName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
95130
|
+
if (name === undefined) {
|
|
95131
|
+
return undefined;
|
|
95132
|
+
}
|
|
95133
|
+
const isBuiltin = scope.getData().references.some(reference => reference.referenceType === _reference_1.ReferenceType.BuiltinMethodReference
|
|
95134
|
+
&& reference.position.getStart().equals(name.getStart()));
|
|
95135
|
+
if (isBuiltin === false) {
|
|
95136
|
+
return undefined;
|
|
95137
|
+
}
|
|
95138
|
+
const upper = name.getStr().toUpperCase();
|
|
95139
|
+
if (RedundantConversion.stringResult.has(upper)) {
|
|
95140
|
+
return basic_1.StringType.get();
|
|
95141
|
+
}
|
|
95142
|
+
else if (RedundantConversion.integerResult.has(upper)) {
|
|
95143
|
+
return basic_1.IntegerType.get();
|
|
95144
|
+
}
|
|
95145
|
+
return undefined;
|
|
95146
|
+
}
|
|
95053
95147
|
fieldChainType(fieldChain, scope) {
|
|
95054
95148
|
var _a;
|
|
95055
95149
|
const operand = (_a = scope.getData().references.find(reference => reference.referenceType === _reference_1.ReferenceType.DataReadReference
|
|
@@ -95114,6 +95208,17 @@ text = text.`,
|
|
|
95114
95208
|
}
|
|
95115
95209
|
}
|
|
95116
95210
|
exports.RedundantConversion = RedundantConversion;
|
|
95211
|
+
// built-in functions that always return a string, whatever their arguments
|
|
95212
|
+
RedundantConversion.stringResult = new Set([
|
|
95213
|
+
"BOOLC", "CONCAT_LINES_OF", "CONDENSE", "ESCAPE", "FROM_MIXED", "INSERT", "REPEAT", "REPLACE",
|
|
95214
|
+
"REVERSE", "SEGMENT", "SHIFT_LEFT", "SHIFT_RIGHT", "SUBSTRING", "SUBSTRING_AFTER", "SUBSTRING_BEFORE",
|
|
95215
|
+
"SUBSTRING_FROM", "SUBSTRING_TO", "TO_LOWER", "TO_MIXED", "TO_UPPER", "TRANSLATE"
|
|
95216
|
+
]);
|
|
95217
|
+
// built-in functions that always return an i
|
|
95218
|
+
RedundantConversion.integerResult = new Set([
|
|
95219
|
+
"CHARLEN", "COUNT", "COUNT_ANY_NOT_OF", "COUNT_ANY_OF", "DBMAXLEN", "DISTANCE", "FIND", "FIND_ANY_NOT_OF",
|
|
95220
|
+
"FIND_ANY_OF", "FIND_END", "LINES", "NUMOFCHAR", "STRLEN", "XSTRLEN"
|
|
95221
|
+
]);
|
|
95117
95222
|
//# sourceMappingURL=redundant_conversion.js.map
|
|
95118
95223
|
|
|
95119
95224
|
/***/ },
|
|
@@ -102319,7 +102424,7 @@ class XMLConsistency {
|
|
|
102319
102424
|
}
|
|
102320
102425
|
runTable(obj, file) {
|
|
102321
102426
|
var _a, _b, _c, _d;
|
|
102322
|
-
var _e;
|
|
102427
|
+
var _e, _f;
|
|
102323
102428
|
const issues = [];
|
|
102324
102429
|
for (const field of (_e = obj.getFields()) !== null && _e !== void 0 ? _e : []) {
|
|
102325
102430
|
if (field.DATATYPE === "QUAN" && (!((_a = field.REFTABLE) === null || _a === void 0 ? void 0 : _a.trim()) || !((_b = field.REFFIELD) === null || _b === void 0 ? void 0 : _b.trim()))) {
|
|
@@ -102328,6 +102433,14 @@ class XMLConsistency {
|
|
|
102328
102433
|
}
|
|
102329
102434
|
}
|
|
102330
102435
|
if (obj.getTableCategory() === Objects.TableCategory.Transparent) {
|
|
102436
|
+
// Confirmed reserved database field names, see issue #4331, DAY and HOUR reported by activation.
|
|
102437
|
+
// TRESE also contains names such as TEXT and LENGTH which are allowed here.
|
|
102438
|
+
const reservedFieldNames = ["ZONE", "HANDLER", "SECTION", "PARAMETER", "DAY", "HOUR"];
|
|
102439
|
+
for (const field of (_f = obj.getFields()) !== null && _f !== void 0 ? _f : []) {
|
|
102440
|
+
if (reservedFieldNames.includes(field.FIELDNAME.toUpperCase())) {
|
|
102441
|
+
issues.push(issue_1.Issue.atRow(file, 1, `Table field name "${field.FIELDNAME}" is reserved`, this.getMetadata().key, this.conf.severity));
|
|
102442
|
+
}
|
|
102443
|
+
}
|
|
102331
102444
|
if (!((_c = obj.getDeliveryClass()) === null || _c === void 0 ? void 0 : _c.trim())) {
|
|
102332
102445
|
const message = `Transparent table must have delivery class(CONTFLAG in DD02V) set`;
|
|
102333
102446
|
issues.push(issue_1.Issue.atRow(file, 1, message, this.getMetadata().key, this.conf.transparentTableSeverity));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/cli",
|
|
3
|
-
"version": "2.120.
|
|
3
|
+
"version": "2.120.71",
|
|
4
4
|
"description": "abaplint - Command Line Interface",
|
|
5
5
|
"funding": "https://github.com/sponsors/larshp",
|
|
6
6
|
"bin": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"homepage": "https://abaplint.org",
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@abaplint/core": "^2.120.
|
|
42
|
+
"@abaplint/core": "^2.120.71",
|
|
43
43
|
"@types/chai": "^4.3.20",
|
|
44
44
|
"@types/minimist": "^1.2.5",
|
|
45
45
|
"@types/mocha": "^10.0.10",
|