@abaplint/core 2.83.6 → 2.83.10
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/abaplint.d.ts +208 -6
- package/build/src/abap/flow/flow_graph.js +7 -7
- package/build/src/abap/types/basic/any_type.js +3 -0
- package/build/src/abap/types/basic/character_type.js +3 -0
- package/build/src/abap/types/basic/clike_type.js +3 -0
- package/build/src/abap/types/basic/csequence_type.js +3 -0
- package/build/src/abap/types/basic/data_reference_type.js +3 -0
- package/build/src/abap/types/basic/date_type.js +3 -0
- package/build/src/abap/types/basic/decfloat16_type.js +3 -0
- package/build/src/abap/types/basic/decfloat34_type.js +3 -0
- package/build/src/abap/types/basic/decfloat_type.js +3 -0
- package/build/src/abap/types/basic/enum_type.js +3 -0
- package/build/src/abap/types/basic/float_type.js +3 -0
- package/build/src/abap/types/basic/floating_point_type.js +3 -0
- package/build/src/abap/types/basic/generic_object_reference_type.js +3 -0
- package/build/src/abap/types/basic/hex_type.js +3 -0
- package/build/src/abap/types/basic/integer_type.js +3 -0
- package/build/src/abap/types/basic/numeric_generic_type.js +3 -0
- package/build/src/abap/types/basic/numeric_type.js +3 -0
- package/build/src/abap/types/basic/object_reference_type.js +3 -0
- package/build/src/abap/types/basic/packed_type.js +3 -0
- package/build/src/abap/types/basic/simple_type.js +3 -0
- package/build/src/abap/types/basic/string_type.js +3 -0
- package/build/src/abap/types/basic/structure_type.js +3 -0
- package/build/src/abap/types/basic/table_type.js +3 -0
- package/build/src/abap/types/basic/time_type.js +3 -0
- package/build/src/abap/types/basic/unknown_type.js +3 -0
- package/build/src/abap/types/basic/utc_long_type.js +3 -0
- package/build/src/abap/types/basic/void_type.js +3 -0
- package/build/src/abap/types/basic/xsequence_type.js +3 -0
- package/build/src/abap/types/basic/xstring_type.js +3 -0
- package/build/src/cds/cds_determine_types.js +23 -0
- package/build/src/cds/cds_lexer.js +3 -1
- package/build/src/cds/expressions/cds_association.js +1 -1
- package/build/src/cds/expressions/cds_composition.js +1 -1
- package/build/src/cds/expressions/cds_condition.js +1 -1
- package/build/src/cds/expressions/cds_function.js +3 -1
- package/build/src/cds/expressions/cds_relation.js +12 -0
- package/build/src/cds/expressions/index.js +1 -0
- package/build/src/index.js +5 -1
- package/build/src/lsp/help.js +17 -12
- package/build/src/objects/data_definition.js +70 -42
- 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 +6 -5
- 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 +35 -35
- 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_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/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
|
@@ -45,6 +45,9 @@ class StructureType extends _abstract_type_1.AbstractType {
|
|
|
45
45
|
containsVoid() {
|
|
46
46
|
return this.getComponents().some(c => { c.type.containsVoid(); });
|
|
47
47
|
}
|
|
48
|
+
toCDS() {
|
|
49
|
+
return "abap.TODO_STRUCTURE";
|
|
50
|
+
}
|
|
48
51
|
}
|
|
49
52
|
exports.StructureType = StructureType;
|
|
50
53
|
//# sourceMappingURL=structure_type.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSDetermineTypes = void 0;
|
|
4
|
+
const basic_1 = require("../abap/types/basic");
|
|
5
|
+
class CDSDetermineTypes {
|
|
6
|
+
parseType(_reg, parsedData) {
|
|
7
|
+
if ((parsedData === null || parsedData === void 0 ? void 0 : parsedData.fields.length) === 0) {
|
|
8
|
+
return new basic_1.VoidType("DDLS:todo");
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
const components = [];
|
|
12
|
+
for (const f of (parsedData === null || parsedData === void 0 ? void 0 : parsedData.fields) || []) {
|
|
13
|
+
components.push({
|
|
14
|
+
name: f.name,
|
|
15
|
+
type: new basic_1.VoidType("DDLS:fieldname"),
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return new basic_1.StructureType(components);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.CDSDetermineTypes = CDSDetermineTypes;
|
|
23
|
+
//# sourceMappingURL=cds_determine_types.js.map
|
|
@@ -6,7 +6,7 @@ const combi_1 = require("../../abap/2_statements/combi");
|
|
|
6
6
|
const cds_cardinality_1 = require("./cds_cardinality");
|
|
7
7
|
class CDSAssociation extends combi_1.Expression {
|
|
8
8
|
getRunnable() {
|
|
9
|
-
return (0, combi_1.seq)("ASSOCIATION", (0, combi_1.opt)(cds_cardinality_1.CDSCardinality), "TO", (0, combi_1.opt)("PARENT"), _1.
|
|
9
|
+
return (0, combi_1.seq)("ASSOCIATION", (0, combi_1.opt)(cds_cardinality_1.CDSCardinality), "TO", (0, combi_1.opt)("PARENT"), _1.CDSRelation, "ON", _1.CDSCondition);
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
exports.CDSAssociation = CDSAssociation;
|
|
@@ -6,7 +6,7 @@ const combi_1 = require("../../abap/2_statements/combi");
|
|
|
6
6
|
const cds_cardinality_1 = require("./cds_cardinality");
|
|
7
7
|
class CDSComposition extends combi_1.Expression {
|
|
8
8
|
getRunnable() {
|
|
9
|
-
return (0, combi_1.seq)("COMPOSITION", (0, combi_1.opt)(cds_cardinality_1.CDSCardinality), "OF", _1.
|
|
9
|
+
return (0, combi_1.seq)("COMPOSITION", (0, combi_1.opt)(cds_cardinality_1.CDSCardinality), "OF", _1.CDSRelation);
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
exports.CDSComposition = CDSComposition;
|
|
@@ -6,7 +6,7 @@ const combi_1 = require("../../abap/2_statements/combi");
|
|
|
6
6
|
class CDSCondition extends combi_1.Expression {
|
|
7
7
|
getRunnable() {
|
|
8
8
|
const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.opt)((0, combi_1.seq)(".", (0, combi_1.alt)(_1.CDSName, _1.CDSString))));
|
|
9
|
-
const eq = (0, combi_1.seq)(name, (0, combi_1.alt)("=", "<>", "<", ">", ">=", "<="), (0, combi_1.alt)(name, _1.CDSFunction, _1.CDSString));
|
|
9
|
+
const eq = (0, combi_1.seq)(name, (0, combi_1.alt)("=", "<>", "<", ">", ">=", "<=", "LIKE"), (0, combi_1.alt)(name, _1.CDSFunction, _1.CDSString));
|
|
10
10
|
const isInitial = (0, combi_1.seq)(name, "IS INITIAL");
|
|
11
11
|
const isNotInitial = (0, combi_1.seq)(name, "IS NOT INITIAL");
|
|
12
12
|
const isNull = (0, combi_1.seq)(name, "IS NULL");
|
|
@@ -15,6 +15,8 @@ class CDSFunction extends combi_1.Expression {
|
|
|
15
15
|
const dats_days_between = (0, combi_1.seq)("DATS_DAYS_BETWEEN", "(", input, ",", input, ")");
|
|
16
16
|
const dats_is_valid = (0, combi_1.seq)("DATS_IS_VALID", "(", input, ")");
|
|
17
17
|
const substring = (0, combi_1.seq)("SUBSTRING", "(", input, ",", input, ",", input, ")");
|
|
18
|
+
const bintohex = (0, combi_1.seq)("BINTOHEX", "(", input, ")");
|
|
19
|
+
const hextobin = (0, combi_1.seq)("HEXTOBIN", "(", input, ")");
|
|
18
20
|
const tstmp_to_dats = (0, combi_1.seq)("TSTMP_TO_DATS", "(", input, ",", input, ",", input, ",", input, ")");
|
|
19
21
|
const tstmp_to_tims = (0, combi_1.seq)("TSTMP_TO_TIMS", "(", input, ",", input, ",", input, ",", input, ")");
|
|
20
22
|
const tstmp_to_dst = (0, combi_1.seq)("TSTMP_TO_DST", "(", input, ",", input, ",", input, ",", input, ")");
|
|
@@ -25,7 +27,7 @@ class CDSFunction extends combi_1.Expression {
|
|
|
25
27
|
const tstmp_add_seconds = (0, combi_1.seq)("TSTMP_ADD_SECONDS", "(", input, ",", input, ",", input, ")");
|
|
26
28
|
const abap_system_timezone = (0, combi_1.seq)("ABAP_SYSTEM_TIMEZONE", "(", input, ",", input, ")");
|
|
27
29
|
const abap_user_timezone = (0, combi_1.seq)("ABAP_USER_TIMEZONE", "(", input, ",", input, ",", input, ")");
|
|
28
|
-
return (0, combi_1.alt)(substring, coalesce, tstmp_to_dats, concat, tstmp_to_tims, concat_with_space, dats_is_valid, dats_days_between, tstmp_add_seconds, tstmp_seconds_between, tstmp_current_utctimestamp, tstmp_is_valid, abap_system_timezone, abap_user_timezone, dats_add_days, dats_add_months, tstmp_to_dst, dats_tims_to_tstmp);
|
|
30
|
+
return (0, combi_1.alt)(substring, coalesce, tstmp_to_dats, concat, tstmp_to_tims, concat_with_space, dats_is_valid, dats_days_between, tstmp_add_seconds, tstmp_seconds_between, tstmp_current_utctimestamp, tstmp_is_valid, abap_system_timezone, abap_user_timezone, bintohex, hextobin, dats_add_days, dats_add_months, tstmp_to_dst, dats_tims_to_tstmp);
|
|
29
31
|
}
|
|
30
32
|
}
|
|
31
33
|
exports.CDSFunction = CDSFunction;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CDSRelation = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const combi_1 = require("../../abap/2_statements/combi");
|
|
6
|
+
class CDSRelation extends combi_1.Expression {
|
|
7
|
+
getRunnable() {
|
|
8
|
+
return (0, combi_1.seq)((0, combi_1.regex)(/^[\w_]+$/), (0, combi_1.opt)(_1.CDSAs));
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.CDSRelation = CDSRelation;
|
|
12
|
+
//# sourceMappingURL=cds_relation.js.map
|
|
@@ -32,6 +32,7 @@ __exportStar(require("./cds_group_by"), exports);
|
|
|
32
32
|
__exportStar(require("./cds_join"), exports);
|
|
33
33
|
__exportStar(require("./cds_name"), exports);
|
|
34
34
|
__exportStar(require("./cds_parameters"), exports);
|
|
35
|
+
__exportStar(require("./cds_relation"), exports);
|
|
35
36
|
__exportStar(require("./cds_select"), exports);
|
|
36
37
|
__exportStar(require("./cds_source"), exports);
|
|
37
38
|
__exportStar(require("./cds_string"), exports);
|
package/build/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Severity = exports.Visibility = exports.Info = exports.Rename = exports.PrettyPrinter = exports.Position = exports.CurrentScope = exports.ABAPFile = exports.SpaghettiScope = exports.SyntaxLogic = exports.ABAPObject = exports.Tokens = exports.LanguageServerTypes = exports.DDLParser = exports.applyEditList = exports.applyEditSingle = exports.SpaghettiScopeNode = exports.AbstractFile = exports.Token = exports.ScopeType = exports.BasicTypes = exports.TypedIdentifier = exports.AbstractType = exports.VirtualPosition = exports.Comment = exports.Unknown = exports.Empty = exports.Identifier = exports.Nodes = exports.Types = exports.Expressions = exports.Statements = exports.Structures = exports.Objects = exports.ArtifactsRules = exports.ArtifactsObjects = exports.ArtifactsABAP = exports.BuiltIn = exports.MethodLengthStats = exports.LanguageServer = exports.Registry = exports.ReferenceType = exports.Version = exports.Config = exports.Issue = exports.MemoryFile = void 0;
|
|
3
|
+
exports.Severity = exports.Visibility = exports.Info = exports.Rename = exports.PrettyPrinter = exports.Position = exports.CurrentScope = exports.ABAPFile = exports.SpaghettiScope = exports.SyntaxLogic = exports.ABAPObject = exports.Tokens = exports.ExpressionsCDS = exports.CDSParser = exports.LanguageServerTypes = exports.DDLParser = exports.applyEditList = exports.applyEditSingle = exports.SpaghettiScopeNode = exports.AbstractFile = exports.Token = exports.ScopeType = exports.BasicTypes = exports.TypedIdentifier = exports.AbstractType = exports.VirtualPosition = exports.Comment = exports.Unknown = exports.Empty = exports.Identifier = exports.Nodes = exports.Types = exports.Expressions = exports.Statements = exports.Structures = exports.Objects = exports.ArtifactsRules = exports.ArtifactsObjects = exports.ArtifactsABAP = exports.BuiltIn = exports.MethodLengthStats = exports.LanguageServer = exports.Registry = exports.ReferenceType = exports.Version = exports.Config = exports.Issue = exports.MemoryFile = void 0;
|
|
4
4
|
const issue_1 = require("./issue");
|
|
5
5
|
Object.defineProperty(exports, "Issue", { enumerable: true, get: function () { return issue_1.Issue; } });
|
|
6
6
|
const config_1 = require("./config");
|
|
@@ -44,6 +44,8 @@ const Statements = require("./abap/2_statements/statements");
|
|
|
44
44
|
exports.Statements = Statements;
|
|
45
45
|
const Expressions = require("./abap/2_statements/expressions");
|
|
46
46
|
exports.Expressions = Expressions;
|
|
47
|
+
const ExpressionsCDS = require("./cds/expressions");
|
|
48
|
+
exports.ExpressionsCDS = ExpressionsCDS;
|
|
47
49
|
const Structures = require("./abap/3_structures/structures");
|
|
48
50
|
exports.Structures = Structures;
|
|
49
51
|
const Nodes = require("./abap/nodes");
|
|
@@ -88,4 +90,6 @@ const severity_1 = require("./severity");
|
|
|
88
90
|
Object.defineProperty(exports, "Severity", { enumerable: true, get: function () { return severity_1.Severity; } });
|
|
89
91
|
const ddl_parser_1 = require("./ddl/ddl_parser");
|
|
90
92
|
Object.defineProperty(exports, "DDLParser", { enumerable: true, get: function () { return ddl_parser_1.DDLParser; } });
|
|
93
|
+
const cds_parser_1 = require("./cds/cds_parser");
|
|
94
|
+
Object.defineProperty(exports, "CDSParser", { enumerable: true, get: function () { return cds_parser_1.CDSParser; } });
|
|
91
95
|
//# sourceMappingURL=index.js.map
|
package/build/src/lsp/help.js
CHANGED
|
@@ -8,22 +8,28 @@ const _abap_object_1 = require("../objects/_abap_object");
|
|
|
8
8
|
const dump_scope_1 = require("./dump_scope");
|
|
9
9
|
class Help {
|
|
10
10
|
static find(reg, textDocument, position) {
|
|
11
|
+
const file = _lsp_utils_1.LSPUtils.getABAPFile(reg, textDocument.uri);
|
|
12
|
+
if (file === undefined) {
|
|
13
|
+
return "file not found";
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
return this.dumpABAP(file, reg, textDocument, position);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/////////////////////////////////////////////////
|
|
20
|
+
static dumpABAP(file, reg, textDocument, position) {
|
|
11
21
|
let content = "";
|
|
12
|
-
content = `
|
|
13
|
-
<a href="#_tokens" rel="no-refresh">Tokens</a> |
|
|
14
|
-
<a href="#_statements" rel="no-refresh">Statements</a> |
|
|
15
|
-
<a href="#_structure" rel="no-refresh">Structure</a> |
|
|
16
|
-
<a href="#_files" rel="no-refresh">Files</a> |
|
|
17
|
-
<a href="#_info" rel="no-refresh">Info Dump</a>
|
|
18
|
-
<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>
|
|
19
29
|
` +
|
|
20
30
|
"<tt>" + textDocument.uri + " (" +
|
|
21
31
|
(position.line + 1) + ", " +
|
|
22
32
|
(position.character + 1) + ")</tt>";
|
|
23
|
-
const file = _lsp_utils_1.LSPUtils.getABAPFile(reg, textDocument.uri);
|
|
24
|
-
if (file === undefined) {
|
|
25
|
-
return content + "file not found";
|
|
26
|
-
}
|
|
27
33
|
content = content + "<hr>";
|
|
28
34
|
content = content + this.cursorInformation(reg, textDocument, position, file);
|
|
29
35
|
content = content + this.fileInformation(file);
|
|
@@ -33,7 +39,6 @@ class Help {
|
|
|
33
39
|
content = content + this.dumpInfo(file);
|
|
34
40
|
return content;
|
|
35
41
|
}
|
|
36
|
-
/////////////////////////////////////////////////
|
|
37
42
|
static dumpInfo(file) {
|
|
38
43
|
const info = file.getInfo();
|
|
39
44
|
const dump = {
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DataDefinition = void 0;
|
|
4
|
-
const
|
|
4
|
+
const cds_determine_types_1 = require("../cds/cds_determine_types");
|
|
5
5
|
const cds_parser_1 = require("../cds/cds_parser");
|
|
6
6
|
const expressions_1 = require("../cds/expressions");
|
|
7
7
|
const _abstract_object_1 = require("./_abstract_object");
|
|
8
8
|
class DataDefinition extends _abstract_object_1.AbstractObject {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
|
-
this.sqlViewName = undefined;
|
|
12
11
|
this.parserError = undefined;
|
|
13
|
-
this.
|
|
14
|
-
this.sources = [];
|
|
12
|
+
this.parsedData = undefined;
|
|
15
13
|
}
|
|
16
14
|
getType() {
|
|
17
15
|
return "DDLS";
|
|
@@ -23,36 +21,29 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
|
|
|
23
21
|
};
|
|
24
22
|
}
|
|
25
23
|
getSQLViewName() {
|
|
26
|
-
|
|
24
|
+
var _a;
|
|
25
|
+
this.parse();
|
|
26
|
+
return (_a = this.parsedData) === null || _a === void 0 ? void 0 : _a.sqlViewName;
|
|
27
27
|
}
|
|
28
28
|
getDescription() {
|
|
29
29
|
// todo
|
|
30
30
|
return undefined;
|
|
31
31
|
}
|
|
32
|
-
parseType(
|
|
32
|
+
parseType(reg) {
|
|
33
33
|
this.parse();
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const components = [];
|
|
39
|
-
for (const f of this.fieldNames) {
|
|
40
|
-
components.push({
|
|
41
|
-
name: f,
|
|
42
|
-
type: new basic_1.VoidType("DDLS:fieldname"),
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
return new basic_1.StructureType(components);
|
|
46
|
-
}
|
|
34
|
+
return new cds_determine_types_1.CDSDetermineTypes().parseType(reg, this.parsedData);
|
|
35
|
+
}
|
|
36
|
+
getParsedData() {
|
|
37
|
+
return this.parsedData;
|
|
47
38
|
}
|
|
48
39
|
listSources() {
|
|
49
|
-
|
|
40
|
+
var _a;
|
|
41
|
+
this.parse();
|
|
42
|
+
return (_a = this.parsedData) === null || _a === void 0 ? void 0 : _a.sources;
|
|
50
43
|
}
|
|
51
44
|
setDirty() {
|
|
52
|
-
this.
|
|
45
|
+
this.parsedData = undefined;
|
|
53
46
|
this.parserError = undefined;
|
|
54
|
-
this.fieldNames = [];
|
|
55
|
-
this.sources = [];
|
|
56
47
|
super.setDirty();
|
|
57
48
|
}
|
|
58
49
|
findSourceFile() {
|
|
@@ -62,31 +53,40 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
|
|
|
62
53
|
return this.parserError;
|
|
63
54
|
}
|
|
64
55
|
parse() {
|
|
65
|
-
var _a;
|
|
66
56
|
if (this.isDirty() === false) {
|
|
67
57
|
return { updated: false, runtime: 0 };
|
|
68
58
|
}
|
|
69
59
|
const start = Date.now();
|
|
70
|
-
this.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
60
|
+
this.parsedData = {
|
|
61
|
+
sqlViewName: undefined,
|
|
62
|
+
fields: [],
|
|
63
|
+
sources: [],
|
|
64
|
+
relations: [],
|
|
65
|
+
associations: [],
|
|
66
|
+
tree: undefined,
|
|
67
|
+
};
|
|
68
|
+
this.findSQLViewName();
|
|
69
|
+
this.parsedData.tree = new cds_parser_1.CDSParser().parse(this.findSourceFile());
|
|
70
|
+
if (this.parsedData.tree) {
|
|
71
|
+
this.findSourcesAndRelations(this.parsedData.tree);
|
|
72
|
+
this.findFieldNames(this.parsedData.tree);
|
|
79
73
|
}
|
|
80
74
|
else {
|
|
81
75
|
this.parserError = true;
|
|
82
76
|
}
|
|
83
|
-
const end = Date.now();
|
|
84
77
|
this.dirty = false;
|
|
85
|
-
return { updated: true, runtime:
|
|
78
|
+
return { updated: true, runtime: Date.now() - start };
|
|
86
79
|
}
|
|
87
|
-
|
|
80
|
+
//////////
|
|
81
|
+
findSQLViewName() {
|
|
88
82
|
var _a;
|
|
89
|
-
this.
|
|
83
|
+
const match = (_a = this.findSourceFile()) === null || _a === void 0 ? void 0 : _a.getRaw().match(/@AbapCatalog\.sqlViewName: '(\w+)'/);
|
|
84
|
+
if (match) {
|
|
85
|
+
this.parsedData.sqlViewName = match[1].toUpperCase();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
findFieldNames(tree) {
|
|
89
|
+
var _a, _b;
|
|
90
90
|
for (const e of tree.findAllExpressions(expressions_1.CDSElement)) {
|
|
91
91
|
let found = (_a = e.findDirectExpression(expressions_1.CDSAs)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(expressions_1.CDSName);
|
|
92
92
|
if (found === undefined) {
|
|
@@ -96,16 +96,44 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
|
|
|
96
96
|
if (found === undefined) {
|
|
97
97
|
continue;
|
|
98
98
|
}
|
|
99
|
-
|
|
99
|
+
const name = found === null || found === void 0 ? void 0 : found.concatTokens();
|
|
100
|
+
if ((_b = this.parsedData) === null || _b === void 0 ? void 0 : _b.associations.some(a => { var _a; return a.name.toUpperCase() === name.toUpperCase() || ((_a = a.as) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === name.toUpperCase(); })) {
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
const annotations = [];
|
|
104
|
+
for (const a of e.findDirectExpressions(expressions_1.CDSAnnotation)) {
|
|
105
|
+
annotations.push(a.concatTokens());
|
|
106
|
+
}
|
|
107
|
+
this.parsedData.fields.push({
|
|
108
|
+
name: name,
|
|
109
|
+
annotations: annotations,
|
|
110
|
+
key: e.findDirectTokenByText("KEY") !== undefined,
|
|
111
|
+
});
|
|
100
112
|
}
|
|
101
113
|
}
|
|
102
|
-
|
|
103
|
-
var _a, _b;
|
|
104
|
-
this.sources = [];
|
|
114
|
+
findSourcesAndRelations(tree) {
|
|
115
|
+
var _a, _b, _c, _d, _e, _f;
|
|
105
116
|
for (const e of tree.findAllExpressions(expressions_1.CDSSource)) {
|
|
106
117
|
const name = e.getFirstToken().getStr();
|
|
107
118
|
const as = (_b = (_a = e.findDirectExpression(expressions_1.CDSAs)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(expressions_1.CDSName)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr();
|
|
108
|
-
this.sources.push({ name, as });
|
|
119
|
+
this.parsedData.sources.push({ name, as });
|
|
120
|
+
}
|
|
121
|
+
for (const e of tree.findAllExpressions(expressions_1.CDSRelation)) {
|
|
122
|
+
const name = e.getFirstToken().getStr();
|
|
123
|
+
const as = (_d = (_c = e.findDirectExpression(expressions_1.CDSAs)) === null || _c === void 0 ? void 0 : _c.findDirectExpression(expressions_1.CDSName)) === null || _d === void 0 ? void 0 : _d.getFirstToken().getStr();
|
|
124
|
+
this.parsedData.relations.push({ name, as });
|
|
125
|
+
}
|
|
126
|
+
for (const e of tree.findAllExpressions(expressions_1.CDSAssociation)) {
|
|
127
|
+
const j = e.findDirectExpression(expressions_1.CDSRelation);
|
|
128
|
+
if (j === undefined) {
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
const name = j.getFirstToken().getStr();
|
|
132
|
+
const as = (_f = (_e = j.findDirectExpression(expressions_1.CDSAs)) === null || _e === void 0 ? void 0 : _e.findDirectExpression(expressions_1.CDSName)) === null || _f === void 0 ? void 0 : _f.getFirstToken().getStr();
|
|
133
|
+
this.parsedData.associations.push({
|
|
134
|
+
name: name || "ERROR",
|
|
135
|
+
as: as,
|
|
136
|
+
});
|
|
109
137
|
}
|
|
110
138
|
}
|
|
111
139
|
}
|
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
|
}
|