@abaplint/core 2.113.201 → 2.113.203

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.
@@ -6,19 +6,17 @@ const virtual_position_1 = require("../../virtual_position");
6
6
  const tokens_1 = require("./tokens");
7
7
  const lexer_buffer_1 = require("./lexer_buffer");
8
8
  const lexer_stream_1 = require("./lexer_stream");
9
+ const ModeNormal = 1;
10
+ const ModePing = 2;
11
+ const ModeStr = 3;
12
+ const ModeTemplate = 4;
13
+ const ModeComment = 5;
14
+ const ModePragma = 6;
9
15
  class Lexer {
10
- constructor() {
11
- this.ModeNormal = 1;
12
- this.ModePing = 2;
13
- this.ModeStr = 3;
14
- this.ModeTemplate = 4;
15
- this.ModeComment = 5;
16
- this.ModePragma = 6;
17
- }
18
16
  run(file, virtual) {
19
17
  this.virtual = virtual;
20
18
  this.tokens = [];
21
- this.m = this.ModeNormal;
19
+ this.m = ModeNormal;
22
20
  this.process(file.getRaw());
23
21
  return { file, tokens: this.tokens };
24
22
  }
@@ -44,13 +42,13 @@ class Lexer {
44
42
  pos = new virtual_position_1.VirtualPosition(this.virtual, pos.getRow(), pos.getCol());
45
43
  }
46
44
  let tok = undefined;
47
- if (this.m === this.ModeComment) {
45
+ if (this.m === ModeComment) {
48
46
  tok = new tokens_1.Comment(pos, s);
49
47
  }
50
- else if (this.m === this.ModePing || this.m === this.ModeStr) {
48
+ else if (this.m === ModePing || this.m === ModeStr) {
51
49
  tok = new tokens_1.StringToken(pos, s);
52
50
  }
53
- else if (this.m === this.ModeTemplate) {
51
+ else if (this.m === ModeTemplate) {
54
52
  const first = s.charAt(0);
55
53
  const last = s.charAt(s.length - 1);
56
54
  if (first === "|" && last === "|") {
@@ -243,35 +241,35 @@ class Lexer {
243
241
  const buf = this.buffer.add(current);
244
242
  const ahead = this.stream.nextChar();
245
243
  const aahead = this.stream.nextNextChar();
246
- if (this.m === this.ModeNormal) {
244
+ if (this.m === ModeNormal) {
247
245
  if (splits[ahead]) {
248
246
  this.add();
249
247
  }
250
248
  else if (ahead === "'") {
251
249
  // start string
252
250
  this.add();
253
- this.m = this.ModeStr;
251
+ this.m = ModeStr;
254
252
  }
255
253
  else if (ahead === "|" || ahead === "}") {
256
254
  // start template
257
255
  this.add();
258
- this.m = this.ModeTemplate;
256
+ this.m = ModeTemplate;
259
257
  }
260
258
  else if (ahead === "`") {
261
259
  // start ping
262
260
  this.add();
263
- this.m = this.ModePing;
261
+ this.m = ModePing;
264
262
  }
265
263
  else if (aahead === "##") {
266
264
  // start pragma
267
265
  this.add();
268
- this.m = this.ModePragma;
266
+ this.m = ModePragma;
269
267
  }
270
268
  else if (ahead === "\""
271
269
  || (ahead === "*" && current === "\n")) {
272
270
  // start comment
273
271
  this.add();
274
- this.m = this.ModeComment;
272
+ this.m = ModeComment;
275
273
  }
276
274
  else if (ahead === "@" && buf.trim().length === 0) {
277
275
  this.add();
@@ -292,12 +290,12 @@ class Lexer {
292
290
  this.add();
293
291
  }
294
292
  }
295
- else if (this.m === this.ModePragma && (ahead === "," || ahead === ":" || ahead === "." || ahead === " " || ahead === "\n")) {
293
+ else if (this.m === ModePragma && (ahead === "," || ahead === ":" || ahead === "." || ahead === " " || ahead === "\n")) {
296
294
  // end of pragma
297
295
  this.add();
298
- this.m = this.ModeNormal;
296
+ this.m = ModeNormal;
299
297
  }
300
- else if (this.m === this.ModePing
298
+ else if (this.m === ModePing
301
299
  && buf.length > 1
302
300
  && current === "`"
303
301
  && aahead !== "``"
@@ -306,26 +304,26 @@ class Lexer {
306
304
  // end of ping
307
305
  this.add();
308
306
  if (ahead === `"`) {
309
- this.m = this.ModeComment;
307
+ this.m = ModeComment;
310
308
  }
311
309
  else {
312
- this.m = this.ModeNormal;
310
+ this.m = ModeNormal;
313
311
  }
314
312
  }
315
- else if (this.m === this.ModeTemplate
313
+ else if (this.m === ModeTemplate
316
314
  && buf.length > 1
317
315
  && (current === "|" || current === "{")
318
316
  && (this.stream.prevChar() !== "\\" || this.stream.prevPrevChar() === "\\\\")) {
319
317
  // end of template
320
318
  this.add();
321
- this.m = this.ModeNormal;
319
+ this.m = ModeNormal;
322
320
  }
323
- else if (this.m === this.ModeTemplate
321
+ else if (this.m === ModeTemplate
324
322
  && ahead === "}"
325
323
  && current !== "\\") {
326
324
  this.add();
327
325
  }
328
- else if (this.m === this.ModeStr
326
+ else if (this.m === ModeStr
329
327
  && current === "'"
330
328
  && buf.length > 1
331
329
  && aahead !== "''"
@@ -334,17 +332,17 @@ class Lexer {
334
332
  // end of string
335
333
  this.add();
336
334
  if (ahead === "\"") {
337
- this.m = this.ModeComment;
335
+ this.m = ModeComment;
338
336
  }
339
337
  else {
340
- this.m = this.ModeNormal;
338
+ this.m = ModeNormal;
341
339
  }
342
340
  }
343
- else if (ahead === "\n" && this.m !== this.ModeTemplate) {
341
+ else if (ahead === "\n" && this.m !== ModeTemplate) {
344
342
  this.add();
345
- this.m = this.ModeNormal;
343
+ this.m = ModeNormal;
346
344
  }
347
- else if (this.m === this.ModeTemplate && current === "\n") {
345
+ else if (this.m === ModeTemplate && current === "\n") {
348
346
  this.add();
349
347
  }
350
348
  if (!this.stream.advance()) {
@@ -42,7 +42,7 @@ class Table extends _abstract_object_1.AbstractObject {
42
42
  }
43
43
  getAllowedNaming() {
44
44
  let length = 30;
45
- const regex = /^((\/[A-Z_\d]{3,8}\/)|[a-zA-Z0-9]{3})\w+$/;
45
+ const regex = /^((\/[A-Z_\d]{3,8}\/)|[a-zA-Z0-9]{3}|CI_)\w+$/;
46
46
  if (this.getTableCategory() === TableCategory.Transparent) {
47
47
  length = 16;
48
48
  }
@@ -67,7 +67,7 @@ class Registry {
67
67
  }
68
68
  static abaplintVersion() {
69
69
  // magic, see build script "version.sh"
70
- return "2.113.201";
70
+ return "2.113.203";
71
71
  }
72
72
  getDDICReferences() {
73
73
  return this.ddicReferences;
@@ -11,6 +11,7 @@ class CheckCommentsConf extends _basic_rule_config_1.BasicRuleConfig {
11
11
  super(...arguments);
12
12
  /** Allows the use of end-of-line comments. */
13
13
  this.allowEndOfLine = false;
14
+ this.maxIssuesPerFile = 10;
14
15
  }
15
16
  }
16
17
  exports.CheckCommentsConf = CheckCommentsConf;
@@ -56,6 +57,10 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#put-comment
56
57
  if (this.conf.allowEndOfLine === true) {
57
58
  return [];
58
59
  }
60
+ let max = this.getConfig().maxIssuesPerFile;
61
+ if (max === undefined || max < 1) {
62
+ max = 10;
63
+ }
59
64
  const commentRows = [];
60
65
  for (let i = 0; i < rows.length; i++) {
61
66
  const row = rows[i];
@@ -72,6 +77,9 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#put-comment
72
77
  continue;
73
78
  }
74
79
  issues.push(issue_1.Issue.atStatement(file, statement, this.getDescription(IssueType.EndOfLine), this.getMetadata().key, this.conf.severity));
80
+ if (issues.length >= max) {
81
+ break;
82
+ }
75
83
  }
76
84
  }
77
85
  return issues;
@@ -26,6 +26,7 @@ class IndentationConf extends _basic_rule_config_1.BasicRuleConfig {
26
26
  this.globalClassSkipFirst = false;
27
27
  this.ignoreGlobalClassDefinition = false;
28
28
  this.ignoreGlobalInterface = false;
29
+ this.maxIssuesPerFile = 10;
29
30
  }
30
31
  }
31
32
  exports.IndentationConf = IndentationConf;
@@ -68,7 +69,10 @@ ENDCLASS.`,
68
69
  }
69
70
  runParsed(file, obj) {
70
71
  var _a, _b;
71
- const MAX_ISSUES = 100;
72
+ let max = this.getConfig().maxIssuesPerFile;
73
+ if (max === undefined || max < 1) {
74
+ max = 10;
75
+ }
72
76
  let skip = false;
73
77
  if (file.getStructure() === undefined) {
74
78
  return []; // syntax error in file
@@ -140,7 +144,7 @@ ENDCLASS.`,
140
144
  const message = "Indentation problem, expected " + expected + " spaces";
141
145
  const issue = issue_1.Issue.atPosition(file, position, message, this.getMetadata().key, this.conf.severity, fix);
142
146
  ret.push(issue);
143
- if (ret.length >= MAX_ISSUES) {
147
+ if (ret.length >= max) {
144
148
  break;
145
149
  }
146
150
  }
@@ -33,6 +33,7 @@ class KeywordCaseConf extends _basic_rule_config_1.BasicRuleConfig {
33
33
  this.ignoreGlobalClassBoundaries = false;
34
34
  /** A list of keywords to be ignored */
35
35
  this.ignoreKeywords = [];
36
+ this.maxIssuesPerFile = 10;
36
37
  }
37
38
  }
38
39
  exports.KeywordCaseConf = KeywordCaseConf;
@@ -143,6 +144,10 @@ class KeywordCase extends _abap_rule_1.ABAPRule {
143
144
  return [];
144
145
  }
145
146
  }
147
+ let max = this.getConfig().maxIssuesPerFile;
148
+ if (max === undefined || max < 1) {
149
+ max = 10;
150
+ }
146
151
  const skip = new Skip(this.getConfig());
147
152
  let prev = undefined;
148
153
  for (const statement of file.getStatements()) {
@@ -165,6 +170,9 @@ class KeywordCase extends _abap_rule_1.ABAPRule {
165
170
  }
166
171
  prev = result[0].token;
167
172
  }
173
+ if (issues.length >= max) {
174
+ break;
175
+ }
168
176
  }
169
177
  return issues;
170
178
  }
@@ -10,6 +10,7 @@ class LineLengthConf extends _basic_rule_config_1.BasicRuleConfig {
10
10
  super(...arguments);
11
11
  /** Maximum line length in characters, trailing whitespace ignored */
12
12
  this.length = 120;
13
+ this.maxIssuesPerFile = 10;
13
14
  }
14
15
  }
15
16
  exports.LineLengthConf = LineLengthConf;
@@ -38,6 +39,10 @@ https://docs.abapopenchecks.org/checks/04/`,
38
39
  const issues = [];
39
40
  // maximum line length in abap files
40
41
  const maxLineLength = 255;
42
+ let max = this.getConfig().maxIssuesPerFile;
43
+ if (max === undefined || max < 1) {
44
+ max = 10;
45
+ }
41
46
  const array = file.getRawRows();
42
47
  for (let rowIndex = 0; rowIndex < array.length; rowIndex++) {
43
48
  const row = array[rowIndex].replace("\r", "");
@@ -49,6 +54,9 @@ https://docs.abapopenchecks.org/checks/04/`,
49
54
  const message = `Reduce line length to max ${this.conf.length}, currently ${row.length}`;
50
55
  issues.push(issue_1.Issue.atRow(file, rowIndex + 1, message, this.getMetadata().key, this.conf.severity));
51
56
  }
57
+ if (issues.length >= max) {
58
+ break;
59
+ }
52
60
  }
53
61
  return issues;
54
62
  }
@@ -23,6 +23,7 @@ class NoPrefixesConf extends _basic_rule_config_1.BasicRuleConfig {
23
23
  /** importing, exporting, returning and changing parameters, case insensitive regex */
24
24
  this.methodParameters = "^[ICER].?_";
25
25
  this.allowIsPrefixBoolean = true;
26
+ this.maxIssuesPerFile = 10;
26
27
  // todo, public localClass: string = "";
27
28
  // todo, public localInterface: string = "";
28
29
  // todo, public functionModuleParameters: string = "";
@@ -69,21 +70,40 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/sub-sections/AvoidEncodi
69
70
  // syntax error, skip
70
71
  return [];
71
72
  }
73
+ let max = config.maxIssuesPerFile;
74
+ if (max === undefined || max < 1) {
75
+ max = 10;
76
+ }
72
77
  if (config.data !== undefined && config.data !== "") {
73
78
  ret.push(...this.checkData(structure, new RegExp(config.data, "i"), file));
74
79
  }
80
+ if (ret.length >= max) {
81
+ return ret;
82
+ }
75
83
  if (config.statics !== undefined && config.statics !== "") {
76
84
  ret.push(...this.checkStatics(structure, new RegExp(config.statics, "i"), file));
77
85
  }
86
+ if (ret.length >= max) {
87
+ return ret;
88
+ }
78
89
  if (config.fieldSymbols !== undefined && config.fieldSymbols !== "") {
79
90
  ret.push(...this.checkFieldSymbols(structure, new RegExp(config.fieldSymbols, "i"), file));
80
91
  }
92
+ if (ret.length >= max) {
93
+ return ret;
94
+ }
81
95
  if (config.constants !== undefined && config.constants !== "") {
82
96
  ret.push(...this.checkConstants(structure, new RegExp(config.constants, "i"), file));
83
97
  }
98
+ if (ret.length >= max) {
99
+ return ret;
100
+ }
84
101
  if (config.types !== undefined && config.types !== "") {
85
102
  ret.push(...this.checkTypes(structure, new RegExp(config.types, "i"), file));
86
103
  }
104
+ if (ret.length >= max) {
105
+ return ret;
106
+ }
87
107
  if (config.methodParameters !== undefined && config.methodParameters !== "") {
88
108
  ret.push(...this.checkMethodParameters(structure, new RegExp(config.methodParameters, "i"), file));
89
109
  }
@@ -8,6 +8,10 @@ const _irule_1 = require("./_irule");
8
8
  const edit_helper_1 = require("../edit_helper");
9
9
  const _statement_1 = require("../abap/2_statements/statements/_statement");
10
10
  class UnnecessaryChainingConf extends _basic_rule_config_1.BasicRuleConfig {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.maxIssuesPerFile = 10;
14
+ }
11
15
  }
12
16
  exports.UnnecessaryChainingConf = UnnecessaryChainingConf;
13
17
  class UnnecessaryChaining extends _abap_rule_1.ABAPRule {
@@ -34,6 +38,10 @@ class UnnecessaryChaining extends _abap_rule_1.ABAPRule {
34
38
  }
35
39
  runParsed(file) {
36
40
  const issues = [];
41
+ let max = this.getConfig().maxIssuesPerFile;
42
+ if (max === undefined || max < 1) {
43
+ max = 10;
44
+ }
37
45
  const statements = file.getStatements();
38
46
  for (let i = 0; i < statements.length; i++) {
39
47
  const colon = statements[i].getColon();
@@ -64,6 +72,9 @@ class UnnecessaryChaining extends _abap_rule_1.ABAPRule {
64
72
  const message = "Unnecessary chaining";
65
73
  const issue = issue_1.Issue.atToken(file, colon, message, this.getMetadata().key, this.conf.severity, fix);
66
74
  issues.push(issue);
75
+ if (issues.length >= max) {
76
+ break;
77
+ }
67
78
  }
68
79
  return issues;
69
80
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.113.201",
3
+ "version": "2.113.203",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",