@abaplint/cli 2.120.85 → 2.120.87

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 (2) hide show
  1. package/build/cli.js +205 -14
  2. package/package.json +2 -2
package/build/cli.js CHANGED
@@ -19442,11 +19442,15 @@ class Submit {
19442
19442
  const datasetExpiration = (0, combi_1.seq)("DATASET EXPIRATION", expressions_1.Source);
19443
19443
  const coverText = (0, combi_1.seq)("COVER TEXT", expressions_1.Source);
19444
19444
  const listName = (0, combi_1.seq)("LIST NAME", expressions_1.Source);
19445
+ const listDataset = (0, combi_1.seq)("LIST DATASET", expressions_1.Source);
19446
+ const listAuthority = (0, combi_1.seq)("LIST AUTHORITY", expressions_1.Source);
19447
+ const coverPage = (0, combi_1.seq)("COVER PAGE", expressions_1.Source);
19448
+ const department = (0, combi_1.seq)("DEPARTMENT", expressions_1.Source);
19445
19449
  const keep = (0, combi_1.seq)("KEEP IN SPOOL", expressions_1.Source);
19446
19450
  const imm = (0, combi_1.seq)("IMMEDIATELY", expressions_1.Source);
19447
19451
  const dest = (0, combi_1.seq)("DESTINATION", expressions_1.Source);
19448
19452
  const language = (0, combi_1.seq)("LANGUAGE", expressions_1.Source);
19449
- const perm = (0, combi_1.per)((0, combi_1.plusPrio)(awith), selectionTable, (0, combi_1.plusPrio)(awith), (0, combi_1.plusPrio)(awith), spool, lineSize, lineCount, archive, archiveMode, receiver, user, sset, ssetp, keep, cover, imm, layout, dest, coverText, listName, language, free, newList, uss, copies, datasetExpiration, "TO SAP-SPOOL", "WITHOUT SPOOL DYNPRO", "VIA SELECTION-SCREEN", exporting, expressions_1.AndReturn, job);
19453
+ const perm = (0, combi_1.per)((0, combi_1.plusPrio)(awith), selectionTable, (0, combi_1.plusPrio)(awith), (0, combi_1.plusPrio)(awith), spool, lineSize, lineCount, archive, archiveMode, receiver, user, sset, ssetp, keep, cover, imm, layout, dest, coverText, listName, listDataset, listAuthority, coverPage, department, language, free, newList, uss, copies, datasetExpiration, "TO SAP-SPOOL", "WITHOUT SPOOL DYNPRO", "VIA SELECTION-SCREEN", exporting, expressions_1.AndReturn, job);
19450
19454
  const ret = (0, combi_1.seq)("SUBMIT", prog, (0, combi_1.opt)(perm));
19451
19455
  return (0, combi_1.verNotLang)(version_1.LanguageVersion.Cloud, ret);
19452
19456
  }
