@abaplint/cli 2.106.9 → 2.107.1
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 +182 -1
- package/package.json +2 -2
package/build/cli.js
CHANGED
|
@@ -49987,12 +49987,14 @@ class Table extends _abstract_object_1.AbstractObject {
|
|
|
49987
49987
|
}
|
|
49988
49988
|
getAllowedNaming() {
|
|
49989
49989
|
let length = 30;
|
|
49990
|
+
const regex = /^((\/[A-Z_\d]{3,8}\/)|[a-zA-Z0-9]{3})\w+$/;
|
|
49990
49991
|
if (this.getTableCategory() === TableCategory.Transparent) {
|
|
49991
49992
|
length = 16;
|
|
49992
49993
|
}
|
|
49993
49994
|
return {
|
|
49994
49995
|
maxLength: length,
|
|
49995
49996
|
allowNamespace: true,
|
|
49997
|
+
customRegex: regex,
|
|
49996
49998
|
};
|
|
49997
49999
|
}
|
|
49998
50000
|
setDirty() {
|
|
@@ -51460,7 +51462,7 @@ class Registry {
|
|
|
51460
51462
|
}
|
|
51461
51463
|
static abaplintVersion() {
|
|
51462
51464
|
// magic, see build script "version.sh"
|
|
51463
|
-
return "2.
|
|
51465
|
+
return "2.107.1";
|
|
51464
51466
|
}
|
|
51465
51467
|
getDDICReferences() {
|
|
51466
51468
|
return this.ddicReferences;
|
|
@@ -51782,6 +51784,8 @@ https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abencharacter_set_gui
|
|
|
51782
51784
|
|
|
51783
51785
|
Checkes files with extensions ".abap" and ".asddls"`,
|
|
51784
51786
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
51787
|
+
badExample: `WRITE '뽑'.`,
|
|
51788
|
+
goodExample: `WRITE cl_abap_conv_in_ce=>uccp( 'BF51' ).`,
|
|
51785
51789
|
};
|
|
51786
51790
|
}
|
|
51787
51791
|
initialize(_reg) {
|
|
@@ -52478,6 +52482,182 @@ exports.AlignParameters = AlignParameters;
|
|
|
52478
52482
|
|
|
52479
52483
|
/***/ }),
|
|
52480
52484
|
|
|
52485
|
+
/***/ "./node_modules/@abaplint/core/build/src/rules/align_type_expressions.js":
|
|
52486
|
+
/*!*******************************************************************************!*\
|
|
52487
|
+
!*** ./node_modules/@abaplint/core/build/src/rules/align_type_expressions.js ***!
|
|
52488
|
+
\*******************************************************************************/
|
|
52489
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
52490
|
+
|
|
52491
|
+
"use strict";
|
|
52492
|
+
|
|
52493
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
52494
|
+
exports.AlignTypeExpressions = exports.AlignTypeExpressionsConf = void 0;
|
|
52495
|
+
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "./node_modules/@abaplint/core/build/src/rules/_abap_rule.js");
|
|
52496
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
|
|
52497
|
+
const objects_1 = __webpack_require__(/*! ../objects */ "./node_modules/@abaplint/core/build/src/objects/index.js");
|
|
52498
|
+
const ddic_1 = __webpack_require__(/*! ../ddic */ "./node_modules/@abaplint/core/build/src/ddic.js");
|
|
52499
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
|
|
52500
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
|
|
52501
|
+
const position_1 = __webpack_require__(/*! ../position */ "./node_modules/@abaplint/core/build/src/position.js");
|
|
52502
|
+
const Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
|
|
52503
|
+
const Statements = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
|
|
52504
|
+
const Structures = __webpack_require__(/*! ../abap/3_structures/structures */ "./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js");
|
|
52505
|
+
const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
|
|
52506
|
+
class AlignTypeExpressionsConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
52507
|
+
constructor() {
|
|
52508
|
+
super(...arguments);
|
|
52509
|
+
/** Ignore global exception classes */
|
|
52510
|
+
this.ignoreExceptions = true;
|
|
52511
|
+
}
|
|
52512
|
+
}
|
|
52513
|
+
exports.AlignTypeExpressionsConf = AlignTypeExpressionsConf;
|
|
52514
|
+
class AlignTypeExpressions extends _abap_rule_1.ABAPRule {
|
|
52515
|
+
constructor() {
|
|
52516
|
+
super(...arguments);
|
|
52517
|
+
this.conf = new AlignTypeExpressionsConf();
|
|
52518
|
+
}
|
|
52519
|
+
getMetadata() {
|
|
52520
|
+
return {
|
|
52521
|
+
key: "align_type_expressions",
|
|
52522
|
+
title: "Align TYPE expressions",
|
|
52523
|
+
shortDescription: `Align TYPE expressions in statements`,
|
|
52524
|
+
extendedInformation: `
|
|
52525
|
+
Currently works for METHODS + BEGIN OF
|
|
52526
|
+
|
|
52527
|
+
If BEGIN OF has an INCLUDE TYPE its ignored
|
|
52528
|
+
|
|
52529
|
+
Also note that clean ABAP does not recommend aligning TYPE clauses:
|
|
52530
|
+
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#dont-align-type-clauses`,
|
|
52531
|
+
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix],
|
|
52532
|
+
badExample: `
|
|
52533
|
+
TYPES: BEGIN OF foo,
|
|
52534
|
+
bar TYPE i,
|
|
52535
|
+
foobar TYPE i,
|
|
52536
|
+
END OF foo.
|
|
52537
|
+
|
|
52538
|
+
INTERFACE lif.
|
|
52539
|
+
METHODS bar
|
|
52540
|
+
IMPORTING
|
|
52541
|
+
foo TYPE i
|
|
52542
|
+
foobar TYPE i.
|
|
52543
|
+
ENDINTERFACE.`,
|
|
52544
|
+
goodExample: `
|
|
52545
|
+
TYPES: BEGIN OF foo,
|
|
52546
|
+
bar TYPE i,
|
|
52547
|
+
foobar TYPE i,
|
|
52548
|
+
END OF foo.
|
|
52549
|
+
|
|
52550
|
+
INTERFACE lif.
|
|
52551
|
+
METHODS bar
|
|
52552
|
+
IMPORTING
|
|
52553
|
+
foo TYPE i
|
|
52554
|
+
foobar TYPE i.
|
|
52555
|
+
ENDINTERFACE.`,
|
|
52556
|
+
};
|
|
52557
|
+
}
|
|
52558
|
+
getConfig() {
|
|
52559
|
+
return this.conf;
|
|
52560
|
+
}
|
|
52561
|
+
setConfig(conf) {
|
|
52562
|
+
this.conf = conf;
|
|
52563
|
+
}
|
|
52564
|
+
runParsed(file, obj) {
|
|
52565
|
+
const issues = [];
|
|
52566
|
+
const stru = file.getStructure();
|
|
52567
|
+
if (stru === undefined) {
|
|
52568
|
+
return issues; // parser error
|
|
52569
|
+
}
|
|
52570
|
+
const ddic = new ddic_1.DDIC(this.reg);
|
|
52571
|
+
if (obj instanceof objects_1.Class) {
|
|
52572
|
+
const definition = obj.getClassDefinition();
|
|
52573
|
+
if (definition === undefined) {
|
|
52574
|
+
return [];
|
|
52575
|
+
}
|
|
52576
|
+
else if (this.conf.ignoreExceptions && ddic.isException(definition, obj)) {
|
|
52577
|
+
return [];
|
|
52578
|
+
}
|
|
52579
|
+
}
|
|
52580
|
+
issues.push(...this.checkTypes(stru, file));
|
|
52581
|
+
issues.push(...this.checkMethods(stru, file));
|
|
52582
|
+
return issues;
|
|
52583
|
+
}
|
|
52584
|
+
check(fields, column, file) {
|
|
52585
|
+
const issues = [];
|
|
52586
|
+
for (const f of fields) {
|
|
52587
|
+
if (f.after.getCol() === column) {
|
|
52588
|
+
continue;
|
|
52589
|
+
}
|
|
52590
|
+
let fix = undefined;
|
|
52591
|
+
if (f.after.getCol() < column) {
|
|
52592
|
+
fix = edit_helper_1.EditHelper.insertAt(file, f.after, " ".repeat(column - f.after.getCol()));
|
|
52593
|
+
}
|
|
52594
|
+
else {
|
|
52595
|
+
fix = edit_helper_1.EditHelper.deleteRange(file, new position_1.Position(f.after.getRow(), column), f.after);
|
|
52596
|
+
}
|
|
52597
|
+
const message = `Align TYPE expressions to column ${column}`;
|
|
52598
|
+
const issue = issue_1.Issue.atPosition(file, f.after, message, this.getMetadata().key, this.conf.severity, fix);
|
|
52599
|
+
issues.push(issue);
|
|
52600
|
+
}
|
|
52601
|
+
return issues;
|
|
52602
|
+
}
|
|
52603
|
+
checkMethods(stru, file) {
|
|
52604
|
+
const issues = [];
|
|
52605
|
+
const methods = stru.findAllStatements(Statements.MethodDef);
|
|
52606
|
+
for (const m of methods) {
|
|
52607
|
+
const fields = [];
|
|
52608
|
+
const params = m.findAllExpressions(Expressions.MethodParam);
|
|
52609
|
+
let column = 0;
|
|
52610
|
+
for (const p of params) {
|
|
52611
|
+
const children = p.getChildren();
|
|
52612
|
+
const name = children[children.length - 2];
|
|
52613
|
+
fields.push({
|
|
52614
|
+
nameEnd: name.getLastToken().getEnd(),
|
|
52615
|
+
after: p.findFirstExpression(Expressions.TypeParam).getFirstToken().getStart()
|
|
52616
|
+
});
|
|
52617
|
+
column = Math.max(column, name.getFirstToken().getEnd().getCol() + 1);
|
|
52618
|
+
}
|
|
52619
|
+
const ret = m.findFirstExpression(Expressions.MethodDefReturning);
|
|
52620
|
+
if (ret) {
|
|
52621
|
+
const children = ret.getChildren();
|
|
52622
|
+
const name = children[children.length - 2];
|
|
52623
|
+
fields.push({
|
|
52624
|
+
nameEnd: name.getLastToken().getEnd(),
|
|
52625
|
+
after: ret.findFirstExpression(Expressions.TypeParam).getFirstToken().getStart()
|
|
52626
|
+
});
|
|
52627
|
+
column = Math.max(column, name.getLastToken().getEnd().getCol() + 1);
|
|
52628
|
+
}
|
|
52629
|
+
issues.push(...this.check(fields, column, file));
|
|
52630
|
+
}
|
|
52631
|
+
return issues;
|
|
52632
|
+
}
|
|
52633
|
+
checkTypes(stru, file) {
|
|
52634
|
+
const issues = [];
|
|
52635
|
+
const types = stru.findAllStructuresRecursive(Structures.Types);
|
|
52636
|
+
for (const t of types) {
|
|
52637
|
+
if (t.findDirectStatement(Statements.IncludeType)) {
|
|
52638
|
+
continue;
|
|
52639
|
+
}
|
|
52640
|
+
const fields = [];
|
|
52641
|
+
let column = 0;
|
|
52642
|
+
const st = t.findDirectStatements(Statements.Type);
|
|
52643
|
+
for (const s of st) {
|
|
52644
|
+
const name = s.getChildren()[1];
|
|
52645
|
+
fields.push({
|
|
52646
|
+
nameEnd: name.getLastToken().getEnd(),
|
|
52647
|
+
after: s.getChildren()[2].getFirstToken().getStart()
|
|
52648
|
+
});
|
|
52649
|
+
column = Math.max(column, name.getFirstToken().getEnd().getCol() + 1);
|
|
52650
|
+
}
|
|
52651
|
+
issues.push(...this.check(fields, column, file));
|
|
52652
|
+
}
|
|
52653
|
+
return issues;
|
|
52654
|
+
}
|
|
52655
|
+
}
|
|
52656
|
+
exports.AlignTypeExpressions = AlignTypeExpressions;
|
|
52657
|
+
//# sourceMappingURL=align_type_expressions.js.map
|
|
52658
|
+
|
|
52659
|
+
/***/ }),
|
|
52660
|
+
|
|
52481
52661
|
/***/ "./node_modules/@abaplint/core/build/src/rules/allowed_object_naming.js":
|
|
52482
52662
|
/*!******************************************************************************!*\
|
|
52483
52663
|
!*** ./node_modules/@abaplint/core/build/src/rules/allowed_object_naming.js ***!
|
|
@@ -61831,6 +62011,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
61831
62011
|
__exportStar(__webpack_require__(/*! ./7bit_ascii */ "./node_modules/@abaplint/core/build/src/rules/7bit_ascii.js"), exports);
|
|
61832
62012
|
__exportStar(__webpack_require__(/*! ./abapdoc */ "./node_modules/@abaplint/core/build/src/rules/abapdoc.js"), exports);
|
|
61833
62013
|
__exportStar(__webpack_require__(/*! ./align_parameters */ "./node_modules/@abaplint/core/build/src/rules/align_parameters.js"), exports);
|
|
62014
|
+
__exportStar(__webpack_require__(/*! ./align_type_expressions */ "./node_modules/@abaplint/core/build/src/rules/align_type_expressions.js"), exports);
|
|
61834
62015
|
__exportStar(__webpack_require__(/*! ./allowed_object_naming */ "./node_modules/@abaplint/core/build/src/rules/allowed_object_naming.js"), exports);
|
|
61835
62016
|
__exportStar(__webpack_require__(/*! ./allowed_object_types */ "./node_modules/@abaplint/core/build/src/rules/allowed_object_types.js"), exports);
|
|
61836
62017
|
__exportStar(__webpack_require__(/*! ./ambiguous_statement */ "./node_modules/@abaplint/core/build/src/rules/ambiguous_statement.js"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.107.1",
|
|
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.1",
|
|
42
42
|
"@types/chai": "^4.3.14",
|
|
43
43
|
"@types/glob": "^8.1.0",
|
|
44
44
|
"@types/minimist": "^1.2.5",
|