@abaplint/core 2.82.17 → 2.83.3

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.
Files changed (42) hide show
  1. package/build/abaplint.d.ts +17 -37
  2. package/build/src/abap/2_statements/expressions/index.js +0 -7
  3. package/build/src/abap/2_statements/statement_parser.js +1 -1
  4. package/build/src/abap/2_statements/statements/call_function.js +1 -1
  5. package/build/src/abap/artifacts.js +3 -3
  6. package/build/src/cds/artifacts.js +18 -0
  7. package/build/src/cds/cds_lexer.js +113 -0
  8. package/build/src/cds/cds_parser.js +25 -0
  9. package/build/src/cds/expressions/cds_annotation.js +16 -0
  10. package/build/src/cds/expressions/cds_as.js +12 -0
  11. package/build/src/cds/expressions/cds_association.js +17 -0
  12. package/build/src/cds/expressions/cds_cast.js +13 -0
  13. package/build/src/cds/expressions/cds_define_view.js +14 -0
  14. package/build/src/cds/expressions/cds_element.js +14 -0
  15. package/build/src/cds/expressions/cds_function.js +17 -0
  16. package/build/src/cds/expressions/cds_join.js +13 -0
  17. package/build/src/cds/expressions/cds_name.js +11 -0
  18. package/build/src/cds/expressions/cds_select.js +15 -0
  19. package/build/src/cds/expressions/cds_source.js +12 -0
  20. package/build/src/cds/expressions/cds_where.js +15 -0
  21. package/build/src/cds/expressions/index.js +25 -0
  22. package/build/src/config.js +1 -0
  23. package/build/src/ddl/artifacts.js +18 -0
  24. package/build/src/ddl/ddl_parser.js +1 -1
  25. package/build/src/{abap/2_statements/expressions/ddl → ddl/expressions}/ddl_include.js +1 -1
  26. package/build/src/{abap/2_statements/expressions/ddl → ddl/expressions}/ddl_name.js +1 -1
  27. package/build/src/{abap/2_statements/expressions/ddl → ddl/expressions}/ddl_structure.js +1 -1
  28. package/build/src/{abap/2_statements/expressions/ddl → ddl/expressions}/ddl_structure_field.js +1 -1
  29. package/build/src/{abap/2_statements/expressions/ddl → ddl/expressions}/ddl_table.js +1 -1
  30. package/build/src/{abap/2_statements/expressions/ddl → ddl/expressions}/ddl_table_field.js +1 -1
  31. package/build/src/{abap/2_statements/expressions/ddl → ddl/expressions}/ddl_type.js +1 -1
  32. package/build/src/ddl/expressions/index.js +20 -0
  33. package/build/src/index.js +2 -2
  34. package/build/src/objects/data_definition.js +65 -3
  35. package/build/src/registry.js +15 -2
  36. package/build/src/rules/cds_parser_error.js +46 -0
  37. package/build/src/rules/index.js +3 -0
  38. package/build/src/rules/no_aliases.js +43 -0
  39. package/build/src/rules/obsolete_statement.js +2 -0
  40. package/build/src/rules/prefer_corresponding.js +48 -0
  41. package/build/src/rules/select_add_order_by.js +25 -10
  42. package/package.json +4 -4
@@ -170,7 +170,7 @@ declare class ArrowOrDash extends Expression {
170
170
  getRunnable(): IStatementRunnable;
171
171
  }
172
172
 