@@ -28798,6 +28802,7 @@ const expressions_1 = __webpack_require__(/*! ../2_statements/expressions */ "..
28798
28802
  const _builtin_1 = __webpack_require__(/*! ./_builtin */ "../core/build/src/abap/5_syntax/_builtin.js");
28799
28803
  const position_1 = __webpack_require__(/*! ../../position */ "../core/build/src/position.js");
28800
28804
  const _syntax_input_1 = __webpack_require__(/*! ./_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
28805
+ const version_1 = __webpack_require__(/*! ../../version */ "../core/build/src/version.js");
28801
28806
  class BasicTypes {
28802
28807
  constructor(input) {
28803
28808
  this.input = input;
@@ -29023,7 +29028,14 @@ class BasicTypes {
29023
29028
  }
29024
29029
  const chainText = typeName.concatTokens().toUpperCase();
29025
29030
  const f = this.input.scope.getDDIC().lookupBuiltinType(chainText, length, decimals, qualifiedName);
29026
- if (f !== undefined) {
29031
+ if (f instanceof Types.Integer8Type
29032
+ && !(0, version_1.releaseAtLeast)(this.input.scope.getRelease(), version_1.Release.v750)
29033
+ && !this.input.scope.getOpenABAP()) {
29034
+ const message = "Type INT8 requires 7.50";
29035
+ this.input.issues.push((0, _syntax_input_1.syntaxIssue)(this.input, typeName.getFirstToken(), message));
29036
+ return basic_1.VoidType.get(_syntax_input_1.CheckSyntaxKey);
29037
+ }
29038
+ else if (f !== undefined) {
29027
29039
  return f;
29028
29040
  }
29029
29041
  const typ = this.input.scope.findType(chainText);
@@ -29817,6 +29829,10 @@ class BasicTypes {
29817
29829
  this.input.issues.push((0, _syntax_input_1.syntaxIssue)(this.input, chain.getFirstToken(), message));
29818
29830
  return undefined;
29819
29831
  }
29832
+ else if (concat === "SY-REPID" || concat === "SYST-REPID") {
29833
+ // predefined constant in every program, not a SYST component
29834
+ return undefined;
29835
+ }
29820
29836
  return this.resolveConstantValue(chain);
29821
29837
  }
29822
29838
  throw new Error("findValue, unexpected");
@@ -43503,6 +43519,10 @@ class InsertInternal {
43503
43519
  if (sourceType instanceof basic_1.IntegerType && targetType instanceof basic_1.Integer8Type) {
43504
43520
  error = true;
43505
43521
  }
43522
+ else if (targetType instanceof basic_1.TableType && targetType.isWithHeader() && sourceType instanceof basic_1.TableType) {
43523
+ // LINES OF into a table with header line, compare the row types
43524
+ error = new _type_utils_1.TypeUtils(input.scope).isAssignable(sourceType.getRowType(), targetType.getRowType()) === false;
43525
+ }
43506
43526
  else if (new _type_utils_1.TypeUtils(input.scope).isAssignable(sourceType, targetType) === false) {
43507
43527
  error = true;
43508
43528
  }
@@ -72654,7 +72674,7 @@ class Registry {
72654
72674
  }
72655
72675
  static abaplintVersion() {
72656
72676
  // magic, see build script "version.js"
72657
- return "2.120.85";
72677
+ return "2.120.87";
72658
72678
  }
72659
72679
  getDDICReferences() {
72660
72680
  return this.ddicReferences;
@@ -75311,6 +75331,104 @@ exports.AbapdocParameterNames = AbapdocParameterNames;
75311
75331
 
75312
75332
  /***/ },
75313
75333
 
75334
+ /***/ "../core/build/src/rules/abapdoc_shorttext_length.js"
75335
+ /*!***********************************************************!*\
75336
+ !*** ../core/build/src/rules/abapdoc_shorttext_length.js ***!
75337
+ \***********************************************************/
75338
+ (__unused_webpack_module, exports, __webpack_require__) {
75339
+
75340
+ "use strict";
75341
+
75342
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
75343
+ exports.AbapdocShorttextLength = exports.AbapdocShorttextLengthConf = void 0;
75344
+ const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
75345
+ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
75346
+ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
75347
+ const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
75348
+ const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "../core/build/src/abap/2_statements/statements/_statement.js");
75349
+ class AbapdocShorttextLengthConf extends _basic_rule_config_1.BasicRuleConfig {
75350
+ }
75351
+ exports.AbapdocShorttextLengthConf = AbapdocShorttextLengthConf;
75352
+ const MAX_LENGTH = 60;
75353
+ class AbapdocShorttextLength extends _abap_rule_1.ABAPRule {
75354
+ constructor() {
75355
+ super(...arguments);
75356
+ this.conf = new AbapdocShorttextLengthConf();
75357
+ }
75358
+ getMetadata() {
75359
+ return {
75360
+ key: "abapdoc_shorttext_length",
75361
+ title: "ABAP Doc shorttext too long",
75362
+ shortDescription: `Reports ABAP Doc shorttexts longer than 60 characters.`,
75363
+ extendedInformation: `A shorttext is written as <p class="shorttext">...</p> or
75364
+ <p class="shorttext synchronized">...</p>, the system warns "Shorttext must not exceed 60 characters."
75365
+ if the text is longer.
75366
+
75367
+ The text may span several "! lines, line breaks count as one blank. Leading and trailing blanks are not counted,
75368
+ an entity like &lt; counts as one character.`,
75369
+ tags: [_irule_1.RuleTag.SingleFile],
75370
+ badExample: `INTERFACE zif_foo PUBLIC.
75371
+ "! <p class="shorttext synchronized">Returns the name of the selected row in the table of the view</p>
75372
+ METHODS name RETURNING VALUE(result) TYPE string.
75373
+ ENDINTERFACE.`,
75374
+ goodExample: `INTERFACE zif_foo PUBLIC.
75375
+ "! <p class="shorttext synchronized">Returns the name of the selected row</p>
75376
+ METHODS name RETURNING VALUE(result) TYPE string.
75377
+ ENDINTERFACE.`,
75378
+ };
75379
+ }
75380
+ getConfig() {
75381
+ return this.conf;
75382
+ }
75383
+ setConfig(conf) {
75384
+ this.conf = conf;
75385
+ }
75386
+ runParsed(file) {
75387
+ const issues = [];
75388
+ let block = [];
75389
+ for (const statement of file.getStatements()) {
75390
+ const token = statement.getFirstToken();
75391
+ const doc = statement.get() instanceof _statement_1.Comment && token.getStr().startsWith(`"!`);
75392
+ const previous = block[block.length - 1];
75393
+ if (doc === false || (previous !== undefined && token.getStart().getRow() !== previous.getStart().getRow() + 1)) {
75394
+ issues.push(...this.checkBlock(file, block));
75395
+ block = [];
75396
+ }
75397
+ if (doc === true) {
75398
+ block.push(token);
75399
+ }
75400
+ }
75401
+ issues.push(...this.checkBlock(file, block));
75402
+ return issues;
75403
+ }
75404
+ checkBlock(file, block) {
75405
+ const issues = [];
75406
+ if (block.length === 0) {
75407
+ return issues;
75408
+ }
75409
+ const text = block.map(t => t.getStr().substring(2)).join("\n");
75410
+ const regex = /<p\s[^>]*class\s*=\s*"shorttext(?:\s+synchronized)?"[^>]*>([\s\S]*?)<\/p>/gi;
75411
+ let match;
75412
+ while ((match = regex.exec(text)) !== null) {
75413
+ const length = this.decode(match[1].replace(/\s+/g, " ").trim()).length;
75414
+ if (length <= MAX_LENGTH) {
75415
+ continue;
75416
+ }
75417
+ const token = block[text.substring(0, match.index).split("\n").length - 1];
75418
+ const message = `Shorttext must not exceed ${MAX_LENGTH} characters, found ${length}`;
75419
+ issues.push(issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity));
75420
+ }
75421
+ return issues;
75422
+ }
75423
+ decode(text) {
75424
+ return text.replace(/&(#\d+|#x[0-9a-fA-F]+|[a-zA-Z]+);/g, "_");
75425
+ }
75426
+ }
75427
+ exports.AbapdocShorttextLength = AbapdocShorttextLength;
75428
+ //# sourceMappingURL=abapdoc_shorttext_length.js.map
75429
+
75430
+ /***/ },
75431
+
75314
75432
  /***/ "../core/build/src/rules/add_test_attributes.js"
75315
75433
  /*!******************************************************!*\
75316
75434
  !*** ../core/build/src/rules/add_test_attributes.js ***!
@@ -76213,6 +76331,7 @@ const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/ex
76213
76331
  const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
76214
76332
  const Structures = __importStar(__webpack_require__(/*! ../abap/3_structures/structures */ "../core/build/src/abap/3_structures/structures/index.js"));
76215
76333
  const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "../core/build/src/edit_helper.js");
76334
+ const tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ "../core/build/src/abap/1_lexer/tokens/index.js");
76216
76335
  class AlignTypeExpressionsConf extends _basic_rule_config_1.BasicRuleConfig {
76217
76336
  constructor() {
76218
76337
  super(...arguments);
@@ -76380,12 +76499,18 @@ ENDINTERFACE.`,
76380
76499
  let column = 0;
76381
76500
  const st = t.findDirectStatements(Statements.Type);
76382
76501
  for (const s of st) {
76383
- const name = s.getChildren()[1];
76502
+ const children = s.getChildren();
76503
+ const length = s.findDirectExpression(Expressions.ConstantFieldLength);
76504
+ const nameEnd = (length !== null && length !== void 0 ? length : children[1]).getLastToken().getEnd();
76505
+ const after = children[length ? 3 : 2];
76506
+ if (after === undefined || after.getFirstToken() instanceof tokens_1.Punctuation) {
76507
+ continue; // no TYPE clause, eg. "foo(1)," with implicit type
76508
+ }
76384
76509
  fields.push({
76385
- nameEnd: name.getLastToken().getEnd(),
76386
- after: s.getChildren()[2].getFirstToken().getStart()
76510
+ nameEnd: nameEnd,
76511
+ after: after.getFirstToken().getStart()
76387
76512
  });
76388
- column = Math.max(column, name.getFirstToken().getEnd().getCol() + 1);
76513
+ column = Math.max(column, nameEnd.getCol() + 1);
76389
76514
  }
76390
76515
  issues.push(...this.check(fields, column, file));
76391
76516
  }
@@ -76764,8 +76889,28 @@ TEST-SEAMS: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md
76764
76889
 
76765
76890
  BREAK points`,
76766
76891
  tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],
76767
- badExample: `DESCRIBE TABLE items LINES count.`,
76768
- goodExample: `count = lines( items ).`,
76892
+ badExample: `DEFINE _hello.
76893
+ WRITE 'hello'.
76894
+ END-OF-DEFINITION.
76895
+
76896
+ STATICS count TYPE i.
76897
+
76898
+ TYPES ty_items TYPE STANDARD TABLE OF i WITH DEFAULT KEY.
76899
+
76900
+ BREAK-POINT.
76901
+
76902
+ TEST-SEAM seam_name.
76903
+ count = 1.
76904
+ END-TEST-SEAM.
76905
+
76906
+ DESCRIBE TABLE items LINES count.
76907
+
76908
+ EXPORT data = items TO MEMORY ID 'ZFOO'.
76909
+
76910
+ EXPORT data = items TO DATABASE indx(zz) ID 'ZFOO'.`,
76911
+ goodExample: `count = lines( items ).
76912
+
76913
+ TYPES ty_items TYPE STANDARD TABLE OF i WITH EMPTY KEY.`,
76769
76914
  };
