@abaplint/core 2.120.54 → 2.120.56
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/src/abap/2_statements/statements/call_transaction.js +1 -1
- package/build/src/registry.js +1 -1
- package/build/src/rules/align_parameters.js +1 -1
- package/build/src/rules/constant_classes.js +1 -1
- package/build/src/rules/downport.js +4 -0
- package/build/src/rules/index.js +1 -0
- package/build/src/rules/keyword_case.js +1 -1
- package/build/src/rules/prefer_abap_bool.js +100 -0
- package/build/src/rules/prefer_insert_into_table.js +2 -3
- package/build/src/rules/sequential_blank.js +2 -0
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ class CallTransaction {
|
|
|
8
8
|
getMatcher() {
|
|
9
9
|
const options = (0, combi_1.seq)("OPTIONS FROM", expressions_1.Source);
|
|
10
10
|
const messages = (0, combi_1.seq)("MESSAGES INTO", expressions_1.Target);
|
|
11
|
-
const auth = (0, combi_1.ver)(version_1.Release.v740sp02, (0, combi_1.seq)((0, combi_1.altPrio)("WITH", "WITHOUT"), "AUTHORITY-CHECK"));
|
|
11
|
+
const auth = (0, combi_1.ver)(version_1.Release.v740sp02, (0, combi_1.seq)((0, combi_1.altPrio)("WITH", "WITHOUT"), "AUTHORITY-CHECK"), { also: combi_1.AlsoIn.OpenABAP });
|
|
12
12
|
const perm = (0, combi_1.per)((0, combi_1.seq)("UPDATE", expressions_1.Source), "AND SKIP FIRST SCREEN", options, messages, (0, combi_1.seq)("MODE", expressions_1.Source));
|
|
13
13
|
const ret = (0, combi_1.seq)("CALL TRANSACTION", expressions_1.Source, (0, combi_1.optPrio)(auth), (0, combi_1.optPrio)((0, combi_1.seq)("USING", expressions_1.Source)), (0, combi_1.opt)(perm));
|
|
14
14
|
return (0, combi_1.verNotLang)(version_1.LanguageVersion.Cloud, ret);
|
package/build/src/registry.js
CHANGED
|
@@ -64,7 +64,7 @@ class AlignParameters extends _abap_rule_1.ABAPRule {
|
|
|
64
64
|
* CREATE OBJECT statements
|
|
65
65
|
* RAISE EVENT statements
|
|
66
66
|
|
|
67
|
-
https://github.com/SAP/styleguides/blob/
|
|
67
|
+
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#align-parameters
|
|
68
68
|
|
|
69
69
|
Does not take effect on non functional method calls, use https://rules.abaplint.org/functional_writing/
|
|
70
70
|
|
|
@@ -57,7 +57,7 @@ class ConstantClasses {
|
|
|
57
57
|
key: "constant_classes",
|
|
58
58
|
title: "Validate constant classes",
|
|
59
59
|
shortDescription: `Checks that a class contains exactly the constants corresponding to a domain's fixed values.`,
|
|
60
|
-
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-
|
|
60
|
+
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-enum-to-constants-interfaces`,
|
|
61
61
|
tags: [_irule_1.RuleTag.Styleguide],
|
|
62
62
|
};
|
|
63
63
|
}
|
|
@@ -2885,6 +2885,10 @@ ${indentation} output = ${uniqueName}.\n`;
|
|
|
2885
2885
|
if (!(high.get() instanceof Statements.CallTransaction)) {
|
|
2886
2886
|
return undefined;
|
|
2887
2887
|
}
|
|
2888
|
+
else if (this.lowReg.getConfig().isOpenABAP()) {
|
|
2889
|
+
// open-abap supports the addition
|
|
2890
|
+
return undefined;
|
|
2891
|
+
}
|
|
2888
2892
|
const tokens = high.getTokens();
|
|
2889
2893
|
// the lexer splits "AUTHORITY-CHECK" into three tokens: AUTHORITY, -, CHECK
|
|
2890
2894
|
for (let i = 1; i < tokens.length - 3; i++) {
|
package/build/src/rules/index.js
CHANGED
|
@@ -148,6 +148,7 @@ __exportStar(require("./prefer_inline"), exports);
|
|
|
148
148
|
__exportStar(require("./prefer_insert_into_table"), exports);
|
|
149
149
|
__exportStar(require("./prefer_is_not"), exports);
|
|
150
150
|
__exportStar(require("./prefer_pragmas"), exports);
|
|
151
|
+
__exportStar(require("./prefer_abap_bool"), exports);
|
|
151
152
|
__exportStar(require("./prefer_raise_exception_new"), exports);
|
|
152
153
|
__exportStar(require("./prefer_returning_to_exporting"), exports);
|
|
153
154
|
__exportStar(require("./prefer_xsdbool"), exports);
|
|
@@ -146,7 +146,7 @@ class KeywordCase extends _abap_rule_1.ABAPRule {
|
|
|
146
146
|
key: "keyword_case",
|
|
147
147
|
title: "Keyword case",
|
|
148
148
|
shortDescription: `Checks that keywords have the same case. Non-keywords must be lower case.`,
|
|
149
|
-
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-your-
|
|
149
|
+
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-your-teams-abap-formatter-settings`,
|
|
150
150
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
|
|
151
151
|
badExample: `write 'hello world'.`,
|
|
152
152
|
goodExample: `WRITE 'hello world'.`,
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.PreferAbapBool = exports.PreferAbapBoolConf = void 0;
|
|
37
|
+
const issue_1 = require("../issue");
|
|
38
|
+
const _abap_rule_1 = require("./_abap_rule");
|
|
39
|
+
const Expressions = __importStar(require("../abap/2_statements/expressions"));
|
|
40
|
+
const Statements = __importStar(require("../abap/2_statements/statements"));
|
|
41
|
+
const _basic_rule_config_1 = require("./_basic_rule_config");
|
|
42
|
+
const _irule_1 = require("./_irule");
|
|
43
|
+
const edit_helper_1 = require("../edit_helper");
|
|
44
|
+
const FORBIDDEN_TYPES = new Set(["XFELD", "SAP_BOOL", "BOOLE_D", "FLAG"]);
|
|
45
|
+
class PreferAbapBoolConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
46
|
+
}
|
|
47
|
+
exports.PreferAbapBoolConf = PreferAbapBoolConf;
|
|
48
|
+
class PreferAbapBool extends _abap_rule_1.ABAPRule {
|
|
49
|
+
constructor() {
|
|
50
|
+
super(...arguments);
|
|
51
|
+
this.conf = new PreferAbapBoolConf();
|
|
52
|
+
}
|
|
53
|
+
getMetadata() {
|
|
54
|
+
return {
|
|
55
|
+
key: "prefer_abap_bool",
|
|
56
|
+
title: "Prefer abap_bool",
|
|
57
|
+
shortDescription: `Use abap_bool instead of XFELD, SAP_BOOL, BOOLE_D, FLAG for boolean variables`,
|
|
58
|
+
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-abap_bool-for-booleans`,
|
|
59
|
+
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
|
|
60
|
+
badExample: `DATA foo TYPE xfeld.`,
|
|
61
|
+
goodExample: `DATA foo TYPE abap_bool.`,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
getConfig() {
|
|
65
|
+
return this.conf;
|
|
66
|
+
}
|
|
67
|
+
setConfig(conf) {
|
|
68
|
+
this.conf = conf;
|
|
69
|
+
}
|
|
70
|
+
runParsed(file) {
|
|
71
|
+
const issues = [];
|
|
72
|
+
const structure = file.getStructure();
|
|
73
|
+
if (structure === undefined) {
|
|
74
|
+
return [];
|
|
75
|
+
}
|
|
76
|
+
const statements = [
|
|
77
|
+
...structure.findAllStatements(Statements.Data),
|
|
78
|
+
...structure.findAllStatements(Statements.ClassData),
|
|
79
|
+
...structure.findAllStatements(Statements.Constant),
|
|
80
|
+
...structure.findAllStatements(Statements.Type),
|
|
81
|
+
...structure.findAllStatements(Statements.FieldSymbol),
|
|
82
|
+
];
|
|
83
|
+
for (const stat of statements) {
|
|
84
|
+
const typeNameExpr = stat.findFirstExpression(Expressions.TypeName);
|
|
85
|
+
if (typeNameExpr === undefined) {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
const typeName = typeNameExpr.concatTokens().toUpperCase();
|
|
89
|
+
if (FORBIDDEN_TYPES.has(typeName) === false) {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
const token = typeNameExpr.getFirstToken();
|
|
93
|
+
const fix = edit_helper_1.EditHelper.replaceToken(file, token, "abap_bool");
|
|
94
|
+
issues.push(issue_1.Issue.atToken(file, token, `Use abap_bool instead of ${typeName}`, this.getMetadata().key, this.conf.severity, fix));
|
|
95
|
+
}
|
|
96
|
+
return issues;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.PreferAbapBool = PreferAbapBool;
|
|
100
|
+
//# sourceMappingURL=prefer_abap_bool.js.map
|
|
@@ -53,9 +53,8 @@ class PreferInsertIntoTable extends _abap_rule_1.ABAPRule {
|
|
|
53
53
|
key: "prefer_insert_into_table",
|
|
54
54
|
title: "Prefer INSERT INTO TABLE over APPEND",
|
|
55
55
|
shortDescription: `Prefer INSERT INTO TABLE over APPEND`,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md`,
|
|
56
|
+
// eslint-disable-next-line max-len
|
|
57
|
+
extendedInformation: `INSERT INTO TABLE respects the table type, while APPEND always tries to add to the end. This will dump if the sort order of a sorted table would change.\n\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-insert-into-table-to-append-to`,
|
|
59
58
|
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix],
|
|
60
59
|
badExample: `APPEND row TO itab.`,
|
|
61
60
|
goodExample: `INSERT row INTO TABLE itab.`,
|
|
@@ -30,6 +30,8 @@ class SequentialBlank extends _abap_rule_1.ABAPRule {
|
|
|
30
30
|
key: "sequential_blank",
|
|
31
31
|
title: "Sequential blank lines",
|
|
32
32
|
shortDescription: `Checks that code does not contain more than the configured number of blank lines in a row.`,
|
|
33
|
+
// eslint-disable-next-line max-len
|
|
34
|
+
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#add-a-single-blank-line-to-separate-things-but-not-more`,
|
|
33
35
|
tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],
|
|
34
36
|
};
|
|
35
37
|
}
|