@abaplint/cli 2.102.56 → 2.102.58

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 +125 -5
  2. package/package.json +7 -7
package/build/cli.js CHANGED
@@ -295,6 +295,10 @@ class Formatter {
295
295
  return new Formatters.CodeFrame().output(issues, fileCount);
296
296
  case "checkstyle":
297
297
  return new Formatters.Checkstyle().output(issues, fileCount);
298
+ case "sonarqube":
299
+ return new Formatters.Sonarqube().output(issues, fileCount);
300
+ case "codeclimate":
301
+ return new Formatters.CodeClimate().output(issues, fileCount);
298
302
  default:
299
303
  return new Formatters.Standard().output(issues, fileCount);
300
304
  }
@@ -359,6 +363,51 @@ exports.Checkstyle = Checkstyle;
359
363
 
360
364
  /***/ }),
361
365
 
366
+ /***/ "./build/src/formatters/codeclimate.js":
367
+ /*!*********************************************!*\
368
+ !*** ./build/src/formatters/codeclimate.js ***!
369
+ \*********************************************/
370
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
371
+
372
+ "use strict";
373
+
374
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
375
+ exports.CodeClimate = void 0;
376
+ const node_crypto_1 = __webpack_require__(/*! node:crypto */ "node:crypto");
377
+ function md5(content) {
378
+ return (0, node_crypto_1.createHash)("md5").update(content).digest("hex");
379
+ }
380
+ class CodeClimate {
381
+ output(issues, _fileCount) {
382
+ const out = [];
383
+ const defaultSeverity = "info";
384
+ const severityArray = ["info", "minor", "major", "critical", "blocker"];
385
+ for (const issue of issues) {
386
+ const single = {
387
+ type: "issue",
388
+ check_name: issue.getKey(),
389
+ description: issue.getMessage(),
390
+ categories: ["Code Quality"],
391
+ location: {
392
+ path: issue.getFilename(),
393
+ lines: {
394
+ begin: issue.getStart().getRow(),
395
+ end: issue.getEnd().getRow(),
396
+ },
397
+ },
398
+ severity: (severityArray.includes(issue.getSeverity().toLowerCase())) ? issue.getSeverity().toLowerCase() : defaultSeverity,
399
+ fingerprint: md5(issue.getKey() + issue.getMessage() + issue.getFilename() + issue.getStart().getRow() + issue.getEnd().getRow()),
400
+ };
401
+ out.push(single);
402
+ }
403
+ return JSON.stringify(out) + "\n";
404
+ }
405
+ }
406
+ exports.CodeClimate = CodeClimate;
407
+ //# sourceMappingURL=codeclimate.js.map
408
+
409
+ /***/ }),
410
+
362
411
  /***/ "./build/src/formatters/codeframe.js":
363
412
  /*!*******************************************!*\
364
413
  !*** ./build/src/formatters/codeframe.js ***!
@@ -472,6 +521,8 @@ __exportStar(__webpack_require__(/*! ./standard */ "./build/src/formatters/stand
472
521
  __exportStar(__webpack_require__(/*! ./total */ "./build/src/formatters/total.js"), exports);
473
522
  __exportStar(__webpack_require__(/*! ./codeframe */ "./build/src/formatters/codeframe.js"), exports);
474
523
  __exportStar(__webpack_require__(/*! ./checkstyle */ "./build/src/formatters/checkstyle.js"), exports);
524
+ __exportStar(__webpack_require__(/*! ./sonarqube */ "./build/src/formatters/sonarqube.js"), exports);
525
+ __exportStar(__webpack_require__(/*! ./codeclimate */ "./build/src/formatters/codeclimate.js"), exports);
475
526
  //# sourceMappingURL=index.js.map
476
527
 
477
528
  /***/ }),
@@ -615,6 +666,57 @@ exports.Junit = Junit;
615
666
 
616
667
  /***/ }),
617
668
 
669
+ /***/ "./build/src/formatters/sonarqube.js":
670
+ /*!*******************************************!*\
671
+ !*** ./build/src/formatters/sonarqube.js ***!
672
+ \*******************************************/
673
+ /***/ ((__unused_webpack_module, exports) => {
674
+
675
+ "use strict";
676
+
677
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
678
+ exports.Sonarqube = void 0;
679
+ class Sonarqube {
680
+ output(issues, _fileCount) {
681
+ const out = {};
682
+ const issueArray = [];
683
+ const defaultSeverity = "INFO";
684
+ const severityArray = ["INFO", "MINOR", "MAJOR", "CRITICAL", "BLOCKER"];
685
+ for (const issue of issues) {
686
+ const startOffset = issue.getStart().getCol() - 1;
687
+ const endOffset = issue.getEnd().getCol() - 2;
688
+ const single = {
689
+ engineId: "abaplint",
690
+ ruleId: issue.getKey(),
691
+ severity: (severityArray.includes(issue.getSeverity().toUpperCase())) ? issue.getSeverity().toUpperCase() : defaultSeverity,
692
+ type: "CODE_SMELL",
693
+ primaryLocation: {
694
+ message: issue.getMessage(),
695
+ filePath: issue.getFilename(),
696
+ textRange: {
697
+ startLine: issue.getStart().getRow(),
698
+ endLine: issue.getEnd().getRow(),
699
+ startColumn: startOffset,
700
+ endColumn: endOffset,
701
+ },
702
+ },
703
+ effortMinutes: 10,
704
+ };
705
+ if (startOffset >= endOffset) {
706
+ delete single.primaryLocation.textRange.startColumn;
707
+ delete single.primaryLocation.textRange.endColumn;
708
+ }
709
+ issueArray.push(single);
710
+ }
711
+ out.issues = issueArray;
712
+ return JSON.stringify(out) + "\n";
713
+ }
714
+ }
715
+ exports.Sonarqube = Sonarqube;
716
+ //# sourceMappingURL=sonarqube.js.map
717
+
718
+ /***/ }),
719
+
618
720
  /***/ "./build/src/formatters/standard.js":