76770
76915
  }
76771
76916
  getDescription(statement) {
@@ -84311,6 +84456,17 @@ Make sure to test the downported code, it might not always be completely correct
84311
84456
  }
84312
84457
  }
84313
84458
  }
84459
+ // INSERT with a 702 built-in function as the operand parses in the low version, but 702
84460
+ // reads the function as a method call, "Method SUBSTRING does not exist"
84461
+ if (ret.length === 0) {
84462
+ for (let i = 0; i < lowStatements.length; i++) {
84463
+ const issue = this.outlineInsertBuiltin(lowStatements[i], highStatements[i], lowFile, highSyntax);
84464
+ if (issue) {
84465
+ ret.push(issue);
84466
+ break;
84467
+ }
84468
+ }
84469
+ }
84314
84470
  // INTO after WHERE parses as a valid SELECT in the low version, but is only allowed in
84315
84471
  // strict SQL syntax, so move it also when the statement is no longer Unknown
84316
84472
  if (ret.length === 0) {
@@ -85143,6 +85299,40 @@ ${indentation}`);
85143
85299
  }
85144
85300
  return undefined;
85145
85301
  }
85302
+ /** INSERT substring( ... ) INTO TABLE tab, the operand is outlined into a variable */
85303
+ outlineInsertBuiltin(low, high, lowFile, highSyntax) {
85304
+ var _a;
85305
+ if (!(high.get() instanceof Statements.InsertInternal)) {
85306
+ return undefined;
85307
+ }
85308
+ else if (this.lowReg.getConfig().isOpenABAP()) {
85309
+ return undefined;
85310
+ }
85311
+ else if (low.getFirstToken().getStart() instanceof virtual_position_1.VirtualPosition) {
85312
+ return undefined;
85313
+ }
85314
+ // the whole operand is the call, a longer expression is outlined by replaceInsertExpression
85315
+ const source = high.getChildren()[1];
85316
+ if (!(source instanceof nodes_1.ExpressionNode)
85317
+ || !(source.get() instanceof Expressions.SimpleSource4 || source.get() instanceof Expressions.Source)
85318
+ || source.getChildren().length !== 1
85319
+ || !(((_a = source.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.MethodCallChain)) {
85320
+ return undefined;
85321
+ }
85322
+ const type = this.builtinReturnType(source, lowFile, highSyntax);
85323
+ if (type === undefined) {
85324
+ return undefined;
85325
+ }
85326
+ const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);
85327
+ const indentation = " ".repeat(high.getFirstToken().getStart().getCol() - 1);
85328
+ const code = `DATA ${uniqueName} TYPE ${type}.\n` +
85329
+ indentation + `${uniqueName} = ${source.concatTokens()}.\n` +
85330
+ indentation;
85331
+ const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);
85332
+ const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), uniqueName);
85333
+ const fix = edit_helper_1.EditHelper.merge(fix2, fix1);
85334
+ return issue_1.Issue.atToken(lowFile, source.getFirstToken(), "Outline built-in function in INSERT", this.getMetadata().key, this.conf.severity, fix);
85335
+ }
85146
85336
  /** the ABAP type returned by the built-in function this Source starts with, or undefined
85147
85337
  * if it does not start with one, or with one that predates 702 */
85148
85338
  builtinReturnType(source, lowFile, highSyntax) {
@@ -91718,6 +91908,7 @@ __exportStar(__webpack_require__(/*! ./abapdoc */ "../core/build/src/rules/abapd
91718
91908
  __exportStar(__webpack_require__(/*! ./abapdoc_html_tag */ "../core/build/src/rules/abapdoc_html_tag.js"), exports);
91719
91909
  __exportStar(__webpack_require__(/*! ./abapdoc_leading_at */ "../core/build/src/rules/abapdoc_leading_at.js"), exports);
91720
91910
  __exportStar(__webpack_require__(/*! ./abapdoc_parameter_names */ "../core/build/src/rules/abapdoc_parameter_names.js"), exports);
91911
+ __exportStar(__webpack_require__(/*! ./abapdoc_shorttext_length */ "../core/build/src/rules/abapdoc_shorttext_length.js"), exports);
91721
91912
  __exportStar(__webpack_require__(/*! ./add_test_attributes */ "../core/build/src/rules/add_test_attributes.js"), exports);
91722
91913
  __exportStar(__webpack_require__(/*! ./aff_and_xml */ "../core/build/src/rules/aff_and_xml.js"), exports);
91723
91914
  __exportStar(__webpack_require__(/*! ./alias_never_reassigned */ "../core/build/src/rules/alias_never_reassigned.js"), exports);
@@ -101374,8 +101565,8 @@ class PreferRaiseMessage extends _abap_rule_1.ABAPRule {
101374
101565
  return {
101375
101566
  key: "prefer_raise_message",
101376
101567
  title: "Prefer RAISE EXCEPTION with MESSAGE",
101377
- shortDescription: `Prefer RAISE EXCEPTION with MESSAGE instead of supplying parameter TEXT`,
101378
- extendedInformation: `Reports RAISE EXCEPTION statements where parameter TEXT is supplied.
101568
+ shortDescription: `Prefer RAISE EXCEPTION with MESSAGE instead of supplying parameter TEXT or TEXTID`,
101569
+ extendedInformation: `Reports RAISE EXCEPTION statements where parameter TEXT or TEXTID is supplied.
101379
101570
 
101380
101571
  Use a message class instead, so the text is translatable and can be found via where-used.
101381
101572
 
@@ -101422,9 +101613,9 @@ Exception classes can be excluded via configuration "ignoreExceptionClasses".`,
101422
101613
  if (className === undefined || ignore.includes(className.toUpperCase())) {
101423
101614
  continue;
101424
101615
  }
101425
- const text = parameters === null || parameters === void 0 ? void 0 : parameters.findDirectExpressions(Expressions.ParameterS).find(p => { var _a; return ((_a = p.findDirectExpression(Expressions.ParameterName)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase()) === "TEXT"; });
101426
- if (text) {
101427
- const message = "Prefer RAISE EXCEPTION with MESSAGE, " + className + " raised with parameter TEXT";
101616
+ const name = parameters === null || parameters === void 0 ? void 0 : parameters.findDirectExpressions(Expressions.ParameterS).map(p => { var _a; return (_a = p.findDirectExpression(Expressions.ParameterName)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase(); }).find(n => n === "TEXT" || n === "TEXTID");
101617
+ if (name) {
101618
+ const message = "Prefer RAISE EXCEPTION with MESSAGE, " + className + " raised with parameter " + name;
101428
101619
  issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
101429
101620
  }
101430
101621
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.120.85",
3
+ "version": "2.120.87",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "homepage": "https://abaplint.org",
41
41
  "devDependencies": {
42
- "@abaplint/core": "^2.120.85",
42
+ "@abaplint/core": "^2.120.87",
43
43
  "@types/chai": "^4.3.20",
44
44
  "@types/minimist": "^1.2.5",
45
45
  "@types/mocha": "^10.0.10",