173
- export declare class Artifacts {
173
+ export declare class ArtifactsABAP {
174
174
  static getStructures(): IStructure[];
175
175
  static getExpressions(): (new () => Expression)[];
176
176
  static getStatements(): IStatement[];
@@ -1114,6 +1114,9 @@ declare class DataControl extends AbstractObject {
1114
1114
 
1115
1115
  declare class DataDefinition extends AbstractObject {
1116
1116
  private sqlViewName;
1117
+ private parserError;
1118
+ private fieldNames;
1119
+ private sources;
1117
1120
  getType(): string;
1118
1121
  getAllowedNaming(): {
1119
1122
  maxLength: number;
@@ -1122,8 +1125,16 @@ declare class DataDefinition extends AbstractObject {
1122
1125
  getSQLViewName(): string | undefined;
1123
1126
  getDescription(): string | undefined;
1124
1127
  parseType(_reg: IRegistry): AbstractType;
1128
+ listSources(): {
1129
+ name: string;
1130
+ as: string | undefined;
1131
+ }[];
1125
1132
  setDirty(): void;
1133
+ findSourceFile(): IFile | undefined;
1134
+ hasParserError(): boolean | undefined;
1126
1135
  parse(): IParseResult;
1136
+ private findFieldNames;
1137
+ private findSources;
1127
1138
  }
1128
1139
 
1129
1140
  declare class DataDefinition_2 extends Expression {
@@ -1188,44 +1199,16 @@ declare class DDIC {
1188
1199
  textToType(text: string | undefined, length: string | undefined, decimals: string | undefined, parent: string, qualify?: boolean): AbstractType;
1189
1200
  }
1190
1201
 
1191
- declare class DDLInclude extends Expression {
1192
- getRunnable(): IStatementRunnable;
1193
- }
1194
-
1195
1202
  declare enum DDLKind {
1196
1203
  Structure = "structure",
1197
1204
  Table = "table"
1198
1205
  }
1199
1206
 
1200
- declare class DDLName extends Expression {
1201
- getRunnable(): IStatementRunnable;
1202
- }
1203
-
1204
1207
  export declare class DDLParser {
1205
1208
  parse(file: IFile): IDDLParserResult | undefined;
1206
1209
  private parsedToResult;
1207
1210
  }
1208
1211
 
1209
- declare class DDLStructure extends Expression {
1210
- getRunnable(): IStatementRunnable;
1211
- }
1212
-
1213
- declare class DDLStructureField extends Expression {
1214
- getRunnable(): IStatementRunnable;
1215
- }
1216
-
1217
- declare class DDLTable extends Expression {
1218
- getRunnable(): IStatementRunnable;
1219
- }
1220
-
1221
- declare class DDLTableField extends Expression {
1222
- getRunnable(): IStatementRunnable;
1223
- }
1224
-
1225
- declare class DDLType extends Expression {
1226
- getRunnable(): IStatementRunnable;
1227
- }
1228
-
1229
1212
  declare class DecFloat16Type extends AbstractType {
1230
1213
  toText(): string;
1231
1214
  isGeneric(): boolean;
@@ -1689,13 +1672,6 @@ declare namespace Expressions {
1689
1672
  DataDefinition_2 as DataDefinition,
1690
1673
  DatabaseConnection,
1691
1674
  DatabaseTable,
1692
- DDLInclude,
1693
- DDLName,
1694
- DDLStructureField,
1695
- DDLStructure,
1696
- DDLTableField,
1697
- DDLTable,
1698
- DDLType,
1699
1675
  Decimals,
1700
1676
  Default,
1701
1677
  DefinitionName,
@@ -2573,10 +2549,14 @@ declare interface IGlobalConfig {
2573
2549
  useApackDependencies?: boolean;
2574
2550
  /** Do not report any issues for includes without main programs */
2575
2551
  skipIncludesWithoutMain?: boolean;
2576
- /** list of files to exclude, case insensitive regex
2552
+ /** list of files to exclude, these files are not added when running syntax check or any other rules, case insensitive regex
2577
2553
  * @uniqueItems true
2578
2554
  */
2579
2555
  exclude?: string[];
2556
+ /** list of files to not report any issues for, case insensitive regex
2557
+ * @uniqueItems true
2558
+ */
2559
+ noIssues?: string[];
2580
2560
  }
2581
2561
 
2582
2562
  declare interface IImplementing {
@@ -47,13 +47,6 @@ __exportStar(require("./corresponding_body"), exports);
47
47
  __exportStar(require("./data_definition"), exports);
48
48
  __exportStar(require("./database_connection"), exports);
49
49
  __exportStar(require("./database_table"), exports);
50
- __exportStar(require("./ddl/ddl_include"), exports);
51
- __exportStar(require("./ddl/ddl_name"), exports);
52
- __exportStar(require("./ddl/ddl_structure_field"), exports);
53
- __exportStar(require("./ddl/ddl_structure"), exports);
54
- __exportStar(require("./ddl/ddl_table_field"), exports);
55
- __exportStar(require("./ddl/ddl_table"), exports);
56
- __exportStar(require("./ddl/ddl_type"), exports);
57
50
  __exportStar(require("./decimals"), exports);
58
51
  __exportStar(require("./default"), exports);
59
52
  __exportStar(require("./definition_name"), exports);
@@ -14,7 +14,7 @@ exports.STATEMENT_MAX_TOKENS = 1000;
14
14
  class StatementMap {
15
15
  constructor() {
16
16
  this.map = {};
17
- for (const stat of artifacts_1.Artifacts.getStatements()) {
17
+ for (const stat of artifacts_1.ArtifactsABAP.getStatements()) {
18
18
  const f = stat.getMatcher().first();
19
19
  if (f.length === 0) {
20
20
  throw new Error("StatementMap, first must have contents");
@@ -9,7 +9,7 @@ class CallFunction {
9
9
  const starting = (0, combi_1.seq)("STARTING NEW TASK", expressions_1.SimpleSource2);
10
10
  const update = (0, combi_1.str)("IN UPDATE TASK");
11
11
  const unit = (0, combi_1.seq)("UNIT", expressions_1.Source);
12
- const background = (0, combi_1.seq)("IN BACKGROUND", (0, combi_1.alt)("TASK", unit));
12
+ const background = (0, combi_1.verNot)(version_1.Version.Cloud, (0, combi_1.seq)("IN BACKGROUND", (0, combi_1.alt)("TASK", unit)));
13
13
  const calling = (0, combi_1.seq)("CALLING", expressions_1.MethodName, "ON END OF TASK");
14
14
  const performing = (0, combi_1.seq)("PERFORMING", expressions_1.FormName, "ON END OF TASK");
15
15
  const separate = (0, combi_1.str)("AS SEPARATE UNIT");
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Artifacts = void 0;
3
+ exports.ArtifactsABAP = void 0;
4
4
  const Statements = require("./2_statements/statements");
5
5
  const Expressions = require("./2_statements/expressions");
6
6
  const combi_1 = require("./2_statements/combi");
@@ -35,7 +35,7 @@ class List {
35
35
  function className(cla) {
36
36
  return cla.constructor.name;
37
37
  }
38
- class Artifacts {
38
+ class ArtifactsABAP {
39
39
  static getStructures() {
40
40
  const ret = [];
41
41
  const list = Structures;
@@ -77,5 +77,5 @@ class Artifacts {
77
77
  return list.get();
78
78
  }
79
79
  }
80
- exports.Artifacts = Artifacts;
80
+ exports.ArtifactsABAP = ArtifactsABAP;
81
81
  //# sourceMappingURL=artifacts.js.map
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ArtifactsCDS = void 0;
4
+ const Expressions = require("./expressions");
5
+ class ArtifactsCDS {
6
+ static getExpressions() {
7
+ const ret = [];
8
+ const list = Expressions;
9
+ for (const key in Expressions) {
10
+ if (typeof list[key] === "function") {
11
+ ret.push(list[key]);
12
+ }
13
+ }
14
+ return ret;
15
+ }
16
+ }
17
+ exports.ArtifactsCDS = ArtifactsCDS;
18
+ //# sourceMappingURL=artifacts.js.map
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CDSLexer = void 0;
4
+ const tokens_1 = require("../abap/1_lexer/tokens");
5
+ const position_1 = require("../position");
6
+ // todo: Keywords must be all uppercase, all lowercase, or in lowercase with an
7
+ // uppercase initial letter. Other mixes of uppercase and lowercase are not allowed
8
+ class Stream {
9
+ constructor(buffer) {
10
+ this.buffer = buffer;
11
+ }
12
+ takeNext() {
13
+ const next = this.buffer.substring(0, 1);
14
+ this.buffer = this.buffer.substring(1);
15
+ return next;
16
+ }
17
+ peekNext() {
18
+ const next = this.buffer.substring(0, 1);
19
+ return next;
20
+ }
21
+ length() {
22
+ return this.buffer.length;
23
+ }
24
+ }
25
+ class Result {
26
+ constructor() {
27
+ this.result = [];
28
+ }
29
+ add(text, row, col) {
30
+ if (text.length > 0) {
31
+ this.result.push(new tokens_1.Identifier(new position_1.Position(row, col), text));
32
+ }
33
+ return "";
34
+ }
35
+ get() {
36
+ return this.result;
37
+ }
38
+ }
39
+ var Mode;
40
+ (function (Mode) {
41
+ Mode[Mode["Default"] = 0] = "Default";
42
+ Mode[Mode["String"] = 1] = "String";
43
+ Mode[Mode["SingleLineComment"] = 2] = "SingleLineComment";
44
+ Mode[Mode["MultiLineComment"] = 3] = "MultiLineComment";
45
+ })(Mode || (Mode = {}));
46
+ class CDSLexer {
47
+ static run(file) {
48
+ const result = new Result();
49
+ let mode = Mode.Default;
50
+ let row = 1;
51
+ let col = 1;
52
+ let build = "";
53
+ const stream = new Stream(file.getRaw());
54
+ while (stream.length() > 0) {
55
+ const next = stream.takeNext();
56
+ const nextNext = stream.peekNext();
57
+ col++;
58
+ if (mode === Mode.String) {
59
+ build += next;
60
+ if (next === "'") {
61
+ build = result.add(build, row, col);
62
+ mode = Mode.Default;
63
+ }
64
+ continue;
65
+ }
66
+ if (mode === Mode.SingleLineComment) {
67
+ if (next === "\n") {
68
+ mode = Mode.Default;
69
+ }
70
+ continue;
71
+ }
72
+ else if (mode === Mode.Default && next === "/" && nextNext === "/") {
73
+ mode = Mode.SingleLineComment;
74
+ build = result.add(build, row, col);
75
+ continue;
76
+ }
77
+ switch (next) {
78
+ case "'":
79
+ mode = Mode.String;
80
+ build += next;
81
+ break;
82
+ case " ":
83
+ build = result.add(build, row, col);
84
+ break;
85
+ case "\n":
86
+ build = result.add(build, row, col);
87
+ row++;
88
+ col = 0;
89
+ break;
90
+ case ";":
91
+ case ":":
92
+ case ",":
93
+ case ".":
94
+ case "{":
95
+ case "}":
96
+ case "(":
97
+ case ")":
98
+ case "[":
99
+ case "]":
100
+ build = result.add(build, row, col);
101
+ result.add(next, row, col);
102
+ break;
103
+ default:
104
+ build += next;
105
+ break;
106
+ }
107
+ }
108
+ result.add(build, row, col);
109
+ return result.get();
110
+ }
111
+ }
112
+ exports.CDSLexer = CDSLexer;
113
+ //# sourceMappingURL=cds_lexer.js.map
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CDSParser = void 0;
4
+ const combi_1 = require("../abap/2_statements/combi");
5
+ const nodes_1 = require("../abap/nodes");
6
+ const version_1 = require("../version");
7
+ const cds_lexer_1 = require("./cds_lexer");
8
+ const Expressions = require("./expressions");
9
+ // todo: the names of the ABAP + CDS + DDL expressions might overlap, if overlapping the singleton will fail
10
+ class CDSParser {
11
+ parse(file) {
12
+ if (file === undefined) {
13
+ return undefined;
14
+ }
15
+ const tokens = cds_lexer_1.CDSLexer.run(file);
16
+ // console.dir(tokens);
17
+ const res = combi_1.Combi.run(new Expressions.CDSDefineView(), tokens, version_1.defaultVersion);
18
+ if (res === undefined || !(res[0] instanceof nodes_1.ExpressionNode)) {
19
+ return undefined;
20
+ }
21
+ return res[0];
22
+ }
23
+ }
24
+ exports.CDSParser = CDSParser;
25
+ //# sourceMappingURL=cds_parser.js.map
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CDSAnnotation = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ class CDSAnnotation extends combi_1.Expression {
7
+ getRunnable() {
8
+ // todo: add all the known annotations
9
+ const value = (0, combi_1.alt)((0, combi_1.regex)(/^'[\w ]+'$/), "true", "false", (0, combi_1.regex)(/^\d+$/), (0, combi_1.seq)((0, combi_1.regex)(/^\d+$/), ".", (0, combi_1.regex)(/^\d+$/)), (0, combi_1.regex)(/^#\w+$/));
10
+ const valueList = (0, combi_1.seq)("[", value, (0, combi_1.star)((0, combi_1.seq)(",", value)), "]");
11
+ const valueNested = (0, combi_1.seq)("{", _1.CDSName, (0, combi_1.star)((0, combi_1.seq)(".", _1.CDSName)), ":", value, "}");
12
+ return (0, combi_1.seq)((0, combi_1.regex)(/^@\w+$/), (0, combi_1.star)((0, combi_1.seq)(".", (0, combi_1.regex)(/^\w+$/))), (0, combi_1.opt)(":"), (0, combi_1.opt)((0, combi_1.alt)(valueList, valueNested, value)));
13
+ }
14
+ }
15
+ exports.CDSAnnotation = CDSAnnotation;
16
+ //# sourceMappingURL=cds_annotation.js.map
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CDSAs = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ class CDSAs extends combi_1.Expression {
7
+ getRunnable() {
8
+ return (0, combi_1.seq)("AS", _1.CDSName);
9
+ }
10
+ }
11
+ exports.CDSAs = CDSAs;
12
+ //# sourceMappingURL=cds_as.js.map
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CDSAssociation = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ class CDSAssociation extends combi_1.Expression {
7
+ getRunnable() {
8
+ const cardinality = (0, combi_1.seq)("[", (0, combi_1.alt)("0", "1"), ".", ".", (0, combi_1.alt)("0", "1", "*"), "]");
9
+ const as = (0, combi_1.seq)("AS", _1.CDSName);
10
+ const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.plus)((0, combi_1.seq)(".", _1.CDSName)));
11
+ const cond = (0, combi_1.seq)(name, "=", name);
12
+ const and = (0, combi_1.seq)("AND", cond);
13
+ return (0, combi_1.seq)("ASSOCIATION", cardinality, "TO", _1.CDSName, (0, combi_1.opt)(as), "ON", cond, (0, combi_1.star)(and));
14
+ }
15
+ }
16
+ exports.CDSAssociation = CDSAssociation;
17
+ //# sourceMappingURL=cds_association.js.map
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CDSCast = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ class CDSCast extends combi_1.Expression {
7
+ getRunnable() {
8
+ const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.opt)((0, combi_1.seq)(".", _1.CDSName)));
9
+ return (0, combi_1.seq)("CAST", "(", (0, combi_1.alt)(name, _1.CDSFunction), "AS", _1.CDSName, (0, combi_1.opt)((0, combi_1.seq)("PRESERVING", "TYPE")), ")");
10
+ }
11
+ }
12
+ exports.CDSCast = CDSCast;
13
+ //# sourceMappingURL=cds_cast.js.map
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CDSDefineView = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ const cds_name_1 = require("./cds_name");
7
+ const cds_select_1 = require("./cds_select");
8
+ class CDSDefineView extends combi_1.Expression {
9
+ getRunnable() {
10
+ return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.str)("DEFINE VIEW"), cds_name_1.CDSName, "AS", cds_select_1.CDSSelect, (0, combi_1.opt)(";"));
11
+ }
12
+ }
13
+ exports.CDSDefineView = CDSDefineView;
14
+ //# sourceMappingURL=cds_define_view.js.map
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CDSElement = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ const cds_as_1 = require("./cds_as");
7
+ const cds_cast_1 = require("./cds_cast");
8
+ class CDSElement extends combi_1.Expression {
9
+ getRunnable() {
10
+ return (0, combi_1.seq)((0, combi_1.star)(_1.CDSAnnotation), (0, combi_1.optPrio)("KEY"), (0, combi_1.alt)(_1.CDSName, cds_cast_1.CDSCast), (0, combi_1.optPrio)(cds_as_1.CDSAs));
11
+ }
12
+ }
13
+ exports.CDSElement = CDSElement;
14
+ //# sourceMappingURL=cds_element.js.map
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CDSFunction = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ class CDSFunction extends combi_1.Expression {
7
+ getRunnable() {
8
+ const input = (0, combi_1.alt)(_1.CDSName, (0, combi_1.regex)(/^\d+$/));
9
+ const coalesce = (0, combi_1.seq)("COALESCE", "(", input, ",", input, ")");
10
+ const concat = (0, combi_1.seq)("CONCAT", "(", input, ",", input, ")");
11
+ const concat_with_space = (0, combi_1.seq)("CONCAT_WITH_SPACE", "(", input, ",", input, ",", input, ")");
12
+ const substring = (0, combi_1.seq)("SUBSTRING", "(", input, ",", input, ",", input, ")");
13
+ return (0, combi_1.alt)(substring, coalesce, concat, concat_with_space);
14
+ }
15
+ }
16
+ exports.CDSFunction = CDSFunction;
17
+ //# sourceMappingURL=cds_function.js.map
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CDSJoin = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ class CDSJoin extends combi_1.Expression {
7
+ getRunnable() {
8
+ const name = (0, combi_1.seq)(_1.CDSName, ".", _1.CDSName);
9
+ return (0, combi_1.seq)("INNER JOIN", _1.CDSSource, "ON", name, "=", name);
10
+ }
11
+ }
12
+ exports.CDSJoin = CDSJoin;
13
+ //# sourceMappingURL=cds_join.js.map
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CDSName = void 0;
4
+ const combi_1 = require("../../abap/2_statements/combi");
5
+ class CDSName extends combi_1.Expression {
6
+ getRunnable() {
7
+ return (0, combi_1.regex)(/^\$?[\w_]+$/);
8
+ }
9
+ }
10
+ exports.CDSName = CDSName;
11
+ //# sourceMappingURL=cds_name.js.map
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CDSSelect = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ const cds_association_1 = require("./cds_association");
7
+ const cds_element_1 = require("./cds_element");
8
+ const cds_join_1 = require("./cds_join");
9
+ class CDSSelect extends combi_1.Expression {
10
+ getRunnable() {
11
+ return (0, combi_1.seq)((0, combi_1.str)("SELECT FROM"), _1.CDSSource, (0, combi_1.opt)(cds_join_1.CDSJoin), (0, combi_1.star)(cds_association_1.CDSAssociation), (0, combi_1.str)("{"), (0, combi_1.plus)(cds_element_1.CDSElement), (0, combi_1.star)((0, combi_1.seq)(",", cds_element_1.CDSElement)), (0, combi_1.str)("}"), (0, combi_1.opt)(_1.CDSWhere));
12
+ }
13
+ }
14
+ exports.CDSSelect = CDSSelect;
15
+ //# sourceMappingURL=cds_select.js.map
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CDSSource = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ class CDSSource 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.CDSSource = CDSSource;
12
+ //# sourceMappingURL=cds_source.js.map
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CDSWhere = void 0;
4
+ const _1 = require(".");
5
+ const combi_1 = require("../../abap/2_statements/combi");
6
+ class CDSWhere extends combi_1.Expression {
7
+ getRunnable() {
8
+ const constant = (0, combi_1.regex)(/^'[\w ]+'$/);
9
+ const field = (0, combi_1.seq)(_1.CDSName, (0, combi_1.star)((0, combi_1.seq)(".", _1.CDSName)));
10
+ const condition = (0, combi_1.seq)(field, "=", (0, combi_1.alt)(constant, field));
11
+ return (0, combi_1.seq)("WHERE", condition, (0, combi_1.star)((0, combi_1.seq)("AND", condition)));
12
+ }
13
+ }
14
+ exports.CDSWhere = CDSWhere;
15
+ //# sourceMappingURL=cds_where.js.map
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./cds_annotation"), exports);
14
+ __exportStar(require("./cds_as"), exports);
15
+ __exportStar(require("./cds_association"), exports);
16
+ __exportStar(require("./cds_cast"), exports);
17
+ __exportStar(require("./cds_define_view"), exports);
18
+ __exportStar(require("./cds_element"), exports);
19
+ __exportStar(require("./cds_function"), exports);
20
+ __exportStar(require("./cds_join"), exports);
21
+ __exportStar(require("./cds_name"), exports);
22
+ __exportStar(require("./cds_select"), exports);
23
+ __exportStar(require("./cds_source"), exports);
24
+ __exportStar(require("./cds_where"), exports);
25
+ //# sourceMappingURL=index.js.map
@@ -46,6 +46,7 @@ class Config {
46
46
  global: {
47
47
  files: "/src/**/*.*",
48
48
  exclude: [],
49
+ noIssues: [],
49
50
  skipGeneratedGatewayClasses: true,
50
51
  skipGeneratedPersistentClasses: true,
51
52
  skipGeneratedFunctionGroups: true,
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ArtifactsDDL = void 0;
4
+ const Expressions = require("./expressions");
5
+ class ArtifactsDDL {
6
+ static getExpressions() {
7
+ const ret = [];
8
+ const list = Expressions;
9
+ for (const key in Expressions) {
10
+ if (typeof list[key] === "function") {
11
+ ret.push(list[key]);
12
+ }
13
+ }
14
+ return ret;
15
+ }
16
+ }
17
+ exports.ArtifactsDDL = ArtifactsDDL;
18
+ //# sourceMappingURL=artifacts.js.map
@@ -5,7 +5,7 @@ const combi_1 = require("../abap/2_statements/combi");
5
5
  const nodes_1 = require("../abap/nodes");
6
6
  const version_1 = require("../version");
7
7
  const ddl_lexer_1 = require("./ddl_lexer");
8
- const Expressions = require("../abap/2_statements/expressions");
8
+ const Expressions = require("./expressions");
9
9
  var DDLKind;
10
10
  (function (DDLKind) {
11
11
  DDLKind["Structure"] = "structure";
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DDLInclude = void 0;
4
- const combi_1 = require("../../combi");
4
+ const combi_1 = require("../../abap/2_statements/combi");
5
5
  const ddl_name_1 = require("./ddl_name");
6
6
  class DDLInclude extends combi_1.Expression {
7
7
  getRunnable() {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DDLName = void 0;
4
- const combi_1 = require("../../combi");
4
+ const combi_1 = require("../../abap/2_statements/combi");
5
5
  class DDLName extends combi_1.Expression {
6
6
  getRunnable() {
7
7
  return (0, combi_1.regex)(/^\w+$/);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DDLStructure = void 0;
4
- const combi_1 = require("../../combi");
4
+ const combi_1 = require("../../abap/2_statements/combi");
5
5
  const ddl_structure_field_1 = require("./ddl_structure_field");
6
6
  const ddl_name_1 = require("./ddl_name");
7
7
  const ddl_include_1 = require("./ddl_include");
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DDLStructureField = void 0;
4
- const combi_1 = require("../../combi");
4
+ const combi_1 = require("../../abap/2_statements/combi");
5
5
  const ddl_name_1 = require("./ddl_name");
6
6
  const ddl_type_1 = require("./ddl_type");
7
7
  class DDLStructureField extends combi_1.Expression {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DDLTable = void 0;
4
- const combi_1 = require("../../combi");
4
+ const combi_1 = require("../../abap/2_statements/combi");
5
5
  const ddl_include_1 = require("./ddl_include");
6
6
  const ddl_name_1 = require("./ddl_name");
7
7
  const ddl_table_field_1 = require("./ddl_table_field");
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DDLTableField = void 0;
4
- const combi_1 = require("../../combi");
4
+ const combi_1 = require("../../abap/2_statements/combi");
5
5
  const ddl_name_1 = require("./ddl_name");
6
6
  const ddl_type_1 = require("./ddl_type");
7
7
  class DDLTableField extends combi_1.Expression {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DDLType = void 0;
4
- const combi_1 = require("../../combi");
4
+ const combi_1 = require("../../abap/2_statements/combi");
5
5
  class DDLType extends combi_1.Expression {
6
6
  getRunnable() {
7
7
  return (0, combi_1.regex)(/^(abap\.)?\w+(\(\d+\))?$/);
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./ddl_include"), exports);
14
+ __exportStar(require("./ddl_name"), exports);
15
+ __exportStar(require("./ddl_structure_field"), exports);
16
+ __exportStar(require("./ddl_structure"), exports);
17
+ __exportStar(require("./ddl_table_field"), exports);
18
+ __exportStar(require("./ddl_table"), exports);
19
+ __exportStar(require("./ddl_type"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -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.Artifacts = 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.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");
@@ -16,7 +16,7 @@ Object.defineProperty(exports, "LanguageServer", { enumerable: true, get: functi
16
16
  const LanguageServerTypes = require("./lsp/_interfaces");
17
17
  exports.LanguageServerTypes = LanguageServerTypes;
18
18
  const artifacts_1 = require("./abap/artifacts");
19
- Object.defineProperty(exports, "Artifacts", { enumerable: true, get: function () { return artifacts_1.Artifacts; } });
19
+ Object.defineProperty(exports, "ArtifactsABAP", { enumerable: true, get: function () { return artifacts_1.ArtifactsABAP; } });
20
20
  const artifacts_objects_1 = require("./artifacts_objects");
21
21
  Object.defineProperty(exports, "ArtifactsObjects", { enumerable: true, get: function () { return artifacts_objects_1.ArtifactsObjects; } });
22
22
  const artifacts_rules_1 = require("./artifacts_rules");
@@ -2,11 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DataDefinition = void 0;
4
4
  const basic_1 = require("../abap/types/basic");
5
+ const cds_parser_1 = require("../cds/cds_parser");
6
+ const expressions_1 = require("../cds/expressions");
5
7
  const _abstract_object_1 = require("./_abstract_object");
6
8
  class DataDefinition extends _abstract_object_1.AbstractObject {
7
9
  constructor() {
8
10
  super(...arguments);
9
11
  this.sqlViewName = undefined;
12
+ this.parserError = undefined;
13
+ this.fieldNames = [];
14
+ this.sources = [];
10
15
  }
11
16
  getType() {
12
17
  return "DDLS";
@@ -25,24 +30,81 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
25
30
  return undefined;
26
31
  }
27
32
  parseType(_reg) {
28
- return new basic_1.VoidType("DDLS:todo");
33
+ this.parse();
34
+ if (this.fieldNames.length === 0) {
35
+ return new basic_1.VoidType("DDLS:todo");
36
+ }
37
+ else {
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
+ }
47
+ }
48
+ listSources() {
49
+ return this.sources;
29
50
  }
30
51
  setDirty() {
31
52
  this.sqlViewName = undefined;
53
+ this.parserError = undefined;
54
+ this.fieldNames = [];
55
+ this.sources = [];
32
56
  super.setDirty();
33
57
  }
58
+ findSourceFile() {
59
+ return this.getFiles().find(f => f.getFilename().endsWith(".asddls"));
60
+ }
61
+ hasParserError() {
62
+ return this.parserError;
63
+ }
34
64
  parse() {
65
+ var _a;
35
66
  if (this.isDirty() === false) {
36
67
  return { updated: false, runtime: 0 };
37
68
  }
38
69
  this.sqlViewName = undefined;
39
- const asddls = this.getFiles().find(f => f.getFilename().endsWith(".asddls"));
40
- const match = asddls === null || asddls === void 0 ? void 0 : asddls.getRaw().match(/@AbapCatalog\.sqlViewName: '(\w+)'/);
70
+ const match = (_a = this.findSourceFile()) === null || _a === void 0 ? void 0 : _a.getRaw().match(/@AbapCatalog\.sqlViewName: '(\w+)'/);
41
71
  if (match) {
42
72
  this.sqlViewName = match[1].toUpperCase();
43
73
  }
74
+ const tree = new cds_parser_1.CDSParser().parse(this.findSourceFile());
75
+ if (tree) {
76
+ this.findFieldNames(tree);
77
+ this.findSources(tree);
78
+ }
79
+ else {
80
+ this.parserError = true;
81
+ }
82
+ this.dirty = false;
44
83
  return { updated: true, runtime: 0 };
45
84
  }
85
+ findFieldNames(tree) {
86
+ var _a;
87
+ this.fieldNames = [];
88
+ for (const e of tree.findAllExpressions(expressions_1.CDSElement)) {
89
+ let found = (_a = e.findDirectExpression(expressions_1.CDSAs)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(expressions_1.CDSName);
90
+ if (found === undefined) {
91
+ found = e.findDirectExpression(expressions_1.CDSName);
92
+ }
93
+ if (found === undefined) {
94
+ continue;
95
+ }
96
+ this.fieldNames.push(found === null || found === void 0 ? void 0 : found.concatTokens());
97
+ }
98
+ }
99
+ findSources(tree) {
100
+ var _a, _b;
101
+ this.sources = [];
102
+ for (const e of tree.findAllExpressions(expressions_1.CDSSource)) {
103
+ const name = e.getFirstToken().getStr();
104
+ 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();
105
+ this.sources.push({ name, as });
106
+ }
107
+ }
46
108
  }
47
109
  exports.DataDefinition = DataDefinition;
48
110
  //# sourceMappingURL=data_definition.js.map
@@ -68,7 +68,7 @@ class Registry {
68
68
  }
69
69
  static abaplintVersion() {
70
70
  // magic, see build script "version.sh"
71
- return "2.82.17";
71
+ return "2.83.3";
72
72
  }
73
73
  getDDICReferences() {
74
74
  return this.references;
@@ -326,10 +326,23 @@ class Registry {
326
326
  excludeIssues(issues) {
327
327
  var _a;
328
328
  const ret = issues;
329
+ const globalNoIssues = this.conf.getGlobal().noIssues || [];
330
+ const globalNoIssuesPatterns = globalNoIssues.map(x => new RegExp(x, "i"));
331
+ if (globalNoIssuesPatterns.length > 0) {
332
+ for (let i = ret.length - 1; i >= 0; i--) {
333
+ const filename = ret[i].getFilename();
334
+ if (excludeHelper_1.ExcludeHelper.isExcluded(filename, globalNoIssuesPatterns)) {
335
+ ret.splice(i, 1);
336
+ }
337
+ }
338
+ }
329
339
  // exclude issues, as now we know both the filename and issue key
330
340
  for (const rule of artifacts_rules_1.ArtifactsRules.getRules()) {
331
341
  const key = rule.getMetadata().key;
332
- const ruleExclude = ((_a = this.conf.readByKey(key, "exclude")) !== null && _a !== void 0 ? _a : []);
342
+ const ruleExclude = (_a = this.conf.readByKey(key, "exclude")) !== null && _a !== void 0 ? _a : [];
343
+ if (ruleExclude.length === 0) {
344
+ continue;
345
+ }
333
346
  const ruleExcludePatterns = ruleExclude.map(x => new RegExp(x, "i"));
334
347
  for (let i = ret.length - 1; i >= 0; i--) {
335
348
  if (ret[i].getKey() !== key) {
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CDSParserError = exports.CDSParserErrorConf = void 0;
4
+ const issue_1 = require("../issue");
5
+ const _irule_1 = require("./_irule");
6
+ const _basic_rule_config_1 = require("./_basic_rule_config");
7
+ const objects_1 = require("../objects");
8
+ class CDSParserErrorConf extends _basic_rule_config_1.BasicRuleConfig {
9
+ }
10
+ exports.CDSParserErrorConf = CDSParserErrorConf;
11
+ class CDSParserError {
12
+ constructor() {
13
+ this.conf = new CDSParserErrorConf();
14
+ }
15
+ getMetadata() {
16
+ return {
17
+ key: "cds_parser_error",
18
+ title: "CDS Parser Error",
19
+ shortDescription: `CDS parsing, experimental`,
20
+ extendedInformation: ``,
21
+ tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.Experimental],
22
+ };
23
+ }
24
+ getConfig() {
25
+ return this.conf;
26
+ }
27
+ setConfig(conf) {
28
+ this.conf = conf;
29
+ }
30
+ initialize(_reg) {
31
+ return this;
32
+ }
33
+ run(o) {
34
+ const issues = [];
35
+ if (o.getType() === "DDLS" && o instanceof objects_1.DataDefinition) {
36
+ const hasError = o.hasParserError();
37
+ const file = o.findSourceFile();
38
+ if (hasError === true && file) {
39
+ issues.push(issue_1.Issue.atRow(file, 1, "CDS Parser error", this.getMetadata().key));
40
+ }
41
+ }
42
+ return issues;
43
+ }
44
+ }
45
+ exports.CDSParserError = CDSParserError;
46
+ //# sourceMappingURL=cds_parser_error.js.map
@@ -20,6 +20,7 @@ __exportStar(require("./avoid_use"), exports);
20
20
  __exportStar(require("./begin_end_names"), exports);
21
21
  __exportStar(require("./begin_single_include"), exports);
22
22
  __exportStar(require("./call_transaction_authority_check"), exports);
23
+ __exportStar(require("./cds_parser_error"), exports);
23
24
  __exportStar(require("./chain_mainly_declarations"), exports);
24
25
  __exportStar(require("./check_abstract"), exports);
25
26
  __exportStar(require("./check_comments"), exports);
@@ -92,6 +93,7 @@ __exportStar(require("./msag_consistency"), exports);
92
93
  __exportStar(require("./names_no_dash"), exports);
93
94
  __exportStar(require("./nesting"), exports);
94
95
  __exportStar(require("./newline_between_methods"), exports);
96
+ __exportStar(require("./no_aliases"), exports);
95
97
  __exportStar(require("./no_chained_assignment"), exports);
96
98
  __exportStar(require("./no_public_attributes"), exports);
97
99
  __exportStar(require("./no_yoda_conditions"), exports);
@@ -103,6 +105,7 @@ __exportStar(require("./parser_702_chaining"), exports);
103
105
  __exportStar(require("./parser_error"), exports);
104
106
  __exportStar(require("./parser_missing_space"), exports);
105
107
  __exportStar(require("./pragma_placement"), exports);
108
+ __exportStar(require("./prefer_corresponding"), exports);
106
109
  __exportStar(require("./prefer_inline"), exports);
107
110
  __exportStar(require("./prefer_is_not"), exports);
108
111
  __exportStar(require("./prefer_raise_exception_new"), exports);
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NoAliases = exports.NoAliasesConf = void 0;
4
+ const issue_1 = require("../issue");
5
+ const _basic_rule_config_1 = require("./_basic_rule_config");
6
+ const _abap_rule_1 = require("./_abap_rule");
7
+ const Statements = require("../abap/2_statements/statements");
8
+ const _irule_1 = require("./_irule");
9
+ class NoAliasesConf extends _basic_rule_config_1.BasicRuleConfig {
10
+ }
11
+ exports.NoAliasesConf = NoAliasesConf;
12
+ class NoAliases extends _abap_rule_1.ABAPRule {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.conf = new NoAliasesConf();
16
+ }
17
+ getMetadata() {
18
+ return {
19
+ key: "no_aliases",
20
+ title: "No ALIASES",
21
+ shortDescription: `Detects use of the ALIAS statement`,
22
+ tags: [_irule_1.RuleTag.SingleFile],
23
+ };
24
+ }
25
+ getConfig() {
26
+ return this.conf;
27
+ }
28
+ setConfig(conf) {
29
+ this.conf = conf;
30
+ }
31
+ runParsed(file) {
32
+ const issues = [];
33
+ const message = "Do not use ALIASES";
34
+ for (const stat of file.getStatements()) {
35
+ if (stat.get() instanceof Statements.Aliases) {
36
+ issues.push(issue_1.Issue.atStatement(file, stat, message, this.getMetadata().key, this.conf.severity));
37
+ }
38
+ }
39
+ return issues;
40
+ }
41
+ }
42
+ exports.NoAliases = NoAliases;
43
+ //# sourceMappingURL=no_aliases.js.map
@@ -106,6 +106,8 @@ RANGES: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abapranges.ht
106
106
 
107
107
  PACK: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abappack.htm
108
108
 
109
+ MOVE: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapmove_obs.htm
110
+
109
111
  SELECT without INTO: https://help.sap.com/doc/abapdocu_731_index_htm/7.31/en-US/abapselect_obsolete.htm
110
112
  SELECT COUNT(*) is considered okay
111
113
 
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PreferCorresponding = exports.PreferCorrespondingConf = void 0;
4
+ const issue_1 = require("../issue");
5
+ const _basic_rule_config_1 = require("./_basic_rule_config");
6
+ const _abap_rule_1 = require("./_abap_rule");
7
+ const Statements = require("../abap/2_statements/statements");
8
+ const _irule_1 = require("./_irule");
9
+ const version_1 = require("../version");
10
+ class PreferCorrespondingConf extends _basic_rule_config_1.BasicRuleConfig {
11
+ }
12
+ exports.PreferCorrespondingConf = PreferCorrespondingConf;
13
+ class PreferCorresponding extends _abap_rule_1.ABAPRule {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.conf = new PreferCorrespondingConf();
17
+ }
18
+ getMetadata() {
19
+ return {
20
+ key: "prefer_corresponding",
21
+ title: "Prefer corresponding( ) to MOVE-CORRESPONDING",
22
+ shortDescription: `Prefer corresponding( ) to MOVE-CORRESPONDING, from v740sp05 and up`,
23
+ tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Upport],
24
+ };
25
+ }
26
+ getConfig() {
27
+ return this.conf;
28
+ }
29
+ setConfig(conf) {
30
+ this.conf = conf;
31
+ }
32
+ runParsed(file) {
33
+ const issues = [];
34
+ if (this.reg.getConfig().getVersion() < version_1.Version.v740sp05) {
35
+ return issues;
36
+ }
37
+ const message = "Use CORRESPONDING type( ... ) instead";
38
+ for (const stat of file.getStatements()) {
39
+ if (stat.get() instanceof Statements.MoveCorresponding
40
+ && stat.getChildren().length === 7) {
41
+ issues.push(issue_1.Issue.atStatement(file, stat, message, this.getMetadata().key, this.conf.severity));
42
+ }
43
+ }
44
+ return issues;
45
+ }
46
+ }
47
+ exports.PreferCorresponding = PreferCorresponding;
48
+ //# sourceMappingURL=prefer_corresponding.js.map
@@ -41,7 +41,7 @@ If the target is a sorted/hashed table, no issue is reported`,
41
41
  this.conf = conf;
42
42
  }
43
43
  run(obj) {
44
- var _a, _b, _c;
44
+ var _a;
45
45
  const issues = [];
46
46
  if (!(obj instanceof _abap_object_1.ABAPObject) || obj.getType() === "INTF") {
47
47
  return [];
@@ -67,21 +67,36 @@ If the target is a sorted/hashed table, no issue is reported`,
67
67
  else if (s.findFirstExpression(Expressions.SQLOrderBy)) {
68
68
  continue;
69
69
  }
70
- const target = (_b = s.findFirstExpression(Expressions.SQLIntoTable)) === null || _b === void 0 ? void 0 : _b.findFirstExpression(Expressions.Target);
71
- if (target) {
72
- const start = target.getFirstToken().getStart();
73
- const scope = spaghetti.lookupPosition(start, file.getFilename());
74
- const type = (_c = scope === null || scope === void 0 ? void 0 : scope.findWriteReference(start)) === null || _c === void 0 ? void 0 : _c.getType();
75
- if (type instanceof basic_1.TableType
76
- && ((type === null || type === void 0 ? void 0 : type.getAccessType()) === basic_1.TableAccessType.sorted || (type === null || type === void 0 ? void 0 : type.getAccessType()) === basic_1.TableAccessType.hashed)) {
77
- continue;
78
- }
70
+ if (this.isTargetSortedOrHashed(s, spaghetti, file)) {
71
+ continue;
79
72
  }
80
73
  issues.push(issue_1.Issue.atStatement(file, s, "Add ORDER BY", this.getMetadata().key, this.conf.severity));
81
74
  }
82
75
  }
83
76
  return issues;
84
77
  }
78
+ isTargetSortedOrHashed(s, spaghetti, file) {
79
+ var _a, _b;
80
+ const target = (_a = s.findFirstExpression(Expressions.SQLIntoTable)) === null || _a === void 0 ? void 0 : _a.findFirstExpression(Expressions.Target);
81
+ if (target) {
82
+ const start = target.getFirstToken().getStart();
83
+ const scope = spaghetti.lookupPosition(start, file.getFilename());
84
+ let type = (_b = scope === null || scope === void 0 ? void 0 : scope.findWriteReference(start)) === null || _b === void 0 ? void 0 : _b.getType();
85
+ const children = target.getChildren();
86
+ if (type instanceof basic_1.StructureType && children.length >= 3 && children[1].concatTokens() === "-") {
87
+ const found = type.getComponentByName(children[2].concatTokens());
88
+ if (found === undefined) {
89
+ return false;
90
+ }
91
+ type = found;
92
+ }
93
+ if (type instanceof basic_1.TableType
94
+ && ((type === null || type === void 0 ? void 0 : type.getAccessType()) === basic_1.TableAccessType.sorted || (type === null || type === void 0 ? void 0 : type.getAccessType()) === basic_1.TableAccessType.hashed)) {
95
+ return true;
96
+ }
97
+ }
98
+ return false;
99
+ }
85
100
  }
86
101
  exports.SelectAddOrderBy = SelectAddOrderBy;
87
102
  //# sourceMappingURL=select_add_order_by.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.82.17",
3
+ "version": "2.83.3",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -48,14 +48,14 @@
48
48
  "@microsoft/api-extractor": "^7.19.2",
49
49
  "@types/chai": "^4.3.0",
50
50
  "@types/mocha": "^9.0.0",
51
- "@types/node": "^16.11.12",
51
+ "@types/node": "^17.0.4",
52
52
  "chai": "^4.3.4",
53
- "eslint": "^8.4.1",
53
+ "eslint": "^8.5.0",
54
54
  "mocha": "^9.1.3",
55
55
  "c8": "^7.10.0",
56
56
  "source-map-support": "^0.5.21",
57
57
  "ts-json-schema-generator": "^0.97.0",
58
- "typescript": "^4.5.3"
58
+ "typescript": "^4.5.4"
59
59
  },
60
60
  "dependencies": {
61
61
  "fast-xml-parser": "^3.21.1",