@abaplint/cli 2.106.8 → 2.107.0
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 +180 -11
- package/package.json +2 -2
package/build/cli.js
CHANGED
|
@@ -26492,6 +26492,7 @@ const _scope_type_1 = __webpack_require__(/*! ../_scope_type */ "./node_modules/
|
|
|
26492
26492
|
const sql_source_1 = __webpack_require__(/*! ./sql_source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/sql_source.js");
|
|
26493
26493
|
const sql_compare_1 = __webpack_require__(/*! ./sql_compare */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/sql_compare.js");
|
|
26494
26494
|
const sql_order_by_1 = __webpack_require__(/*! ./sql_order_by */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/sql_order_by.js");
|
|
26495
|
+
const dynamic_1 = __webpack_require__(/*! ./dynamic */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/dynamic.js");
|
|
26495
26496
|
const isSimple = /^\w+$/;
|
|
26496
26497
|
class Select {
|
|
26497
26498
|
runSyntax(node, scope, filename, skipImplicitInto = false) {
|
|
@@ -26502,7 +26503,7 @@ class Select {
|
|
|
26502
26503
|
if (from === undefined) {
|
|
26503
26504
|
throw new Error(`Missing FROM`);
|
|
26504
26505
|
}
|
|
26505
|
-
const fields = this.findFields(node);
|
|
26506
|
+
const fields = this.findFields(node, scope, filename);
|
|
26506
26507
|
if (fields.length === 0
|
|
26507
26508
|
&& node.findDirectExpression(Expressions.SQLFieldListLoop) === undefined) {
|
|
26508
26509
|
throw new Error(`fields missing`);
|
|
@@ -26660,17 +26661,20 @@ class Select {
|
|
|
26660
26661
|
}
|
|
26661
26662
|
return new basic_1.VoidType("SELECT_todo");
|
|
26662
26663
|
}
|
|
26663
|
-
findFields(node) {
|
|
26664
|
-
var _a;
|
|
26664
|
+
findFields(node, scope, filename) {
|
|
26665
|
+
var _a, _b;
|
|
26665
26666
|
let expr = undefined;
|
|
26666
26667
|
const ret = [];
|
|
26667
26668
|
expr = node.findFirstExpression(Expressions.SQLFieldList);
|
|
26668
26669
|
if (expr === undefined) {
|
|
26669
26670
|
expr = node.findDirectExpression(Expressions.SQLFieldListLoop);
|
|
26670
26671
|
}
|
|
26672
|
+
if (((_a = expr === null || expr === void 0 ? void 0 : expr.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.Dynamic) {
|
|
26673
|
+
new dynamic_1.Dynamic().runSyntax(expr.getFirstChild(), scope, filename);
|
|
26674
|
+
}
|
|
26671
26675
|
for (const field of (expr === null || expr === void 0 ? void 0 : expr.findDirectExpressionsMulti([Expressions.SQLField, Expressions.SQLFieldName])) || []) {
|
|
26672
26676
|
let code = field.concatTokens().toUpperCase();
|
|
26673
|
-
const as = ((
|
|
26677
|
+
const as = ((_b = field.findDirectExpression(Expressions.SQLAsName)) === null || _b === void 0 ? void 0 : _b.concatTokens()) || "";
|
|
26674
26678
|
if (as !== "") {
|
|
26675
26679
|
code = code.replace(" AS " + as, "");
|
|
26676
26680
|
}
|
|
@@ -27112,13 +27116,18 @@ exports.SQLCompare = void 0;
|
|
|
27112
27116
|
const Expressions = __webpack_require__(/*! ../../2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
|
|
27113
27117
|
const nodes_1 = __webpack_require__(/*! ../../nodes */ "./node_modules/@abaplint/core/build/src/abap/nodes/index.js");
|
|
27114
27118
|
const basic_1 = __webpack_require__(/*! ../../types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
|
|
27119
|
+
const dynamic_1 = __webpack_require__(/*! ./dynamic */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/dynamic.js");
|
|
27115
27120
|
const source_1 = __webpack_require__(/*! ./source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js");
|
|
27116
27121
|
const sql_source_1 = __webpack_require__(/*! ./sql_source */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/sql_source.js");
|
|
27117
27122
|
class SQLCompare {
|
|
27118
27123
|
runSyntax(node, scope, filename, tables) {
|
|
27119
|
-
var _a;
|
|
27124
|
+
var _a, _b;
|
|
27120
27125
|
let sourceType;
|
|
27121
27126
|
let token;
|
|
27127
|
+
if (((_a = node.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.Dynamic) {
|
|
27128
|
+
new dynamic_1.Dynamic().runSyntax(node.getFirstChild(), scope, filename);
|
|
27129
|
+
return;
|
|
27130
|
+
}
|
|
27122
27131
|
for (const s of node.findAllExpressions(Expressions.SimpleSource3)) {
|
|
27123
27132
|
new source_1.Source().runSyntax(s, scope, filename);
|
|
27124
27133
|
}
|
|
@@ -27144,7 +27153,7 @@ class SQLCompare {
|
|
|
27144
27153
|
}
|
|
27145
27154
|
}
|
|
27146
27155
|
}
|
|
27147
|
-
const fieldName = (
|
|
27156
|
+
const fieldName = (_b = node.findDirectExpression(Expressions.SQLFieldName)) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
27148
27157
|
if (fieldName && sourceType && token) {
|
|
27149
27158
|
// check compatibility for rule sql_value_conversion
|
|
27150
27159
|
const targetType = this.findType(fieldName, tables, scope);
|
|
@@ -49978,12 +49987,14 @@ class Table extends _abstract_object_1.AbstractObject {
|
|
|
49978
49987
|
}
|
|
49979
49988
|
getAllowedNaming() {
|
|
49980
49989
|
let length = 30;
|
|
49990
|
+
const regex = /^((\/[A-Z_\d]{3,8}\/)|[a-zA-Z0-9]{3})\w+$/;
|
|
49981
49991
|
if (this.getTableCategory() === TableCategory.Transparent) {
|
|
49982
49992
|
length = 16;
|
|
49983
49993
|
}
|
|
49984
49994
|
return {
|
|
49985
49995
|
maxLength: length,
|
|
49986
49996
|
allowNamespace: true,
|
|
49997
|
+
customRegex: regex,
|
|
49987
49998
|
};
|
|
49988
49999
|
}
|
|
49989
50000
|
setDirty() {
|
|
@@ -51451,7 +51462,7 @@ class Registry {
|
|
|
51451
51462
|
}
|
|
51452
51463
|
static abaplintVersion() {
|
|
51453
51464
|
// magic, see build script "version.sh"
|
|
51454
|
-
return "2.
|
|
51465
|
+
return "2.107.0";
|
|
51455
51466
|
}
|
|
51456
51467
|
getDDICReferences() {
|
|
51457
51468
|
return this.ddicReferences;
|
|
@@ -52469,6 +52480,156 @@ exports.AlignParameters = AlignParameters;
|
|
|
52469
52480
|
|
|
52470
52481
|
/***/ }),
|
|
52471
52482
|
|
|
52483
|
+
/***/ "./node_modules/@abaplint/core/build/src/rules/align_type_expressions.js":
|
|
52484
|
+
/*!*******************************************************************************!*\
|
|
52485
|
+
!*** ./node_modules/@abaplint/core/build/src/rules/align_type_expressions.js ***!
|
|
52486
|
+
\*******************************************************************************/
|
|
52487
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
52488
|
+
|
|
52489
|
+
"use strict";
|
|
52490
|
+
|
|
52491
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
52492
|
+
exports.AlignTypeExpressions = exports.AlignTypeExpressionsConf = void 0;
|
|
52493
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
|
|
52494
|
+
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
|
|
52495
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
|
|
52496
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
|
|
52497
|
+
const Structures = __webpack_require__(/*! ../abap/3_structures/structures */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js");
|
|
52498
|
+
const Statements = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
|
|
52499
|
+
const Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
|
|
52500
|
+
/*
|
|
52501
|
+
import {EditHelper, IEdit} from "../edit_helper";
|
|
52502
|
+
*/
|
|
52503
|
+
class AlignTypeExpressionsConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
52504
|
+
}
|
|
52505
|
+
exports.AlignTypeExpressionsConf = AlignTypeExpressionsConf;
|
|
52506
|
+
class AlignTypeExpressions extends _abap_rule_1.ABAPRule {
|
|
52507
|
+
constructor() {
|
|
52508
|
+
super(...arguments);
|
|
52509
|
+
this.conf = new AlignTypeExpressionsConf();
|
|
52510
|
+
}
|
|
52511
|
+
getMetadata() {
|
|
52512
|
+
return {
|
|
52513
|
+
key: "align_type_expressions",
|
|
52514
|
+
title: "Align TYPE expressions",
|
|
52515
|
+
shortDescription: `Align TYPE expressions in statements`,
|
|
52516
|
+
extendedInformation: `
|
|
52517
|
+
Currently works for METHODS + BEGIN OF
|
|
52518
|
+
|
|
52519
|
+
Also note that clean ABAP does not recommend aligning TYPE clauses:
|
|
52520
|
+
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#dont-align-type-clauses`,
|
|
52521
|
+
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace],
|
|
52522
|
+
badExample: `
|
|
52523
|
+
TYPES: BEGIN OF foo,
|
|
52524
|
+
bar TYPE i,
|
|
52525
|
+
foobar TYPE i,
|
|
52526
|
+
END OF foo.
|
|
52527
|
+
|
|
52528
|
+
INTERFACE lif.
|
|
52529
|
+
METHODS bar
|
|
52530
|
+
IMPORTING
|
|
52531
|
+
foo TYPE i
|
|
52532
|
+
foobar TYPE i.
|
|
52533
|
+
ENDINTERFACE.`,
|
|
52534
|
+
goodExample: `
|
|
52535
|
+
TYPES: BEGIN OF foo,
|
|
52536
|
+
bar TYPE i,
|
|
52537
|
+
foobar TYPE i,
|
|
52538
|
+
END OF foo.
|
|
52539
|
+
|
|
52540
|
+
INTERFACE lif.
|
|
52541
|
+
METHODS bar
|
|
52542
|
+
IMPORTING
|
|
52543
|
+
foo TYPE i
|
|
52544
|
+
foobar TYPE i.
|
|
52545
|
+
ENDINTERFACE.`,
|
|
52546
|
+
};
|
|
52547
|
+
}
|
|
52548
|
+
getConfig() {
|
|
52549
|
+
return this.conf;
|
|
52550
|
+
}
|
|
52551
|
+
setConfig(conf) {
|
|
52552
|
+
this.conf = conf;
|
|
52553
|
+
}
|
|
52554
|
+
runParsed(file) {
|
|
52555
|
+
const issues = [];
|
|
52556
|
+
const stru = file.getStructure();
|
|
52557
|
+
if (stru === undefined) {
|
|
52558
|
+
return issues; // parser error
|
|
52559
|
+
}
|
|
52560
|
+
issues.push(...this.checkTypes(stru, file));
|
|
52561
|
+
issues.push(...this.checkMethods(stru, file));
|
|
52562
|
+
return issues;
|
|
52563
|
+
}
|
|
52564
|
+
checkMethods(stru, file) {
|
|
52565
|
+
const issues = [];
|
|
52566
|
+
const methods = stru.findAllStatements(Statements.MethodDef);
|
|
52567
|
+
for (const m of methods) {
|
|
52568
|
+
const fields = [];
|
|
52569
|
+
const params = m.findAllExpressions(Expressions.MethodParam);
|
|
52570
|
+
let column = 0;
|
|
52571
|
+
for (const p of params) {
|
|
52572
|
+
const children = p.getChildren();
|
|
52573
|
+
const name = children[children.length - 2];
|
|
52574
|
+
fields.push({
|
|
52575
|
+
nameEnd: name.getLastToken().getEnd(),
|
|
52576
|
+
after: p.findFirstExpression(Expressions.TypeParam).getFirstToken().getStart()
|
|
52577
|
+
});
|
|
52578
|
+
column = Math.max(column, name.getFirstToken().getEnd().getCol() + 1);
|
|
52579
|
+
}
|
|
52580
|
+
const ret = m.findFirstExpression(Expressions.MethodDefReturning);
|
|
52581
|
+
if (ret) {
|
|
52582
|
+
const children = ret.getChildren();
|
|
52583
|
+
const name = children[children.length - 2];
|
|
52584
|
+
fields.push({
|
|
52585
|
+
nameEnd: name.getLastToken().getEnd(),
|
|
52586
|
+
after: ret.findFirstExpression(Expressions.TypeParam).getFirstToken().getStart()
|
|
52587
|
+
});
|
|
52588
|
+
column = Math.max(column, name.getLastToken().getEnd().getCol() + 1);
|
|
52589
|
+
}
|
|
52590
|
+
for (const f of fields) {
|
|
52591
|
+
if (f.after.getCol() !== column) {
|
|
52592
|
+
// const fix = this.buildFix(f.name, column);
|
|
52593
|
+
const message = `Align TYPE expressions to column ${column}`;
|
|
52594
|
+
const issue = issue_1.Issue.atPosition(file, f.after, message, this.getMetadata().key, this.conf.severity);
|
|
52595
|
+
issues.push(issue);
|
|
52596
|
+
}
|
|
52597
|
+
}
|
|
52598
|
+
}
|
|
52599
|
+
return issues;
|
|
52600
|
+
}
|
|
52601
|
+
checkTypes(stru, file) {
|
|
52602
|
+
const issues = [];
|
|
52603
|
+
const types = stru.findAllStructuresRecursive(Structures.Types);
|
|
52604
|
+
for (const t of types) {
|
|
52605
|
+
const fields = [];
|
|
52606
|
+
let column = 0;
|
|
52607
|
+
const st = t.findDirectStatements(Statements.Type);
|
|
52608
|
+
for (const s of st) {
|
|
52609
|
+
const name = s.getChildren()[1];
|
|
52610
|
+
fields.push({
|
|
52611
|
+
nameEnd: name.getLastToken().getEnd(),
|
|
52612
|
+
after: s.getChildren()[2].getFirstToken().getStart()
|
|
52613
|
+
});
|
|
52614
|
+
column = Math.max(column, name.getFirstToken().getEnd().getCol() + 1);
|
|
52615
|
+
}
|
|
52616
|
+
for (const f of fields) {
|
|
52617
|
+
if (f.after.getCol() !== column) {
|
|
52618
|
+
// const fix = this.buildFix(f.name, column);
|
|
52619
|
+
const message = `Align TYPE expressions to column ${column}`;
|
|
52620
|
+
const issue = issue_1.Issue.atPosition(file, f.after, message, this.getMetadata().key, this.conf.severity);
|
|
52621
|
+
issues.push(issue);
|
|
52622
|
+
}
|
|
52623
|
+
}
|
|
52624
|
+
}
|
|
52625
|
+
return issues;
|
|
52626
|
+
}
|
|
52627
|
+
}
|
|
52628
|
+
exports.AlignTypeExpressions = AlignTypeExpressions;
|
|
52629
|
+
//# sourceMappingURL=align_type_expressions.js.map
|
|
52630
|
+
|
|
52631
|
+
/***/ }),
|
|
52632
|
+
|
|
52472
52633
|
/***/ "./node_modules/@abaplint/core/build/src/rules/allowed_object_naming.js":
|
|
52473
52634
|
/*!******************************************************************************!*\
|
|
52474
52635
|
!*** ./node_modules/@abaplint/core/build/src/rules/allowed_object_naming.js ***!
|
|
@@ -61822,6 +61983,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
61822
61983
|
__exportStar(__webpack_require__(/*! ./7bit_ascii */ "./node_modules/@abaplint/core/build/src/rules/7bit_ascii.js"), exports);
|
|
61823
61984
|
__exportStar(__webpack_require__(/*! ./abapdoc */ "./node_modules/@abaplint/core/build/src/rules/abapdoc.js"), exports);
|
|
61824
61985
|
__exportStar(__webpack_require__(/*! ./align_parameters */ "./node_modules/@abaplint/core/build/src/rules/align_parameters.js"), exports);
|
|
61986
|
+
__exportStar(__webpack_require__(/*! ./align_type_expressions */ "./node_modules/@abaplint/core/build/src/rules/align_type_expressions.js"), exports);
|
|
61825
61987
|
__exportStar(__webpack_require__(/*! ./allowed_object_naming */ "./node_modules/@abaplint/core/build/src/rules/allowed_object_naming.js"), exports);
|
|
61826
61988
|
__exportStar(__webpack_require__(/*! ./allowed_object_types */ "./node_modules/@abaplint/core/build/src/rules/allowed_object_types.js"), exports);
|
|
61827
61989
|
__exportStar(__webpack_require__(/*! ./ambiguous_statement */ "./node_modules/@abaplint/core/build/src/rules/ambiguous_statement.js"), exports);
|
|
@@ -65177,6 +65339,7 @@ class NoPrefixesConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
|
65177
65339
|
this.types = "^TY_";
|
|
65178
65340
|
/** importing, exporting, returning and changing parameters, case insensitive regex */
|
|
65179
65341
|
this.methodParameters = "^[ICER].?_";
|
|
65342
|
+
this.allowIsPrefixBoolean = true;
|
|
65180
65343
|
// todo, public localClass: string = "";
|
|
65181
65344
|
// todo, public localInterface: string = "";
|
|
65182
65345
|
// todo, public functionModuleParameters: string = "";
|
|
@@ -65321,12 +65484,18 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/sub-sections/AvoidEncodi
|
|
|
65321
65484
|
return ret;
|
|
65322
65485
|
}
|
|
65323
65486
|
checkMethodParameters(topNode, regex, file) {
|
|
65487
|
+
var _a, _b;
|
|
65324
65488
|
const ret = [];
|
|
65325
65489
|
for (const method of topNode.findAllStatements(Statements.MethodDef)) {
|
|
65326
|
-
for (const
|
|
65327
|
-
const
|
|
65328
|
-
|
|
65329
|
-
|
|
65490
|
+
for (const param of method.findAllExpressionsMulti([Expressions.MethodDefReturning, Expressions.MethodParam])) {
|
|
65491
|
+
const nameToken = param === null || param === void 0 ? void 0 : param.findFirstExpression(Expressions.MethodParamName);
|
|
65492
|
+
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();
|
|
65493
|
+
if (this.getConfig().allowIsPrefixBoolean === true && (type === null || type === void 0 ? void 0 : type.endsWith("TYPE ABAP_BOOL"))) {
|
|
65494
|
+
continue;
|
|
65495
|
+
}
|
|
65496
|
+
const name = nameToken === null || nameToken === void 0 ? void 0 : nameToken.concatTokens();
|
|
65497
|
+
if (nameToken && name && name !== "" && name.match(regex)) {
|
|
65498
|
+
const issue = issue_1.Issue.atToken(file, nameToken.getFirstToken(), MESSAGE, this.getMetadata().key, this.conf.severity);
|
|
65330
65499
|
ret.push(issue);
|
|
65331
65500
|
}
|
|
65332
65501
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.107.0",
|
|
4
4
|
"description": "abaplint - Command Line Interface",
|
|
5
5
|
"funding": "https://github.com/sponsors/larshp",
|
|
6
6
|
"bin": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"homepage": "https://abaplint.org",
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@abaplint/core": "^2.
|
|
41
|
+
"@abaplint/core": "^2.107.0",
|
|
42
42
|
"@types/chai": "^4.3.14",
|
|
43
43
|
"@types/glob": "^8.1.0",
|
|
44
44
|
"@types/minimist": "^1.2.5",
|