@abaplint/core 2.85.7 → 2.85.11
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/README.md +6 -6
- package/build/src/abap/2_statements/combi.js +20 -4
- package/build/src/abap/2_statements/expressions/simple_source3.js +1 -1
- package/build/src/abap/2_statements/expressions/sql_cds_parameters.js +1 -1
- package/build/src/abap/2_statements/expressions/sql_compare.js +7 -7
- package/build/src/abap/2_statements/expressions/sql_from_source.js +1 -1
- package/build/src/abap/2_statements/expressions/sql_source.js +2 -3
- package/build/src/abap/2_statements/expressions/sql_source_simple.js +3 -3
- package/build/src/abap/2_statements/expressions/type_table_key.js +1 -1
- package/build/src/abap/5_syntax/_type_utils.js +11 -4
- package/build/src/abap/5_syntax/expressions/attribute_chain.js +1 -1
- package/build/src/abap/5_syntax/expressions/constant.js +3 -0
- package/build/src/abap/5_syntax/expressions/field_chain.js +3 -0
- package/build/src/abap/5_syntax/expressions/select.js +3 -0
- package/build/src/abap/5_syntax/expressions/sql_for_all_entries.js +4 -1
- package/build/src/abap/5_syntax/statements/create_data.js +5 -0
- package/build/src/abap/5_syntax/statements/delete_database.js +3 -0
- package/build/src/abap/5_syntax/statements/insert_database.js +3 -0
- package/build/src/abap/5_syntax/statements/modify_database.js +7 -0
- package/build/src/abap/5_syntax/statements/update_database.js +3 -0
- package/build/src/abap/5_syntax/statements/write.js +8 -1
- package/build/src/abap/flow/flow_graph.js +7 -7
- package/build/src/abap/types/basic/structure_type.js +1 -1
- package/build/src/lsp/help.js +7 -7
- package/build/src/registry.js +1 -1
- package/build/src/rules/7bit_ascii.js +2 -2
- package/build/src/rules/abapdoc.js +1 -1
- package/build/src/rules/align_parameters.js +33 -33
- package/build/src/rules/ambiguous_statement.js +5 -5
- package/build/src/rules/avoid_use.js +6 -6
- package/build/src/rules/begin_end_names.js +4 -4
- package/build/src/rules/begin_single_include.js +12 -12
- package/build/src/rules/call_transaction_authority_check.js +3 -3
- package/build/src/rules/chain_mainly_declarations.js +4 -4
- package/build/src/rules/check_abstract.js +2 -2
- package/build/src/rules/check_comments.js +4 -4
- package/build/src/rules/check_include.js +3 -3
- package/build/src/rules/check_no_handler_pragma.js +8 -8
- package/build/src/rules/check_subrc.js +8 -8
- package/build/src/rules/commented_code.js +1 -1
- package/build/src/rules/constructor_visibility_public.js +4 -4
- package/build/src/rules/contains_tab.js +2 -2
- package/build/src/rules/dangerous_statement.js +1 -1
- package/build/src/rules/downport.js +45 -45
- package/build/src/rules/exit_or_check.js +3 -3
- package/build/src/rules/exporting.js +1 -1
- package/build/src/rules/forbidden_identifier.js +1 -1
- package/build/src/rules/forbidden_void_type.js +2 -2
- package/build/src/rules/functional_writing.js +17 -17
- package/build/src/rules/global_class.js +10 -10
- package/build/src/rules/identical_conditions.js +2 -2
- package/build/src/rules/identical_contents.js +15 -15
- package/build/src/rules/identical_descriptions.js +4 -4
- package/build/src/rules/if_in_if.js +7 -7
- package/build/src/rules/implement_methods.js +3 -3
- package/build/src/rules/in_statement_indentation.js +11 -11
- package/build/src/rules/intf_referencing_clas.js +3 -3
- package/build/src/rules/line_break_style.js +2 -2
- package/build/src/rules/line_length.js +1 -1
- package/build/src/rules/line_only_punc.js +1 -1
- package/build/src/rules/local_testclass_location.js +5 -0
- package/build/src/rules/local_variable_names.js +2 -2
- package/build/src/rules/many_parentheses.js +10 -10
- package/build/src/rules/max_one_method_parameter_per_line.js +7 -7
- package/build/src/rules/max_one_statement.js +3 -3
- package/build/src/rules/nesting.js +1 -1
- package/build/src/rules/no_chained_assignment.js +1 -1
- package/build/src/rules/no_public_attributes.js +1 -1
- package/build/src/rules/no_yoda_conditions.js +4 -4
- package/build/src/rules/obsolete_statement.js +40 -40
- package/build/src/rules/omit_parameter_name.js +3 -3
- package/build/src/rules/omit_receiving.js +13 -13
- package/build/src/rules/parser_702_chaining.js +2 -2
- package/build/src/rules/parser_error.js +2 -2
- package/build/src/rules/parser_missing_space.js +1 -1
- package/build/src/rules/prefer_inline.js +16 -16
- package/build/src/rules/prefer_is_not.js +7 -7
- package/build/src/rules/prefer_raise_exception_new.js +3 -3
- package/build/src/rules/prefer_returning_to_exporting.js +1 -1
- package/build/src/rules/prefer_xsdbool.js +2 -2
- package/build/src/rules/remove_descriptions.js +4 -4
- package/build/src/rules/rfc_error_handling.js +9 -9
- package/build/src/rules/select_add_order_by.js +5 -5
- package/build/src/rules/select_performance.js +2 -2
- package/build/src/rules/sicf_consistency.js +4 -4
- package/build/src/rules/space_before_dot.js +2 -2
- package/build/src/rules/sql_escape_host_variables.js +2 -1
- package/build/src/rules/start_at_tab.js +1 -1
- package/build/src/rules/sy_modification.js +2 -2
- package/build/src/rules/tabl_enhancement_category.js +2 -2
- package/build/src/rules/unused_methods.js +9 -9
- package/build/src/rules/unused_variables.js +6 -6
- package/build/src/rules/use_bool_expression.js +8 -8
- package/build/src/rules/use_line_exists.js +6 -6
- package/build/src/rules/use_new.js +2 -2
- package/build/src/rules/when_others_last.js +6 -6
- package/package.json +66 -66
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# @abaplint/core
|
|
2
|
-
|
|
3
|
-
[abaplint](https://abaplint.org/) core library
|
|
4
|
-
|
|
5
|
-
Exposes functionallity like the parser and rules, which can be used in other projects.
|
|
6
|
-
|
|
1
|
+
# @abaplint/core
|
|
2
|
+
|
|
3
|
+
[abaplint](https://abaplint.org/) core library
|
|
4
|
+
|
|
5
|
+
Exposes functionallity like the parser and rules, which can be used in other projects.
|
|
6
|
+
|
|
7
7
|
For more information see https://github.com/abaplint/abaplint
|
|
@@ -313,13 +313,19 @@ class StarPrioroity {
|
|
|
313
313
|
res = this.sta.run(res);
|
|
314
314
|
if (res.length === 0) {
|
|
315
315
|
if (prev !== undefined) {
|
|
316
|
-
|
|
316
|
+
// console.log("star length: " + prev.length);
|
|
317
|
+
let best = Number.MAX_SAFE_INTEGER;
|
|
318
|
+
for (const p of prev) {
|
|
319
|
+
if (p.remainingLength() < best) {
|
|
320
|
+
result = [p];
|
|
321
|
+
best = p.remainingLength();
|
|
322
|
+
}
|
|
323
|
+
}
|
|
317
324
|
}
|
|
318
325
|
break;
|
|
319
326
|
}
|
|
320
327
|
prev = res;
|
|
321
328
|
}
|
|
322
|
-
// console.dir(result);
|
|
323
329
|
return result;
|
|
324
330
|
}
|
|
325
331
|
railroad() {
|
|
@@ -401,13 +407,17 @@ class Sequence {
|
|
|
401
407
|
const result = [];
|
|
402
408
|
for (const input of r) {
|
|
403
409
|
let temp = [input];
|
|
410
|
+
let match = true;
|
|
404
411
|
for (const sequence of this.list) {
|
|
405
412
|
temp = sequence.run(temp);
|
|
406
413
|
if (temp.length === 0) {
|
|
414
|
+
match = false;
|
|
407
415
|
break;
|
|
408
416
|
}
|
|
409
417
|
}
|
|
410
|
-
|
|
418
|
+
if (match === true) {
|
|
419
|
+
result.push(...temp);
|
|
420
|
+
}
|
|
411
421
|
}
|
|
412
422
|
return result;
|
|
413
423
|
}
|
|
@@ -702,7 +712,13 @@ class Combi {
|
|
|
702
712
|
this.ver = version;
|
|
703
713
|
const input = new result_1.Result(tokens, 0);
|
|
704
714
|
const result = runnable.run([input]);
|
|
705
|
-
|
|
715
|
+
/*
|
|
716
|
+
console.log("res: " + result.length);
|
|
717
|
+
for (const res of result) {
|
|
718
|
+
console.dir(res.getNodes().map(n => n.get().constructor.name));
|
|
719
|
+
console.dir(res.getNodes().map(n => n.concatTokens()));
|
|
720
|
+
}
|
|
721
|
+
*/
|
|
706
722
|
for (const res of result) {
|
|
707
723
|
if (res.remainingLength() === 0) {
|
|
708
724
|
return res.getNodes();
|
|
@@ -5,7 +5,7 @@ const combi_1 = require("../combi");
|
|
|
5
5
|
const _1 = require(".");
|
|
6
6
|
class SimpleSource3 extends combi_1.Expression {
|
|
7
7
|
getRunnable() {
|
|
8
|
-
return (0, combi_1.
|
|
8
|
+
return (0, combi_1.altPrio)(_1.Constant, _1.TextElement, _1.FieldChain);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
exports.SimpleSource3 = SimpleSource3;
|
|
@@ -8,7 +8,7 @@ const field_chain_1 = require("./field_chain");
|
|
|
8
8
|
class SQLCDSParameters extends combi_1.Expression {
|
|
9
9
|
getRunnable() {
|
|
10
10
|
const param = (0, combi_1.seq)(_1.Field, "=", (0, combi_1.alt)((0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), field_chain_1.FieldChain), _1.Constant));
|
|
11
|
-
return (0, combi_1.seq)("(", param, (0, combi_1.
|
|
11
|
+
return (0, combi_1.seq)("(", param, (0, combi_1.starPrio)((0, combi_1.seq)(",", param)), ")");
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
exports.SQLCDSParameters = SQLCDSParameters;
|
|
@@ -10,15 +10,15 @@ class SQLCompare extends combi_1.Expression {
|
|
|
10
10
|
const val = new _1.SQLSource();
|
|
11
11
|
const list = (0, combi_1.seq)((0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenLeft), (0, combi_1.tok)(tokens_1.WParenLeftW)), val, (0, combi_1.starPrio)((0, combi_1.seq)(",", val)), ")");
|
|
12
12
|
const subSelect = (0, combi_1.seq)("(", _1.Select, ")");
|
|
13
|
-
const inn = (0, combi_1.seq)(
|
|
14
|
-
const between = (0, combi_1.seq)(
|
|
15
|
-
const like = (0, combi_1.seq)(
|
|
16
|
-
const nul = (0, combi_1.seq)("IS", (0, combi_1.optPrio)("NOT"), (0, combi_1.
|
|
13
|
+
const inn = (0, combi_1.seq)("IN", (0, combi_1.altPrio)(_1.SQLSource, list, subSelect));
|
|
14
|
+
const between = (0, combi_1.seq)("BETWEEN", _1.SQLSource, "AND", _1.SQLSource);
|
|
15
|
+
const like = (0, combi_1.seq)("LIKE", _1.SQLSource, (0, combi_1.optPrio)((0, combi_1.seq)("ESCAPE", _1.SQLSource)));
|
|
16
|
+
const nul = (0, combi_1.seq)("IS", (0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)("NULL", (0, combi_1.ver)(version_1.Version.v753, "INITIAL")));
|
|
17
17
|
const source = new _1.SQLSource();
|
|
18
18
|
const sub = (0, combi_1.seq)((0, combi_1.optPrio)((0, combi_1.altPrio)("ALL", "ANY", "SOME")), subSelect);
|
|
19
|
-
const builtin = (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)((0, combi_1.
|
|
20
|
-
const arith = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.
|
|
21
|
-
const rett = (0, combi_1.seq)((0, combi_1.altPrio)(builtin,
|
|
19
|
+
const builtin = (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)((0, combi_1.altPrio)("lower", "upper"), (0, combi_1.tok)(tokens_1.ParenLeftW), _1.SQLFieldName, (0, combi_1.tok)(tokens_1.WParenRightW)));
|
|
20
|
+
const arith = (0, combi_1.ver)(version_1.Version.v750, (0, combi_1.plusPrio)((0, combi_1.seq)((0, combi_1.altPrio)("+", "-", "*", "/"), _1.SQLFieldName)));
|
|
21
|
+
const rett = (0, combi_1.seq)((0, combi_1.altPrio)(builtin, (0, combi_1.seq)(_1.SQLFieldName, (0, combi_1.optPrio)(arith))), (0, combi_1.altPrio)((0, combi_1.seq)(_1.SQLCompareOperator, (0, combi_1.altPrio)(sub, source)), (0, combi_1.seq)((0, combi_1.optPrio)("NOT"), (0, combi_1.altPrio)(inn, like, between)), nul));
|
|
22
22
|
const exists = (0, combi_1.seq)("EXISTS", subSelect);
|
|
23
23
|
return (0, combi_1.altPrio)(exists, _1.Dynamic, rett);
|
|
24
24
|
}
|
|
@@ -11,7 +11,7 @@ class SQLFromSource extends combi_1.Expression {
|
|
|
11
11
|
// https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abennews-752-open_sql.htm#!ABAP_MODIFICATION_1@1@
|
|
12
12
|
const tab = (0, combi_1.ver)(version_1.Version.v752, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), _1.FieldChain));
|
|
13
13
|
const aas = (0, combi_1.seq)("AS", _1.SQLAsName);
|
|
14
|
-
return (0, combi_1.seq)((0, combi_1.altPrio)(
|
|
14
|
+
return (0, combi_1.seq)((0, combi_1.altPrio)(with_name_1.WithName, (0, combi_1.seq)(_1.DatabaseTable, (0, combi_1.optPrio)(_1.SQLCDSParameters)), tab), (0, combi_1.optPrio)((0, combi_1.ver)(version_1.Version.v752, "WITH PRIVILEGED ACCESS")), (0, combi_1.optPrio)(aas));
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
exports.SQLFromSource = SQLFromSource;
|
|
@@ -8,9 +8,8 @@ const _1 = require(".");
|
|
|
8
8
|
class SQLSource extends combi_1.Expression {
|
|
9
9
|
getRunnable() {
|
|
10
10
|
const paren = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), _1.Source, (0, combi_1.tok)(tokens_1.WParenRightW));
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return (0, combi_1.alt)(_1.SQLAliasField, _1.Source, at);
|
|
11
|
+
const at = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), (0, combi_1.altPrio)(_1.SimpleSource3, paren)));
|
|
12
|
+
return (0, combi_1.alt)(_1.SQLAliasField, _1.SimpleSource3, at);
|
|
14
13
|
}
|
|
15
14
|
}
|
|
16
15
|
exports.SQLSource = SQLSource;
|
|
@@ -5,12 +5,12 @@ const combi_1 = require("../combi");
|
|
|
5
5
|
const version_1 = require("../../../version");
|
|
6
6
|
const tokens_1 = require("../../1_lexer/tokens");
|
|
7
7
|
const _1 = require(".");
|
|
8
|
-
|
|
8
|
+
// todo, delete this expression, its the same as SQLSource?
|
|
9
9
|
class SQLSourceSimple extends combi_1.Expression {
|
|
10
10
|
getRunnable() {
|
|
11
11
|
const paren = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), _1.Source, (0, combi_1.tok)(tokens_1.WParenRightW));
|
|
12
|
-
const at = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), (0, combi_1.alt)(_1.
|
|
13
|
-
return (0, combi_1.alt)(_1.
|
|
12
|
+
const at = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), (0, combi_1.alt)(_1.SimpleSource3, paren)));
|
|
13
|
+
return (0, combi_1.alt)(_1.SimpleSource3, at);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
exports.SQLSourceSimple = SQLSourceSimple;
|
|
@@ -9,7 +9,7 @@ class TypeTableKey extends combi_1.Expression {
|
|
|
9
9
|
const uniqueness = (0, combi_1.alt)("NON-UNIQUE", "UNIQUE");
|
|
10
10
|
const defaultKey = "DEFAULT KEY";
|
|
11
11
|
const emptyKey = (0, combi_1.ver)(version_1.Version.v740sp02, "EMPTY KEY");
|
|
12
|
-
const key = (0, combi_1.seq)("WITH", (0, combi_1.opt)(uniqueness), (0, combi_1.altPrio)(defaultKey, emptyKey, (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.alt)("SORTED", "HASHED")), "KEY", (0, combi_1.alt)((0, combi_1.seq)(_1.Field, "COMPONENTS", (0, combi_1.plus)(_1.FieldSub)), (0, combi_1.plus)(_1.FieldSub)))));
|
|
12
|
+
const key = (0, combi_1.seq)("WITH", (0, combi_1.opt)(uniqueness), (0, combi_1.altPrio)(defaultKey, emptyKey, (0, combi_1.seq)((0, combi_1.opt)((0, combi_1.alt)("SORTED", "HASHED")), "KEY", (0, combi_1.alt)((0, combi_1.seq)(_1.Field, "COMPONENTS", (0, combi_1.plus)(_1.FieldSub)), (0, combi_1.plus)(_1.FieldSub)))), (0, combi_1.optPrio)("READ-ONLY"));
|
|
13
13
|
return key;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -20,6 +20,8 @@ class TypeUtils {
|
|
|
20
20
|
|| type instanceof basic_1.AnyType
|
|
21
21
|
|| type instanceof basic_1.UnknownType
|
|
22
22
|
|| type instanceof basic_1.NumericType
|
|
23
|
+
|| type instanceof basic_1.IntegerType
|
|
24
|
+
|| type instanceof basic_1.NumericGenericType
|
|
23
25
|
|| type instanceof basic_1.CSequenceType
|
|
24
26
|
|| type instanceof basic_1.DateType
|
|
25
27
|
|| type instanceof basic_1.CLikeType
|
|
@@ -53,8 +55,8 @@ class TypeUtils {
|
|
|
53
55
|
}
|
|
54
56
|
static isAssignable(source, target) {
|
|
55
57
|
/*
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
console.dir(source);
|
|
59
|
+
console.dir(target);
|
|
58
60
|
*/
|
|
59
61
|
if (target instanceof basic_1.TableType) {
|
|
60
62
|
if (target.isWithHeader()) {
|
|
@@ -97,8 +99,13 @@ class TypeUtils {
|
|
|
97
99
|
|| source instanceof basic_1.UnknownType) {
|
|
98
100
|
return true;
|
|
99
101
|
}
|
|
100
|
-
else if (
|
|
101
|
-
|
|
102
|
+
else if (target.containsVoid() === true) {
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
else if (source instanceof basic_1.IntegerType) {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
else if (this.isCharLike(target) && this.isCharLike(source)) {
|
|
102
109
|
return true;
|
|
103
110
|
}
|
|
104
111
|
return false;
|
|
@@ -18,7 +18,7 @@ class AttributeChain {
|
|
|
18
18
|
if (!(first.get() instanceof expressions_1.AttributeName)) {
|
|
19
19
|
throw new Error("AttributeChain, unexpected first child");
|
|
20
20
|
}
|
|
21
|
-
const def = scope.
|
|
21
|
+
const def = scope.findObjectDefinition(inputContext.getIdentifierName());
|
|
22
22
|
if (def === undefined) {
|
|
23
23
|
throw new Error("Definition for \"" + inputContext.getIdentifierName() + "\" not found in scope(AttributeChain)");
|
|
24
24
|
}
|
|
@@ -8,6 +8,9 @@ class Constant {
|
|
|
8
8
|
if (node.findDirectExpression(expressions_1.Integer)) {
|
|
9
9
|
return new basic_1.IntegerType("I");
|
|
10
10
|
}
|
|
11
|
+
else if (node.getFirstToken().getStr().startsWith("'")) {
|
|
12
|
+
return new basic_1.CharacterType(10);
|
|
13
|
+
}
|
|
11
14
|
else {
|
|
12
15
|
return new basic_1.StringType("STRING");
|
|
13
16
|
}
|
|
@@ -70,6 +70,9 @@ class FieldChain {
|
|
|
70
70
|
context = new dereference_1.Dereference().runSyntax(context);
|
|
71
71
|
}
|
|
72
72
|
else if (current.get() instanceof Expressions.ComponentName) {
|
|
73
|
+
if (context instanceof basic_1.TableType && context.isWithHeader()) {
|
|
74
|
+
context = context.getRowType();
|
|
75
|
+
}
|
|
73
76
|
context = new component_name_1.ComponentName().runSyntax(context, current);
|
|
74
77
|
}
|
|
75
78
|
else if (current instanceof nodes_1.ExpressionNode
|
|
@@ -45,6 +45,9 @@ class Select {
|
|
|
45
45
|
for (const s of node.findAllExpressions(Expressions.Source)) {
|
|
46
46
|
new source_1.Source().runSyntax(s, scope, filename);
|
|
47
47
|
}
|
|
48
|
+
for (const s of node.findAllExpressions(Expressions.SimpleSource3)) {
|
|
49
|
+
new source_1.Source().runSyntax(s, scope, filename);
|
|
50
|
+
}
|
|
48
51
|
if (scope.getType() === _scope_type_1.ScopeType.OpenSQL) {
|
|
49
52
|
scope.pop(node.getLastToken().getEnd());
|
|
50
53
|
}
|
|
@@ -6,7 +6,10 @@ const source_1 = require("./source");
|
|
|
6
6
|
const basic_1 = require("../../types/basic");
|
|
7
7
|
class SQLForAllEntries {
|
|
8
8
|
runSyntax(node, scope, filename) {
|
|
9
|
-
|
|
9
|
+
let s = node.findFirstExpression(Expressions.Source);
|
|
10
|
+
if (s === undefined) {
|
|
11
|
+
s = node.findFirstExpression(Expressions.SimpleSource3);
|
|
12
|
+
}
|
|
10
13
|
if (s) {
|
|
11
14
|
const type = new source_1.Source().runSyntax(s, scope, filename);
|
|
12
15
|
if (type instanceof basic_1.VoidType) {
|
|
@@ -5,6 +5,7 @@ const Expressions = require("../../2_statements/expressions");
|
|
|
5
5
|
const target_1 = require("../expressions/target");
|
|
6
6
|
const source_1 = require("../expressions/source");
|
|
7
7
|
const dynamic_1 = require("../expressions/dynamic");
|
|
8
|
+
const basic_types_1 = require("../basic_types");
|
|
8
9
|
class CreateData {
|
|
9
10
|
runSyntax(node, scope, filename) {
|
|
10
11
|
for (const s of node.findDirectExpressions(Expressions.Source)) {
|
|
@@ -16,6 +17,10 @@ class CreateData {
|
|
|
16
17
|
for (const t of node.findDirectExpressions(Expressions.Dynamic)) {
|
|
17
18
|
new dynamic_1.Dynamic().runSyntax(t, scope, filename);
|
|
18
19
|
}
|
|
20
|
+
const type = node.findDirectExpression(Expressions.TypeName);
|
|
21
|
+
if (type) {
|
|
22
|
+
new basic_types_1.BasicTypes(filename, scope).resolveTypeName(type);
|
|
23
|
+
}
|
|
19
24
|
}
|
|
20
25
|
}
|
|
21
26
|
exports.CreateData = CreateData;
|
|
@@ -10,6 +10,9 @@ class DeleteDatabase {
|
|
|
10
10
|
for (const s of node.findAllExpressions(Expressions.Source)) {
|
|
11
11
|
new source_1.Source().runSyntax(s, scope, filename);
|
|
12
12
|
}
|
|
13
|
+
for (const s of node.findAllExpressions(Expressions.SimpleSource3)) {
|
|
14
|
+
new source_1.Source().runSyntax(s, scope, filename);
|
|
15
|
+
}
|
|
13
16
|
for (const d of node.findAllExpressions(Expressions.Dynamic)) {
|
|
14
17
|
new dynamic_1.Dynamic().runSyntax(d, scope, filename);
|
|
15
18
|
}
|
|
@@ -10,6 +10,9 @@ class InsertDatabase {
|
|
|
10
10
|
for (const s of node.findAllExpressions(Expressions.Source)) {
|
|
11
11
|
new source_1.Source().runSyntax(s, scope, filename);
|
|
12
12
|
}
|
|
13
|
+
for (const s of node.findAllExpressions(Expressions.SimpleSource3)) {
|
|
14
|
+
new source_1.Source().runSyntax(s, scope, filename);
|
|
15
|
+
}
|
|
13
16
|
for (const d of node.findAllExpressions(Expressions.Dynamic)) {
|
|
14
17
|
new dynamic_1.Dynamic().runSyntax(d, scope, filename);
|
|
15
18
|
}
|
|
@@ -4,6 +4,7 @@ exports.ModifyDatabase = void 0;
|
|
|
4
4
|
const Expressions = require("../../2_statements/expressions");
|
|
5
5
|
const dynamic_1 = require("../expressions/dynamic");
|
|
6
6
|
const database_table_1 = require("../expressions/database_table");
|
|
7
|
+
const source_1 = require("../expressions/source");
|
|
7
8
|
class ModifyDatabase {
|
|
8
9
|
runSyntax(node, scope, filename) {
|
|
9
10
|
for (const d of node.findAllExpressions(Expressions.Dynamic)) {
|
|
@@ -13,6 +14,12 @@ class ModifyDatabase {
|
|
|
13
14
|
if (dbtab !== undefined) {
|
|
14
15
|
new database_table_1.DatabaseTable().runSyntax(dbtab, scope, filename);
|
|
15
16
|
}
|
|
17
|
+
for (const s of node.findAllExpressions(Expressions.Source)) {
|
|
18
|
+
new source_1.Source().runSyntax(s, scope, filename);
|
|
19
|
+
}
|
|
20
|
+
for (const s of node.findAllExpressions(Expressions.SimpleSource3)) {
|
|
21
|
+
new source_1.Source().runSyntax(s, scope, filename);
|
|
22
|
+
}
|
|
16
23
|
}
|
|
17
24
|
}
|
|
18
25
|
exports.ModifyDatabase = ModifyDatabase;
|
|
@@ -32,6 +32,9 @@ class UpdateDatabase {
|
|
|
32
32
|
for (const s of node.findAllExpressions(Expressions.Source)) {
|
|
33
33
|
new source_1.Source().runSyntax(s, scope, filename);
|
|
34
34
|
}
|
|
35
|
+
for (const s of node.findAllExpressions(Expressions.SimpleSource3)) {
|
|
36
|
+
new source_1.Source().runSyntax(s, scope, filename);
|
|
37
|
+
}
|
|
35
38
|
for (const d of node.findAllExpressions(Expressions.Dynamic)) {
|
|
36
39
|
new dynamic_1.Dynamic().runSyntax(d, scope, filename);
|
|
37
40
|
}
|
|
@@ -5,11 +5,18 @@ const Expressions = require("../../2_statements/expressions");
|
|
|
5
5
|
const source_1 = require("../expressions/source");
|
|
6
6
|
const target_1 = require("../expressions/target");
|
|
7
7
|
const dynamic_1 = require("../expressions/dynamic");
|
|
8
|
+
const _type_utils_1 = require("../_type_utils");
|
|
8
9
|
class Write {
|
|
9
10
|
runSyntax(node, scope, filename) {
|
|
10
11
|
// todo, more
|
|
12
|
+
const second = node.getChildren()[1];
|
|
11
13
|
for (const s of node.findAllExpressions(Expressions.Source)) {
|
|
12
|
-
new source_1.Source().runSyntax(s, scope, filename);
|
|
14
|
+
const type = new source_1.Source().runSyntax(s, scope, filename);
|
|
15
|
+
if (s === second
|
|
16
|
+
&& _type_utils_1.TypeUtils.isCharLike(type) === false
|
|
17
|
+
&& _type_utils_1.TypeUtils.isHexLike(type) === false) {
|
|
18
|
+
throw new Error("Source not character like");
|
|
19
|
+
}
|
|
13
20
|
}
|
|
14
21
|
for (const s of node.findAllExpressions(Expressions.Dynamic)) {
|
|
15
22
|
new dynamic_1.Dynamic().runSyntax(s, scope, filename);
|
|
@@ -72,13 +72,13 @@ class FlowGraph {
|
|
|
72
72
|
this.label = label;
|
|
73
73
|
}
|
|
74
74
|
toDigraph() {
|
|
75
|
-
return `digraph G {
|
|
76
|
-
labelloc="t";
|
|
77
|
-
label="${this.label}";
|
|
78
|
-
graph [fontname = "helvetica"];
|
|
79
|
-
node [fontname = "helvetica", shape="box"];
|
|
80
|
-
edge [fontname = "helvetica"];
|
|
81
|
-
${this.toTextEdges()}
|
|
75
|
+
return `digraph G {
|
|
76
|
+
labelloc="t";
|
|
77
|
+
label="${this.label}";
|
|
78
|
+
graph [fontname = "helvetica"];
|
|
79
|
+
node [fontname = "helvetica", shape="box"];
|
|
80
|
+
edge [fontname = "helvetica"];
|
|
81
|
+
${this.toTextEdges()}
|
|
82
82
|
}`;
|
|
83
83
|
}
|
|
84
84
|
listSources(node) {
|
|
@@ -43,7 +43,7 @@ class StructureType extends _abstract_type_1.AbstractType {
|
|
|
43
43
|
return "StructureTypetoABAPtodo";
|
|
44
44
|
}
|
|
45
45
|
containsVoid() {
|
|
46
|
-
return this.getComponents().some(c => { c.type.containsVoid(); });
|
|
46
|
+
return this.getComponents().some(c => { return c.type.containsVoid(); });
|
|
47
47
|
}
|
|
48
48
|
toCDS() {
|
|
49
49
|
return "abap.TODO_STRUCTURE";
|
package/build/src/lsp/help.js
CHANGED
|
@@ -19,13 +19,13 @@ class Help {
|
|
|
19
19
|
/////////////////////////////////////////////////
|
|
20
20
|
static dumpABAP(file, reg, textDocument, position) {
|
|
21
21
|
let content = "";
|
|
22
|
-
content = `
|
|
23
|
-
<a href="#_tokens" rel="no-refresh">Tokens</a> |
|
|
24
|
-
<a href="#_statements" rel="no-refresh">Statements</a> |
|
|
25
|
-
<a href="#_structure" rel="no-refresh">Structure</a> |
|
|
26
|
-
<a href="#_files" rel="no-refresh">Files</a> |
|
|
27
|
-
<a href="#_info" rel="no-refresh">Info Dump</a>
|
|
28
|
-
<hr>
|
|
22
|
+
content = `
|
|
23
|
+
<a href="#_tokens" rel="no-refresh">Tokens</a> |
|
|
24
|
+
<a href="#_statements" rel="no-refresh">Statements</a> |
|
|
25
|
+
<a href="#_structure" rel="no-refresh">Structure</a> |
|
|
26
|
+
<a href="#_files" rel="no-refresh">Files</a> |
|
|
27
|
+
<a href="#_info" rel="no-refresh">Info Dump</a>
|
|
28
|
+
<hr>
|
|
29
29
|
` +
|
|
30
30
|
"<tt>" + textDocument.uri + " (" +
|
|
31
31
|
(position.line + 1) + ", " +
|
package/build/src/registry.js
CHANGED
|
@@ -17,8 +17,8 @@ class SevenBitAscii {
|
|
|
17
17
|
key: "7bit_ascii",
|
|
18
18
|
title: "Check for 7bit ascii",
|
|
19
19
|
shortDescription: `Only allow characters from the 7bit ASCII set.`,
|
|
20
|
-
extendedInformation: `https://docs.abapopenchecks.org/checks/05/
|
|
21
|
-
|
|
20
|
+
extendedInformation: `https://docs.abapopenchecks.org/checks/05/
|
|
21
|
+
|
|
22
22
|
Checkes files with extension ".abap" and ".asddls"`,
|
|
23
23
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
24
24
|
};
|
|
@@ -23,7 +23,7 @@ class Abapdoc extends _abap_rule_1.ABAPRule {
|
|
|
23
23
|
return {
|
|
24
24
|
key: "abapdoc",
|
|
25
25
|
title: "Check abapdoc",
|
|
26
|
-
shortDescription: `Various checks regarding abapdoc.
|
|
26
|
+
shortDescription: `Various checks regarding abapdoc.
|
|
27
27
|
Base rule checks for existence of abapdoc for public class methods and all interface methods.`,
|
|
28
28
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
29
29
|
};
|
|
@@ -20,42 +20,42 @@ class AlignParameters extends _abap_rule_1.ABAPRule {
|
|
|
20
20
|
key: "align_parameters",
|
|
21
21
|
title: "Align Parameters",
|
|
22
22
|
shortDescription: `Checks for vertially aligned parameters`,
|
|
23
|
-
extendedInformation: `Checks:
|
|
24
|
-
* function module calls
|
|
25
|
-
* method calls
|
|
26
|
-
* VALUE constructors
|
|
27
|
-
* NEW constructors
|
|
28
|
-
* RAISE EXCEPTION statements
|
|
29
|
-
* CREATE OBJECT statements
|
|
30
|
-
* RAISE EVENT statements
|
|
31
|
-
|
|
32
|
-
https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#align-parameters
|
|
33
|
-
|
|
34
|
-
Does not take effect on non functional method calls, use https://rules.abaplint.org/functional_writing/
|
|
35
|
-
|
|
23
|
+
extendedInformation: `Checks:
|
|
24
|
+
* function module calls
|
|
25
|
+
* method calls
|
|
26
|
+
* VALUE constructors
|
|
27
|
+
* NEW constructors
|
|
28
|
+
* RAISE EXCEPTION statements
|
|
29
|
+
* CREATE OBJECT statements
|
|
30
|
+
* RAISE EVENT statements
|
|
31
|
+
|
|
32
|
+
https://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#align-parameters
|
|
33
|
+
|
|
34
|
+
Does not take effect on non functional method calls, use https://rules.abaplint.org/functional_writing/
|
|
35
|
+
|
|
36
36
|
Also https://rules.abaplint.org/max_one_method_parameter_per_line/ can help aligning parameter syntax`,
|
|
37
37
|
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Styleguide],
|
|
38
|
-
badExample: `CALL FUNCTION 'FOOBAR'
|
|
39
|
-
EXPORTING
|
|
40
|
-
foo = 2
|
|
41
|
-
parameter = 3.
|
|
42
|
-
|
|
43
|
-
foobar( moo = 1
|
|
44
|
-
param = 1 ).
|
|
45
|
-
|
|
46
|
-
foo = VALUE #(
|
|
47
|
-
foo = bar
|
|
38
|
+
badExample: `CALL FUNCTION 'FOOBAR'
|
|
39
|
+
EXPORTING
|
|
40
|
+
foo = 2
|
|
41
|
+
parameter = 3.
|
|
42
|
+
|
|
43
|
+
foobar( moo = 1
|
|
44
|
+
param = 1 ).
|
|
45
|
+
|
|
46
|
+
foo = VALUE #(
|
|
47
|
+
foo = bar
|
|
48
48
|
moo = 2 ).`,
|
|
49
|
-
goodExample: `CALL FUNCTION 'FOOBAR'
|
|
50
|
-
EXPORTING
|
|
51
|
-
foo = 2
|
|
52
|
-
parameter = 3.
|
|
53
|
-
|
|
54
|
-
foobar( moo = 1
|
|
55
|
-
param = 1 ).
|
|
56
|
-
|
|
57
|
-
foo = VALUE #(
|
|
58
|
-
foo = bar
|
|
49
|
+
goodExample: `CALL FUNCTION 'FOOBAR'
|
|
50
|
+
EXPORTING
|
|
51
|
+
foo = 2
|
|
52
|
+
parameter = 3.
|
|
53
|
+
|
|
54
|
+
foobar( moo = 1
|
|
55
|
+
param = 1 ).
|
|
56
|
+
|
|
57
|
+
foo = VALUE #(
|
|
58
|
+
foo = bar
|
|
59
59
|
moo = 2 ).`,
|
|
60
60
|
};
|
|
61
61
|
}
|
|
@@ -20,14 +20,14 @@ class AmbiguousStatement extends _abap_rule_1.ABAPRule {
|
|
|
20
20
|
return {
|
|
21
21
|
key: "ambiguous_statement",
|
|
22
22
|
title: "Check for ambigious statements",
|
|
23
|
-
shortDescription: `Checks for ambiguity between deleting or modifying from internal and database table
|
|
24
|
-
Add "TABLE" keyword or "@" for escaping SQL variables
|
|
25
|
-
|
|
23
|
+
shortDescription: `Checks for ambiguity between deleting or modifying from internal and database table
|
|
24
|
+
Add "TABLE" keyword or "@" for escaping SQL variables
|
|
25
|
+
|
|
26
26
|
Only works if the target version is 740sp05 or above`,
|
|
27
27
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
28
|
-
badExample: `DELETE foo FROM bar.
|
|
28
|
+
badExample: `DELETE foo FROM bar.
|
|
29
29
|
MODIFY foo FROM bar.`,
|
|
30
|
-
goodExample: `DELETE foo FROM @bar.
|
|
30
|
+
goodExample: `DELETE foo FROM @bar.
|
|
31
31
|
MODIFY TABLE foo FROM bar.`,
|
|
32
32
|
};
|
|
33
33
|
}
|
|
@@ -35,12 +35,12 @@ class AvoidUse extends _abap_rule_1.ABAPRule {
|
|
|
35
35
|
key: "avoid_use",
|
|
36
36
|
title: "Avoid use of certain statements",
|
|
37
37
|
shortDescription: `Detects usage of certain statements.`,
|
|
38
|
-
extendedInformation: `DEFAULT KEY: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-default-key
|
|
39
|
-
|
|
40
|
-
Macros: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abenmacros_guidl.htm
|
|
41
|
-
|
|
42
|
-
STATICS: use CLASS-DATA instead
|
|
43
|
-
|
|
38
|
+
extendedInformation: `DEFAULT KEY: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-default-key
|
|
39
|
+
|
|
40
|
+
Macros: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abenmacros_guidl.htm
|
|
41
|
+
|
|
42
|
+
STATICS: use CLASS-DATA instead
|
|
43
|
+
|
|
44
44
|
DESCRIBE TABLE LINES: use lines() instead (quickfix exists)`,
|
|
45
45
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
|
|
46
46
|
};
|
|
@@ -23,11 +23,11 @@ class BeginEndNames extends _abap_rule_1.ABAPRule {
|
|
|
23
23
|
title: "Check BEGIN END names",
|
|
24
24
|
shortDescription: `Check BEGIN OF and END OF names match, plus there must be statements between BEGIN and END`,
|
|
25
25
|
tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],
|
|
26
|
-
badExample: `DATA: BEGIN OF stru,
|
|
27
|
-
field TYPE i,
|
|
26
|
+
badExample: `DATA: BEGIN OF stru,
|
|
27
|
+
field TYPE i,
|
|
28
28
|
END OF structure_not_the_same.`,
|
|
29
|
-
goodExample: `DATA: BEGIN OF stru,
|
|
30
|
-
field TYPE i,
|
|
29
|
+
goodExample: `DATA: BEGIN OF stru,
|
|
30
|
+
field TYPE i,
|
|
31
31
|
END OF stru.`,
|
|
32
32
|
};
|
|
33
33
|
}
|
|
@@ -21,19 +21,19 @@ class BeginSingleInclude extends _abap_rule_1.ABAPRule {
|
|
|
21
21
|
title: "BEGIN contains single INCLUDE",
|
|
22
22
|
shortDescription: `Finds TYPE BEGIN with just one INCLUDE TYPE, and DATA with single INCLUDE STRUCTURE`,
|
|
23
23
|
tags: [_irule_1.RuleTag.SingleFile],
|
|
24
|
-
badExample: `TYPES: BEGIN OF dummy1.
|
|
25
|
-
INCLUDE TYPE dselc.
|
|
26
|
-
TYPES: END OF dummy1.
|
|
27
|
-
|
|
28
|
-
DATA BEGIN OF foo.
|
|
29
|
-
INCLUDE STRUCTURE syst.
|
|
30
|
-
DATA END OF foo.
|
|
31
|
-
|
|
32
|
-
STATICS BEGIN OF bar.
|
|
33
|
-
INCLUDE STRUCTURE syst.
|
|
24
|
+
badExample: `TYPES: BEGIN OF dummy1.
|
|
25
|
+
INCLUDE TYPE dselc.
|
|
26
|
+
TYPES: END OF dummy1.
|
|
27
|
+
|
|
28
|
+
DATA BEGIN OF foo.
|
|
29
|
+
INCLUDE STRUCTURE syst.
|
|
30
|
+
DATA END OF foo.
|
|
31
|
+
|
|
32
|
+
STATICS BEGIN OF bar.
|
|
33
|
+
INCLUDE STRUCTURE syst.
|
|
34
34
|
STATICS END OF bar.`,
|
|
35
|
-
goodExample: `DATA BEGIN OF foo.
|
|
36
|
-
INCLUDE STRUCTURE dselc.
|
|
35
|
+
goodExample: `DATA BEGIN OF foo.
|
|
36
|
+
INCLUDE STRUCTURE dselc.
|
|
37
37
|
DATA END OF foo.`,
|
|
38
38
|
};
|
|
39
39
|
}
|
|
@@ -24,9 +24,9 @@ class CallTransactionAuthorityCheck extends _abap_rule_1.ABAPRule {
|
|
|
24
24
|
extendedInformation: `https://docs.abapopenchecks.org/checks/54/`,
|
|
25
25
|
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Security],
|
|
26
26
|
badExample: `CALL TRANSACTION 'FOO'.`,
|
|
27
|
-
goodExample: `TRY.
|
|
28
|
-
CALL TRANSACTION 'FOO' WITH AUTHORITY-CHECK.
|
|
29
|
-
CATCH cx_sy_authorization_error.
|
|
27
|
+
goodExample: `TRY.
|
|
28
|
+
CALL TRANSACTION 'FOO' WITH AUTHORITY-CHECK.
|
|
29
|
+
CATCH cx_sy_authorization_error.
|
|
30
30
|
ENDTRY.`,
|
|
31
31
|
};
|
|
32
32
|
}
|