@abaplint/cli 2.108.0 → 2.108.2
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 +48 -15
- package/package.json +3 -3
package/build/cli.js
CHANGED
|
@@ -1594,6 +1594,7 @@ class LexerStream {
|
|
|
1594
1594
|
this.row = this.row + 1;
|
|
1595
1595
|
}
|
|
1596
1596
|
if (this.offset === this.raw.length) {
|
|
1597
|
+
this.col = this.col - 1;
|
|
1597
1598
|
return false;
|
|
1598
1599
|
}
|
|
1599
1600
|
this.col = this.col + 1;
|
|
@@ -51482,7 +51483,7 @@ class Registry {
|
|
|
51482
51483
|
}
|
|
51483
51484
|
static abaplintVersion() {
|
|
51484
51485
|
// magic, see build script "version.sh"
|
|
51485
|
-
return "2.108.
|
|
51486
|
+
return "2.108.2";
|
|
51486
51487
|
}
|
|
51487
51488
|
getDDICReferences() {
|
|
51488
51489
|
return this.ddicReferences;
|
|
@@ -52517,6 +52518,8 @@ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./
|
|
|
52517
52518
|
const _irule_1 = __webpack_require__(/*! ./_irule */ "./node_modules/@abaplint/core/build/src/rules/_irule.js");
|
|
52518
52519
|
const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
|
|
52519
52520
|
const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js");
|
|
52521
|
+
const position_1 = __webpack_require__(/*! ../position */ "./node_modules/@abaplint/core/build/src/position.js");
|
|
52522
|
+
const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "./node_modules/@abaplint/core/build/src/edit_helper.js");
|
|
52520
52523
|
class AlignPseudoCommentsConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
52521
52524
|
}
|
|
52522
52525
|
exports.AlignPseudoCommentsConf = AlignPseudoCommentsConf;
|
|
@@ -52530,7 +52533,7 @@ class AlignPseudoComments extends _abap_rule_1.ABAPRule {
|
|
|
52530
52533
|
key: "align_pseudo_comments",
|
|
52531
52534
|
title: "Align pseudo comments",
|
|
52532
52535
|
shortDescription: `Align code inspector pseudo comments in statements`,
|
|
52533
|
-
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace],
|
|
52536
|
+
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix],
|
|
52534
52537
|
badExample: `WRITE 'sdf'. "#EC sdf`,
|
|
52535
52538
|
goodExample: `WRITE 'sdf'. "#EC sdf`,
|
|
52536
52539
|
};
|
|
@@ -52557,16 +52560,22 @@ class AlignPseudoComments extends _abap_rule_1.ABAPRule {
|
|
|
52557
52560
|
else if (previousEnd === undefined) {
|
|
52558
52561
|
continue;
|
|
52559
52562
|
}
|
|
52560
|
-
|
|
52561
|
-
|
|
52562
|
-
|
|
52563
|
-
const message = "Align pseudo comment to column " + expectedColumn;
|
|
52564
|
-
issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
|
|
52565
|
-
}
|
|
52563
|
+
let expectedColumn = 61;
|
|
52564
|
+
if (commentLength > 10) {
|
|
52565
|
+
expectedColumn = 72 - commentLength;
|
|
52566
52566
|
}
|
|
52567
|
-
|
|
52568
|
-
|
|
52569
|
-
|
|
52567
|
+
const col = firstCommentToken.getStart().getCol();
|
|
52568
|
+
if (previousEnd.getCol() < expectedColumn && col !== expectedColumn) {
|
|
52569
|
+
let fix = undefined;
|
|
52570
|
+
if (col < expectedColumn) {
|
|
52571
|
+
fix = edit_helper_1.EditHelper.insertAt(file, firstCommentToken.getStart(), " ".repeat(expectedColumn - col));
|
|
52572
|
+
}
|
|
52573
|
+
else {
|
|
52574
|
+
const from = new position_1.Position(firstCommentToken.getStart().getRow(), expectedColumn);
|
|
52575
|
+
fix = edit_helper_1.EditHelper.deleteRange(file, from, firstCommentToken.getStart());
|
|
52576
|
+
}
|
|
52577
|
+
const message = "Align pseudo comment to column " + expectedColumn;
|
|
52578
|
+
issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, fix));
|
|
52570
52579
|
}
|
|
52571
52580
|
}
|
|
52572
52581
|
return issues;
|
|
@@ -59671,6 +59680,8 @@ class EmptyStructureConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
|
59671
59680
|
super(...arguments);
|
|
59672
59681
|
/** Checks for empty LOOP blocks */
|
|
59673
59682
|
this.loop = true;
|
|
59683
|
+
/** Allow empty LOOP if subrc is checked after the loop */
|
|
59684
|
+
this.loopAllowIfSubrc = true;
|
|
59674
59685
|
/** Checks for empty IF blocks */
|
|
59675
59686
|
this.if = true;
|
|
59676
59687
|
/** Checks for empty WHILE blocks */
|
|
@@ -59703,6 +59714,14 @@ class EmptyStructure extends _abap_rule_1.ABAPRule {
|
|
|
59703
59714
|
shortDescription: `Checks that the code does not contain empty blocks.`,
|
|
59704
59715
|
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#no-empty-if-branches`,
|
|
59705
59716
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
|
|
59717
|
+
badExample: `IF foo = bar.
|
|
59718
|
+
ENDIF.
|
|
59719
|
+
|
|
59720
|
+
DO 2 TIMES.
|
|
59721
|
+
ENDDO.`,
|
|
59722
|
+
goodExample: `LOOP AT itab WHERE qty = 0 OR date > sy-datum.
|
|
59723
|
+
ENDLOOP.
|
|
59724
|
+
result = xsdbool( sy-subrc = 0 ).`,
|
|
59706
59725
|
};
|
|
59707
59726
|
}
|
|
59708
59727
|
getDescription(name) {
|
|
@@ -59720,15 +59739,13 @@ class EmptyStructure extends _abap_rule_1.ABAPRule {
|
|
|
59720
59739
|
if (stru === undefined) {
|
|
59721
59740
|
return [];
|
|
59722
59741
|
}
|
|
59723
|
-
|
|
59742
|
+
const statements = file.getStatements();
|
|
59743
|
+
for (const statement of statements) {
|
|
59724
59744
|
if (statement.get() instanceof _statement_1.Unknown) {
|
|
59725
59745
|
return []; // contains parser errors
|
|
59726
59746
|
}
|
|
59727
59747
|
}
|
|
59728
59748
|
const candidates = [];
|
|
59729
|
-
if (this.getConfig().loop === true) {
|
|
59730
|
-
candidates.push(...stru.findAllStructuresRecursive(Structures.Loop));
|
|
59731
|
-
}
|
|
59732
59749
|
if (this.getConfig().while === true) {
|
|
59733
59750
|
candidates.push(...stru.findAllStructuresRecursive(Structures.While));
|
|
59734
59751
|
}
|
|
@@ -59764,6 +59781,22 @@ class EmptyStructure extends _abap_rule_1.ABAPRule {
|
|
|
59764
59781
|
}
|
|
59765
59782
|
}
|
|
59766
59783
|
}
|
|
59784
|
+
if (this.getConfig().loop === true) {
|
|
59785
|
+
const loops = stru.findAllStructuresRecursive(Structures.Loop);
|
|
59786
|
+
for (const loop of loops) {
|
|
59787
|
+
if (loop.getChildren().length === 2) {
|
|
59788
|
+
const endloopStatement = loop.getLastChild();
|
|
59789
|
+
const endloopIndex = statements.findIndex((s) => s === endloopStatement);
|
|
59790
|
+
const afterEndloop = statements[endloopIndex + 1];
|
|
59791
|
+
if (afterEndloop !== undefined && afterEndloop.concatTokens().toUpperCase().includes("SY-SUBRC")) {
|
|
59792
|
+
continue;
|
|
59793
|
+
}
|
|
59794
|
+
const token = loop.getFirstToken();
|
|
59795
|
+
const issue = issue_1.Issue.atToken(file, token, this.getDescription(loop.get().constructor.name), this.getMetadata().key, this.conf.severity);
|
|
59796
|
+
issues.push(issue);
|
|
59797
|
+
}
|
|
59798
|
+
}
|
|
59799
|
+
}
|
|
59767
59800
|
if (this.getConfig().if === true) {
|
|
59768
59801
|
const tries = stru.findAllStructuresRecursive(Structures.If)
|
|
59769
59802
|
.concat(stru.findAllStructuresRecursive(Structures.Else))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/cli",
|
|
3
|
-
"version": "2.108.
|
|
3
|
+
"version": "2.108.2",
|
|
4
4
|
"description": "abaplint - Command Line Interface",
|
|
5
5
|
"funding": "https://github.com/sponsors/larshp",
|
|
6
6
|
"bin": {
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
},
|
|
39
39
|
"homepage": "https://abaplint.org",
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@abaplint/core": "^2.108.
|
|
41
|
+
"@abaplint/core": "^2.108.2",
|
|
42
42
|
"@types/chai": "^4.3.16",
|
|
43
43
|
"@types/glob": "^8.1.0",
|
|
44
44
|
"@types/minimist": "^1.2.5",
|
|
45
45
|
"@types/mocha": "^10.0.6",
|
|
46
|
-
"@types/node": "^20.12.
|
|
46
|
+
"@types/node": "^20.12.11",
|
|
47
47
|
"@types/progress": "^2.0.7",
|
|
48
48
|
"chai": "^4.4.1",
|
|
49
49
|
"chalk": "^5.3.0",
|