@abaplint/core 2.113.107 → 2.113.109
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/abaplint.d.ts
CHANGED
|
@@ -4381,8 +4381,10 @@ declare class MethodDefinition extends Identifier implements IMethodDefinition {
|
|
|
4381
4381
|
private readonly static;
|
|
4382
4382
|
private readonly raising;
|
|
4383
4383
|
private readonly exceptions;
|
|
4384
|
+
private readonly className;
|
|
4384
4385
|
constructor(node: StatementNode, visibility: Visibility, input: SyntaxInput);
|
|
4385
4386
|
getVisibility(): Visibility;
|
|
4387
|
+
getClassName(): string;
|
|
4386
4388
|
isRedefinition(): boolean;
|
|
4387
4389
|
isAbstract(): boolean;
|
|
4388
4390
|
isStatic(): boolean;
|
|
@@ -11,7 +11,7 @@ class StringTemplateFormatting extends combi_1.Expression {
|
|
|
11
11
|
const alphaOptions = (0, combi_1.altPrio)("OUT", "RAW", "IN", _1.Source);
|
|
12
12
|
const alignOptions = (0, combi_1.altPrio)("LEFT", "RIGHT", "CENTER", _1.Source, dynamic_1.Dynamic);
|
|
13
13
|
const dateTimeOptions = (0, combi_1.altPrio)("RAW", "ISO", "USER", "ENVIRONMENT", _1.Source, dynamic_1.Dynamic);
|
|
14
|
-
const timeStampOptions = (0, combi_1.altPrio)("SPACE", "ISO", "USER", "ENVIRONMENT", _1.Source);
|
|
14
|
+
const timeStampOptions = (0, combi_1.altPrio)("SPACE", "ISO", "USER", "ENVIRONMENT", _1.Source, dynamic_1.Dynamic);
|
|
15
15
|
const numberOptions = (0, combi_1.altPrio)("RAW", "USER", "ENVIRONMENT", _1.Source, dynamic_1.Dynamic);
|
|
16
16
|
const signOptions = (0, combi_1.altPrio)("LEFT", "LEFTPLUS", "LEFTSPACE", "RIGHT", "RIGHTPLUS", "RIGHTSPACE", _1.Source);
|
|
17
17
|
const caseOptions = (0, combi_1.altPrio)("RAW", "UPPER", "LOWER", _1.Source, dynamic_1.Dynamic);
|
|
@@ -18,6 +18,7 @@ class MethodDefinition extends _identifier_1.Identifier {
|
|
|
18
18
|
throw new Error("MethodDefinition, expected MethodDef as part of input node");
|
|
19
19
|
}
|
|
20
20
|
super(found.getFirstToken(), input.filename);
|
|
21
|
+
this.className = input.scope.getName();
|
|
21
22
|
this.redefinition = false;
|
|
22
23
|
if (node.findDirectExpression(Expressions.Redefinition)) {
|
|
23
24
|
this.redefinition = true;
|
|
@@ -70,6 +71,9 @@ class MethodDefinition extends _identifier_1.Identifier {
|
|
|
70
71
|
getVisibility() {
|
|
71
72
|
return this.visibility;
|
|
72
73
|
}
|
|
74
|
+
getClassName() {
|
|
75
|
+
return this.className;
|
|
76
|
+
}
|
|
73
77
|
isRedefinition() {
|
|
74
78
|
return this.redefinition;
|
|
75
79
|
}
|
package/build/src/registry.js
CHANGED
|
@@ -7,6 +7,7 @@ const issue_1 = require("../issue");
|
|
|
7
7
|
const _abap_rule_1 = require("./_abap_rule");
|
|
8
8
|
const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
9
9
|
const _irule_1 = require("./_irule");
|
|
10
|
+
const edit_helper_1 = require("../edit_helper");
|
|
10
11
|
class NoChainedAssignmentConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
11
12
|
}
|
|
12
13
|
exports.NoChainedAssignmentConf = NoChainedAssignmentConf;
|
|
@@ -21,7 +22,7 @@ class NoChainedAssignment extends _abap_rule_1.ABAPRule {
|
|
|
21
22
|
title: "No chained assignment",
|
|
22
23
|
shortDescription: `Find chained assingments and reports issues`,
|
|
23
24
|
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#dont-chain-assignments`,
|
|
24
|
-
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide],
|
|
25
|
+
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix],
|
|
25
26
|
badExample: `var1 = var2 = var3.`,
|
|
26
27
|
goodExample: `var2 = var3.
|
|
27
28
|
var1 = var2.`,
|
|
@@ -41,12 +42,23 @@ var1 = var2.`,
|
|
|
41
42
|
}
|
|
42
43
|
if (s.findDirectExpressions(Expressions.Target).length >= 2) {
|
|
43
44
|
const message = "No chained assignment";
|
|
44
|
-
const
|
|
45
|
+
const fix = this.buildFix(file, s);
|
|
46
|
+
const issue = issue_1.Issue.atStatement(file, s, message, this.getMetadata().key, this.getConfig().severity, fix);
|
|
45
47
|
issues.push(issue);
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
50
|
return issues;
|
|
49
51
|
}
|
|
52
|
+
buildFix(file, node) {
|
|
53
|
+
// window of 3 expressions
|
|
54
|
+
const children = node.getChildren();
|
|
55
|
+
let res = "";
|
|
56
|
+
for (let i = children.length - 4; i >= 0; i = i - 2) {
|
|
57
|
+
const concat = children[i].concatTokens() + " " + children[i + 1].concatTokens() + " " + children[i + 2].concatTokens();
|
|
58
|
+
res += concat + ".\n";
|
|
59
|
+
}
|
|
60
|
+
return edit_helper_1.EditHelper.replaceRange(file, node.getStart(), node.getEnd(), res.trimEnd());
|
|
61
|
+
}
|
|
50
62
|
}
|
|
51
63
|
exports.NoChainedAssignment = NoChainedAssignment;
|
|
52
64
|
//# sourceMappingURL=no_chained_assignment.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.113.
|
|
3
|
+
"version": "2.113.109",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -50,20 +50,20 @@
|
|
|
50
50
|
},
|
|
51
51
|
"homepage": "https://abaplint.org",
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@microsoft/api-extractor": "^7.52.
|
|
53
|
+
"@microsoft/api-extractor": "^7.52.3",
|
|
54
54
|
"@types/chai": "^4.3.20",
|
|
55
55
|
"@types/mocha": "^10.0.10",
|
|
56
|
-
"@types/node": "^22.
|
|
56
|
+
"@types/node": "^22.14.1",
|
|
57
57
|
"chai": "^4.5.0",
|
|
58
|
-
"eslint": "^9.
|
|
58
|
+
"eslint": "^9.24.0",
|
|
59
59
|
"mocha": "^11.1.0",
|
|
60
60
|
"c8": "^10.1.3",
|
|
61
61
|
"source-map-support": "^0.5.21",
|
|
62
|
-
"ts-json-schema-generator": "^2.
|
|
63
|
-
"typescript": "^5.8.
|
|
62
|
+
"ts-json-schema-generator": "^2.4.0",
|
|
63
|
+
"typescript": "^5.8.3"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"fast-xml-parser": "^5.0
|
|
66
|
+
"fast-xml-parser": "^5.2.0",
|
|
67
67
|
"json5": "^2.2.3",
|
|
68
68
|
"vscode-languageserver-types": "^3.17.5"
|
|
69
69
|
}
|