619
721
  /*!******************************************!*\
620
722
  !*** ./build/src/formatters/standard.js ***!
@@ -49204,7 +49306,7 @@ class Registry {
49204
49306
  }
49205
49307
  static abaplintVersion() {
49206
49308
  // magic, see build script "version.sh"
49207
- return "2.102.56";
49309
+ return "2.102.58";
49208
49310
  }
49209
49311
  getDDICReferences() {
49210
49312
  return this.ddicReferences;
@@ -65664,6 +65766,10 @@ const syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ "./node_modu
65664
65766
  const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "./node_modules/@abaplint/core/build/src/objects/_abap_object.js");
65665
65767
  const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "./node_modules/@abaplint/core/build/src/abap/types/basic/index.js");
65666
65768
  class SelectAddOrderByConf extends _basic_rule_config_1.BasicRuleConfig {
65769
+ constructor() {
65770
+ super(...arguments);
65771
+ this.skipForAllEntries = false;
65772
+ }
65667
65773
  }
65668
65774
  exports.SelectAddOrderByConf = SelectAddOrderByConf;
65669
65775
  class SelectAddOrderBy {
@@ -65695,7 +65801,7 @@ If the target is a sorted/hashed table, no issue is reported`,
65695
65801
  this.conf = conf;
65696
65802
  }
65697
65803
  run(obj) {
65698
- var _a;
65804
+ var _a, _b;
65699
65805
  const issues = [];
65700
65806
  if (!(obj instanceof _abap_object_1.ABAPObject) || obj.getType() === "INTF") {
65701
65807
  return [];
@@ -65709,13 +65815,16 @@ If the target is a sorted/hashed table, no issue is reported`,
65709
65815
  const selects = stru.findAllStatements(Statements.Select);
65710
65816
  selects.push(...stru.findAllStatements(Statements.SelectLoop));
65711
65817
  for (const s of selects) {
65712
- const c = s.concatTokens().toUpperCase();
65713
- if (c.startsWith("SELECT SINGLE ")) {
65818
+ const concat = s.concatTokens().toUpperCase();
65819
+ if (concat.startsWith("SELECT SINGLE ")) {
65820
+ continue;
65821
+ }
65822
+ else if (((_a = this.getConfig()) === null || _a === void 0 ? void 0 : _a.skipForAllEntries) === true && concat.includes(" FOR ALL ENTRIES ")) {
65714
65823
  continue;
65715
65824
  }
65716
65825
  // skip COUNT(*)
65717
65826
  const list = s.findAllExpressions(Expressions.SQLField);
65718
- if (list.length === 1 && ((_a = list[0].getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.SQLAggregation) {
65827
+ if (list.length === 1 && ((_b = list[0].getFirstChild()) === null || _b === void 0 ? void 0 : _b.get()) instanceof Expressions.SQLAggregation) {
65719
65828
  continue;
65720
65829
  }
65721
65830
  else if (s.findFirstExpression(Expressions.SQLOrderBy)) {
@@ -81815,6 +81924,17 @@ module.exports = require("fs");
81815
81924
 
81816
81925
  /***/ }),
81817
81926
 
81927
+ /***/ "node:crypto":
81928
+ /*!******************************!*\
81929
+ !*** external "node:crypto" ***!
81930
+ \******************************/
81931
+ /***/ ((module) => {
81932
+
81933
+ "use strict";
81934
+ module.exports = require("node:crypto");
81935
+
81936
+ /***/ }),
81937
+
81818
81938
  /***/ "node:os":
81819
81939
  /*!**************************!*\
81820
81940
  !*** external "node:os" ***!
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.102.56",
3
+ "version": "2.102.58",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,24 +38,24 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.102.56",
42
- "@types/chai": "^4.3.6",
41
+ "@abaplint/core": "^2.102.58",
42
+ "@types/chai": "^4.3.8",
43
43
  "@types/glob": "^7.2.0",
44
44
  "@types/minimist": "^1.2.3",
45
45
  "@types/mocha": "^10.0.2",
46
- "@types/node": "^20.8.2",
46
+ "@types/node": "^20.8.6",
47
47
  "@types/progress": "^2.0.5",
48
48
  "chai": "^4.3.10",
49
49
  "chalk": "^5.3.0",
50
- "eslint": "^8.50.0",
50
+ "eslint": "^8.51.0",
51
51
  "glob": "^7.2.3",
52
52
  "json5": "^2.2.3",
53
- "memfs": "^4.5.0",
53
+ "memfs": "^4.6.0",
54
54
  "minimist": "^1.2.8",
55
55
  "mocha": "^10.2.0",
56
56
  "progress": "^2.0.3",
57
57
  "typescript": "^5.2.2",
58
- "webpack": "^5.88.2",
58
+ "webpack": "^5.89.0",
59
59
  "webpack-cli": "^5.1.4",
60
60
  "xml-js": "^1.6.11"
61
61
  },