@abaplint/cli 2.91.2 → 2.91.5
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/build/cli.js +10 -10
- package/build/src/formatters/junit.js +35 -2
- package/package.json +7 -7
package/build/cli.js
CHANGED
|
@@ -115,7 +115,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
115
115
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
116
116
|
|
|
117
117
|
"use strict";
|
|
118
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Junit = void 0;\r\nconst xml_js_1 = __webpack_require__(/*! xml-js */ \"./node_modules/xml-js/lib/index.js\");\r\nclass Junit {\r\n output(issues, _fileCount) {\r\n const outputObj = {\r\n _declaration: {\r\n _attributes: {\r\n version: \"1.0\",\r\n encoding: \"UTF-8\",\r\n },\r\n },\r\n testsuites: {\r\n testsuite: {\r\n _attributes: {\r\n name: \"abaplint\",\r\n tests: issues.length || 1,\r\n failures: issues.length,\r\n errors: 0,\r\n skipped: 0,\r\n },\r\n testcase: [],\r\n },\r\n },\r\n };\r\n if (issues.length > 0) {\r\n for (const issue of issues) {\r\n outputObj.testsuites.testsuite.testcase.push({\r\n _attributes: {\r\n classname: issue.getFilename().split(\".\")[0],\r\n file: issue.getFilename(),\r\n name: `${issue.getFilename()}: [${issue.getStart().getRow()}, ${issue.getStart().getCol()}] - ${issue.getKey()}`,\r\n },\r\n failure: {\r\n _attributes: {\r\n message: issue.
|
|
118
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Junit = void 0;\r\nconst xml_js_1 = __webpack_require__(/*! xml-js */ \"./node_modules/xml-js/lib/index.js\");\r\nconst fs = __webpack_require__(/*! fs */ \"fs\");\r\nclass Junit {\r\n constructor() {\r\n this.currentFilename = \"\";\r\n this.currentFileLinesCount = 0;\r\n this.fileContent = [];\r\n }\r\n output(issues, _fileCount) {\r\n const outputObj = {\r\n _declaration: {\r\n _attributes: {\r\n version: \"1.0\",\r\n encoding: \"UTF-8\",\r\n },\r\n },\r\n testsuites: {\r\n testsuite: {\r\n _attributes: {\r\n name: \"abaplint\",\r\n tests: issues.length || 1,\r\n failures: issues.length,\r\n errors: 0,\r\n skipped: 0,\r\n },\r\n testcase: [],\r\n },\r\n },\r\n };\r\n if (issues.length > 0) {\r\n for (const issue of issues) {\r\n outputObj.testsuites.testsuite.testcase.push({\r\n _attributes: {\r\n classname: issue.getFilename().split(\".\")[0],\r\n file: issue.getFilename(),\r\n name: `${issue.getFilename()}: [${issue.getStart().getRow()}, ${issue.getStart().getCol()}] - ${issue.getKey()}`,\r\n },\r\n failure: {\r\n _attributes: {\r\n message: this.formatFailureMessage(issue.getMessage()),\r\n type: issue.getSeverity().toString(),\r\n },\r\n _cdata: `${this.renderIssue(issue)}`,\r\n },\r\n });\r\n }\r\n }\r\n else {\r\n outputObj.testsuites.testsuite.testcase.push({\r\n _attributes: {\r\n classname: \"none\",\r\n name: \"OK\",\r\n },\r\n });\r\n }\r\n const xml = (0, xml_js_1.js2xml)(outputObj, { compact: true, spaces: 2 });\r\n return xml;\r\n }\r\n cacheFile(filename) {\r\n if (filename !== this.currentFilename) {\r\n this.currentFilename = filename;\r\n this.fileContent = fs.readFileSync(filename, \"utf8\").split(/\\r?\\n/);\r\n this.currentFileLinesCount = this.fileContent.length;\r\n }\r\n }\r\n renderIssue(issue) {\r\n this.cacheFile(issue.getFilename());\r\n const frameSize = 1;\r\n const lineFrom = Math.max(issue.getStart().getRow() - frameSize, 1);\r\n const lineTo = Math.min(issue.getStart().getRow() + frameSize, this.currentFileLinesCount);\r\n const issueLineIndex = issue.getStart().getRow() - 1;\r\n const padSize = Math.ceil(Math.log10(lineTo)) + 4;\r\n const code = [];\r\n for (let lineIndex = lineFrom - 1; lineIndex < lineTo; lineIndex++) {\r\n const prefix = `${\" \"}${lineIndex + 1} |`.padStart(padSize);\r\n code.push(prefix + this.fileContent[lineIndex]);\r\n if (lineIndex === issueLineIndex) {\r\n code.push(\"|\".padStart(padSize) + \" \".repeat(issue.getStart().getCol() - 1) + \"^\");\r\n }\r\n }\r\n return code.map(str => str).join(\"\\n\");\r\n }\r\n formatFailureMessage(message) {\r\n return message.replace(\"<\", \"\").replace(\">\", \"\");\r\n }\r\n}\r\nexports.Junit = Junit;\r\n//# sourceMappingURL=junit.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./build/src/formatters/junit.js?");
|
|
119
119
|
|
|
120
120
|
/***/ }),
|
|
121
121
|
|
|
@@ -1809,7 +1809,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
1809
1809
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1810
1810
|
|
|
1811
1811
|
"use strict";
|
|
1812
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Select = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst _1 = __webpack_require__(/*! . */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst version_1 = __webpack_require__(/*! ../../../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst sql_group_by_1 = __webpack_require__(/*! ./sql_group_by */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_group_by.js\");\r\nconst sql_into_structure_1 = __webpack_require__(/*! ./sql_into_structure */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_into_structure.js\");\r\nconst tokens_1 = __webpack_require__(/*! ../../1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nconst sql_field_name_1 = __webpack_require__(/*! ./sql_field_name */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_field_name.js\");\r\nconst sql_up_to_1 = __webpack_require__(/*! ./sql_up_to */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_up_to.js\");\r\nclass Select extends combi_1.Expression {\r\n getRunnable() {\r\n const into = (0, combi_1.altPrio)(_1.SQLIntoTable, sql_into_structure_1.SQLIntoStructure);\r\n const where = (0, combi_1.seq)(\"WHERE\", _1.SQLCond);\r\n const offset = (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)(\"OFFSET\", _1.SQLSource));\r\n const
|
|
1812
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Select = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst _1 = __webpack_require__(/*! . */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst version_1 = __webpack_require__(/*! ../../../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst sql_group_by_1 = __webpack_require__(/*! ./sql_group_by */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_group_by.js\");\r\nconst sql_into_structure_1 = __webpack_require__(/*! ./sql_into_structure */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_into_structure.js\");\r\nconst tokens_1 = __webpack_require__(/*! ../../1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nconst sql_field_name_1 = __webpack_require__(/*! ./sql_field_name */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_field_name.js\");\r\nconst sql_up_to_1 = __webpack_require__(/*! ./sql_up_to */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_up_to.js\");\r\nclass Select extends combi_1.Expression {\r\n getRunnable() {\r\n const into = (0, combi_1.altPrio)(_1.SQLIntoTable, sql_into_structure_1.SQLIntoStructure);\r\n const where = (0, combi_1.seq)(\"WHERE\", _1.SQLCond);\r\n const offset = (0, combi_1.ver)(version_1.Version.v751, (0, combi_1.seq)(\"OFFSET\", _1.SQLSource));\r\n const bypass = (0, combi_1.str)(\"BYPASSING BUFFER\");\r\n const fields = (0, combi_1.seq)(\"FIELDS\", _1.SQLFieldList);\r\n const perm = (0, combi_1.per)(_1.SQLFrom, into, _1.SQLForAllEntries, where, _1.SQLOrderBy, sql_up_to_1.SQLUpTo, offset, _1.SQLClient, _1.SQLHaving, bypass, sql_group_by_1.SQLGroupBy, fields, _1.DatabaseConnection);\r\n const paren = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), sql_field_name_1.SQLFieldName, (0, combi_1.tok)(tokens_1.WParenRightW));\r\n const ret = (0, combi_1.seq)(\"SELECT\", (0, combi_1.altPrio)(\"DISTINCT\", (0, combi_1.optPrio)((0, combi_1.seq)(\"SINGLE\", (0, combi_1.optPrio)(\"FOR UPDATE\")))), (0, combi_1.optPrio)((0, combi_1.altPrio)(_1.SQLFieldList, paren)), perm, (0, combi_1.optPrio)(_1.SQLHints));\r\n return ret;\r\n }\r\n}\r\nexports.Select = Select;\r\n//# sourceMappingURL=select.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/select.js?");
|
|
1813
1813
|
|
|
1814
1814
|
/***/ }),
|
|
1815
1815
|
|
|
@@ -1820,7 +1820,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
1820
1820
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1821
1821
|
|
|
1822
1822
|
"use strict";
|
|
1823
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SelectLoop = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst _1 = __webpack_require__(/*! . */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst sql_order_by_1 = __webpack_require__(/*! ./sql_order_by */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_order_by.js\");\r\nconst sql_having_1 = __webpack_require__(/*! ./sql_having */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_having.js\");\r\nconst sql_into_structure_1 = __webpack_require__(/*! ./sql_into_structure */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_into_structure.js\");\r\nconst sql_field_list_1 = __webpack_require__(/*! ./sql_field_list */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_field_list.js\");\r\nconst sql_hints_1 = __webpack_require__(/*! ./sql_hints */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_hints.js\");\r\nconst sql_field_list_loop_1 = __webpack_require__(/*! ./sql_field_list_loop */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_field_list_loop.js\");\r\nconst sql_up_to_1 = __webpack_require__(/*! ./sql_up_to */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_up_to.js\");\r\nclass SelectLoop extends combi_1.Expression {\r\n getRunnable() {\r\n const where = (0, combi_1.seq)(\"WHERE\", _1.SQLCond);\r\n const
|
|
1823
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SelectLoop = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst _1 = __webpack_require__(/*! . */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst sql_order_by_1 = __webpack_require__(/*! ./sql_order_by */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_order_by.js\");\r\nconst sql_having_1 = __webpack_require__(/*! ./sql_having */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_having.js\");\r\nconst sql_into_structure_1 = __webpack_require__(/*! ./sql_into_structure */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_into_structure.js\");\r\nconst sql_field_list_1 = __webpack_require__(/*! ./sql_field_list */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_field_list.js\");\r\nconst sql_hints_1 = __webpack_require__(/*! ./sql_hints */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_hints.js\");\r\nconst sql_field_list_loop_1 = __webpack_require__(/*! ./sql_field_list_loop */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_field_list_loop.js\");\r\nconst sql_up_to_1 = __webpack_require__(/*! ./sql_up_to */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_up_to.js\");\r\nclass SelectLoop extends combi_1.Expression {\r\n getRunnable() {\r\n const where = (0, combi_1.seq)(\"WHERE\", _1.SQLCond);\r\n const bypass = \"BYPASSING BUFFER\";\r\n const pack = (0, combi_1.seq)(\"PACKAGE SIZE\", _1.SQLSource);\r\n const tab = (0, combi_1.seq)(_1.SQLIntoTable, (0, combi_1.alt)(pack, (0, combi_1.seq)(_1.SQLFrom, pack), (0, combi_1.seq)(pack, _1.SQLFrom)));\r\n const perm = (0, combi_1.per)(_1.SQLFrom, where, sql_up_to_1.SQLUpTo, sql_order_by_1.SQLOrderBy, sql_having_1.SQLHaving, _1.SQLClient, bypass, _1.SQLGroupBy, _1.SQLForAllEntries, (0, combi_1.alt)(tab, sql_into_structure_1.SQLIntoStructure));\r\n const strict = (0, combi_1.seq)(_1.SQLFrom, \"FIELDS\", sql_field_list_1.SQLFieldList, where, sql_into_structure_1.SQLIntoStructure, sql_up_to_1.SQLUpTo);\r\n const ret = (0, combi_1.seq)(\"SELECT\", (0, combi_1.altPrio)((0, combi_1.seq)((0, combi_1.optPrio)(\"DISTINCT\"), sql_field_list_loop_1.SQLFieldListLoop, perm), strict), (0, combi_1.optPrio)(sql_hints_1.SQLHints));\r\n return ret;\r\n }\r\n}\r\nexports.SelectLoop = SelectLoop;\r\n//# sourceMappingURL=select_loop.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/select_loop.js?");
|
|
1824
1824
|
|
|
1825
1825
|
/***/ }),
|
|
1826
1826
|
|
|
@@ -1996,7 +1996,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
1996
1996
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1997
1997
|
|
|
1998
1998
|
"use strict";
|
|
1999
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SQLClient = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst sql_source_simple_1 = __webpack_require__(/*! ./sql_source_simple */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_source_simple.js\");\r\nclass SQLClient extends combi_1.Expression {\r\n getRunnable() {\r\n // todo, client specified and connection not possible in Cloud\r\n const client = (0, combi_1.alt)(\"CLIENT SPECIFIED\", (0, combi_1.seq)(\"USING CLIENT\", sql_source_simple_1.SQLSourceSimple));\r\n return client;\r\n }\r\n}\r\nexports.SQLClient = SQLClient;\r\n//# sourceMappingURL=sql_client.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_client.js?");
|
|
1999
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SQLClient = void 0;\r\nconst version_1 = __webpack_require__(/*! ../../../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst sql_source_simple_1 = __webpack_require__(/*! ./sql_source_simple */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_source_simple.js\");\r\nclass SQLClient extends combi_1.Expression {\r\n getRunnable() {\r\n // todo, client specified and connection not possible in Cloud\r\n const client = (0, combi_1.alt)(\"CLIENT SPECIFIED\", (0, combi_1.seq)(\"USING\", (0, combi_1.alt)((0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)(\"CLIENT\", sql_source_simple_1.SQLSourceSimple)), (0, combi_1.ver)(version_1.Version.v754, (0, combi_1.seq)(\"CLIENTS IN\", (0, combi_1.alt)(sql_source_simple_1.SQLSourceSimple, \"T000\"))), (0, combi_1.ver)(version_1.Version.v754, \"ALL CLIENTS\"))));\r\n return client;\r\n }\r\n}\r\nexports.SQLClient = SQLClient;\r\n//# sourceMappingURL=sql_client.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/sql_client.js?");
|
|
2000
2000
|
|
|
2001
2001
|
/***/ }),
|
|
2002
2002
|
|
|
@@ -4273,7 +4273,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
4273
4273
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
4274
4274
|
|
|
4275
4275
|
"use strict";
|
|
4276
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.InsertDatabase = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst tokens_1 = __webpack_require__(/*! ../../1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nclass InsertDatabase {\r\n getMatcher() {\r\n const
|
|
4276
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.InsertDatabase = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst tokens_1 = __webpack_require__(/*! ../../1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nclass InsertDatabase {\r\n getMatcher() {\r\n const sub = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), expressions_1.Select, (0, combi_1.tok)(tokens_1.WParenRightW));\r\n const f = (0, combi_1.seq)((0, combi_1.opt)(expressions_1.SQLClient), (0, combi_1.opt)(expressions_1.DatabaseConnection), \"FROM\", (0, combi_1.opt)(\"TABLE\"), (0, combi_1.alt)(expressions_1.SQLSource, sub), (0, combi_1.opt)(\"ACCEPTING DUPLICATE KEYS\"));\r\n const from = (0, combi_1.seq)(expressions_1.DatabaseTable, (0, combi_1.opt)((0, combi_1.alt)(f, expressions_1.SQLClient, expressions_1.DatabaseConnection)));\r\n const into = (0, combi_1.seq)(\"INTO\", expressions_1.DatabaseTable, (0, combi_1.opt)(expressions_1.SQLClient), (0, combi_1.opt)(expressions_1.DatabaseConnection), \"VALUES\", expressions_1.SQLSource);\r\n return (0, combi_1.seq)(\"INSERT\", (0, combi_1.alt)(from, into));\r\n }\r\n}\r\nexports.InsertDatabase = InsertDatabase;\r\n//# sourceMappingURL=insert_database.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/2_statements/statements/insert_database.js?");
|
|
4277
4277
|
|
|
4278
4278
|
/***/ }),
|
|
4279
4279
|
|
|
@@ -4482,7 +4482,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
4482
4482
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
4483
4483
|
|
|
4484
4484
|
"use strict";
|
|
4485
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ModifyDatabase = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nclass ModifyDatabase {\r\n getMatcher() {\r\n const from = (0, combi_1.seq)(\"FROM\", (0, combi_1.opt)(\"TABLE\"), expressions_1.SQLSource);\r\n const
|
|
4485
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ModifyDatabase = void 0;\r\nconst combi_1 = __webpack_require__(/*! ../combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nclass ModifyDatabase {\r\n getMatcher() {\r\n const from = (0, combi_1.seq)(\"FROM\", (0, combi_1.opt)(\"TABLE\"), expressions_1.SQLSource);\r\n const options = (0, combi_1.per)(expressions_1.DatabaseConnection, from, expressions_1.SQLClient);\r\n return (0, combi_1.seq)(\"MODIFY\", expressions_1.DatabaseTable, options);\r\n }\r\n}\r\nexports.ModifyDatabase = ModifyDatabase;\r\n//# sourceMappingURL=modify_database.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/2_statements/statements/modify_database.js?");
|
|
4486
4486
|
|
|
4487
4487
|
/***/ }),
|
|
4488
4488
|
|
|
@@ -11302,7 +11302,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11302
11302
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11303
11303
|
|
|
11304
11304
|
"use strict";
|
|
11305
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Registry = void 0;\nconst config_1 = __webpack_require__(/*! ./config */ \"./node_modules/@abaplint/core/build/src/config.js\");\nconst artifacts_objects_1 = __webpack_require__(/*! ./artifacts_objects */ \"./node_modules/@abaplint/core/build/src/artifacts_objects.js\");\nconst artifacts_rules_1 = __webpack_require__(/*! ./artifacts_rules */ \"./node_modules/@abaplint/core/build/src/artifacts_rules.js\");\nconst skip_logic_1 = __webpack_require__(/*! ./skip_logic */ \"./node_modules/@abaplint/core/build/src/skip_logic.js\");\nconst _abap_object_1 = __webpack_require__(/*! ./objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\nconst find_global_definitions_1 = __webpack_require__(/*! ./abap/5_syntax/global_definitions/find_global_definitions */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/global_definitions/find_global_definitions.js\");\nconst syntax_1 = __webpack_require__(/*! ./abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\nconst excludeHelper_1 = __webpack_require__(/*! ./utils/excludeHelper */ \"./node_modules/@abaplint/core/build/src/utils/excludeHelper.js\");\nconst ddic_references_1 = __webpack_require__(/*! ./ddic_references */ \"./node_modules/@abaplint/core/build/src/ddic_references.js\");\n// todo, this should really be an instance in case there are multiple Registry'ies\nclass ParsingPerformance {\n static clear() {\n this.results = [];\n this.lexing = 0;\n this.statements = 0;\n this.structure = 0;\n }\n static push(obj, result) {\n if (result.runtimeExtra) {\n this.lexing += result.runtimeExtra.lexing;\n this.statements += result.runtimeExtra.statements;\n this.structure += result.runtimeExtra.structure;\n }\n if (result.runtime < 100) {\n return;\n }\n if (this.results === undefined) {\n this.results = [];\n }\n let extra = \"\";\n if (result.runtimeExtra) {\n extra = `\\t(lexing: ${result.runtimeExtra.lexing}ms, statements: ${result.runtimeExtra.statements}ms, structure: ${result.runtimeExtra.structure}ms)`;\n }\n this.results.push({\n runtime: result.runtime,\n extra,\n name: obj.getType() + \" \" + obj.getName(),\n });\n }\n static output() {\n const MAX = 10;\n this.results.sort((a, b) => { return b.runtime - a.runtime; });\n for (let i = 0; i < MAX; i++) {\n const row = this.results[i];\n if (row === undefined) {\n break;\n }\n process.stderr.write(`\\t${row.runtime}ms\\t${row.name} ${row.extra}\\n`);\n }\n process.stderr.write(`\\tTotal lexing: ${this.lexing}ms\\n`);\n process.stderr.write(`\\tTotal statements: ${this.statements}ms\\n`);\n process.stderr.write(`\\tTotal structure: ${this.structure}ms\\n`);\n }\n}\n///////////////////////////////////////////////////////////////////////////////////////////////\nclass Registry {\n constructor(conf) {\n this.objects = {};\n this.objectsByType = {};\n /** object containing filenames of dependencies */\n this.dependencies = {};\n this.issues = [];\n this.conf = conf ? conf : config_1.Config.getDefault();\n this.references = new ddic_references_1.DDICReferences();\n }\n static abaplintVersion() {\n // magic, see build script \"version.sh\"\n return \"2.91.2\";\n }\n getDDICReferences() {\n return this.references;\n }\n *getObjects() {\n for (const name in this.objects) {\n for (const type in this.objects[name]) {\n yield this.objects[name][type];\n }\n }\n }\n *getObjectsByType(type) {\n for (const name in this.objectsByType[type] || []) {\n yield this.objectsByType[type][name];\n }\n }\n *getFiles() {\n for (const obj of this.getObjects()) {\n for (const file of obj.getFiles()) {\n yield file;\n }\n }\n }\n getFirstObject() {\n for (const name in this.objects) {\n for (const type in this.objects[name]) {\n return this.objects[name][type];\n }\n }\n return undefined;\n }\n getObjectCount(skipDependencies = true) {\n let res = 0;\n for (const o of this.getObjects()) {\n if (skipDependencies === true && this.isDependency(o)) {\n continue;\n }\n res = res + 1;\n }\n return res;\n }\n getFileByName(filename) {\n const upper = filename.toUpperCase();\n for (const o of this.getObjects()) {\n for (const f of o.getFiles()) {\n if (f.getFilename().toUpperCase() === upper) {\n return f;\n }\n }\n }\n return undefined;\n }\n getObject(type, name) {\n if (type === undefined || name === undefined) {\n return undefined;\n }\n const searchName = name.toUpperCase();\n if (this.objects[searchName]) {\n return this.objects[searchName][type];\n }\n return undefined;\n }\n getConfig() {\n return this.conf;\n }\n // assumption: Config is immutable, and can only be changed via this method\n setConfig(conf) {\n for (const obj of this.getObjects()) {\n obj.setDirty();\n }\n this.conf = conf;\n return this;\n }\n inErrorNamespace(name) {\n const reg = new RegExp(this.getConfig().getSyntaxSetttings().errorNamespace, \"i\");\n return reg.test(name);\n }\n addFile(file) {\n return this.addFiles([file]);\n }\n updateFile(file) {\n const obj = this.find(file.getObjectName(), file.getObjectType());\n obj.updateFile(file);\n return this;\n }\n removeFile(file) {\n const obj = this.find(file.getObjectName(), file.getObjectType());\n obj.removeFile(file);\n if (obj.getFiles().length === 0) {\n this.references.clear(obj);\n this.removeObject(obj);\n }\n return this;\n }\n addFiles(files) {\n var _a;\n const globalExclude = ((_a = this.conf.getGlobal().exclude) !== null && _a !== void 0 ? _a : [])\n .map(pattern => new RegExp(pattern, \"i\"));\n for (const f of files) {\n const filename = f.getFilename();\n const isNotAbapgitFile = filename.split(\".\").length <= 2;\n if (isNotAbapgitFile || excludeHelper_1.ExcludeHelper.isExcluded(filename, globalExclude)) {\n continue;\n }\n const found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n found.addFile(f);\n }\n return this;\n }\n addDependencies(files) {\n for (const f of files) {\n this.dependencies[f.getFilename().toUpperCase()] = true;\n }\n return this.addFiles(files);\n }\n addDependency(file) {\n this.dependencies[file.getFilename().toUpperCase()] = true;\n this.addFile(file);\n return this;\n }\n isDependency(obj) {\n const filename = obj.getFiles()[0].getFilename().toUpperCase();\n return this.dependencies[filename] === true;\n }\n isFileDependency(filename) {\n return this.dependencies[filename.toUpperCase()] === true;\n }\n // assumption: the file is already in the registry\n findObjectForFile(file) {\n const filename = file.getFilename();\n for (const obj of this.getObjects()) {\n for (const ofile of obj.getFiles()) {\n if (ofile.getFilename() === filename) {\n return obj;\n }\n }\n }\n return undefined;\n }\n // todo, this will be changed to async sometime\n findIssues(input) {\n if (this.isDirty() === true) {\n this.parse();\n }\n return this.runRules(input);\n }\n // todo, this will be changed to async sometime\n findIssuesObject(iobj) {\n if (this.isDirty() === true) {\n this.parse();\n }\n return this.runRules(undefined, iobj);\n }\n // todo, this will be changed to async sometime\n parse() {\n if (this.isDirty() === false) {\n return this;\n }\n ParsingPerformance.clear();\n this.issues = [];\n for (const o of this.getObjects()) {\n this.parsePrivate(o);\n this.issues.push(...o.getParsingIssues());\n }\n new find_global_definitions_1.FindGlobalDefinitions(this).run();\n return this;\n }\n async parseAsync(input) {\n var _a, _b;\n if (this.isDirty() === false) {\n return this;\n }\n ParsingPerformance.clear();\n (_a = input === null || input === void 0 ? void 0 : input.progress) === null || _a === void 0 ? void 0 : _a.set(this.getObjectCount(false), \"Lexing and parsing\");\n this.issues = [];\n for (const o of this.getObjects()) {\n await ((_b = input === null || input === void 0 ? void 0 : input.progress) === null || _b === void 0 ? void 0 : _b.tick(\"Lexing and parsing(\" + this.conf.getVersion() + \") - \" + o.getType() + \" \" + o.getName()));\n this.parsePrivate(o);\n this.issues.push(...o.getParsingIssues());\n }\n if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {\n ParsingPerformance.output();\n }\n new find_global_definitions_1.FindGlobalDefinitions(this).run(input === null || input === void 0 ? void 0 : input.progress);\n return this;\n }\n //////////////////////////////////////////\n // todo, refactor, this is a mess, see where-used, a lot of the code should be in this method instead\n parsePrivate(input) {\n const config = this.getConfig();\n const result = input.parse(config.getVersion(), config.getSyntaxSetttings().globalMacros, this);\n ParsingPerformance.push(input, result);\n }\n isDirty() {\n for (const o of this.getObjects()) {\n const dirty = o.isDirty();\n if (dirty === true) {\n return true;\n }\n }\n return false;\n }\n runRules(input, iobj) {\n var _a, _b, _c, _d, _e, _f;\n const rulePerformance = {};\n const issues = this.issues.slice(0);\n const objects = iobj ? [iobj] : this.getObjects();\n const rules = this.conf.getEnabledRules();\n const skipLogic = new skip_logic_1.SkipLogic(this);\n (_a = input === null || input === void 0 ? void 0 : input.progress) === null || _a === void 0 ? void 0 : _a.set(iobj ? 1 : this.getObjectCount(false), \"Run Syntax\");\n const check = [];\n for (const obj of objects) {\n (_b = input === null || input === void 0 ? void 0 : input.progress) === null || _b === void 0 ? void 0 : _b.tick(\"Run Syntax - \" + obj.getName());\n if (skipLogic.skip(obj) || this.isDependency(obj)) {\n continue;\n }\n if (obj instanceof _abap_object_1.ABAPObject) {\n new syntax_1.SyntaxLogic(this, obj).run();\n }\n check.push(obj);\n }\n (_c = input === null || input === void 0 ? void 0 : input.progress) === null || _c === void 0 ? void 0 : _c.set(rules.length, \"Initialize Rules\");\n for (const rule of rules) {\n (_d = input === null || input === void 0 ? void 0 : input.progress) === null || _d === void 0 ? void 0 : _d.tick(\"Initialize Rules - \" + rule.getMetadata().key);\n if (rule.initialize === undefined) {\n throw new Error(rule.getMetadata().key + \" missing initialize method\");\n }\n rule.initialize(this);\n rulePerformance[rule.getMetadata().key] = 0;\n }\n (_e = input === null || input === void 0 ? void 0 : input.progress) === null || _e === void 0 ? void 0 : _e.set(check.length, \"Finding Issues\");\n for (const obj of check) {\n (_f = input === null || input === void 0 ? void 0 : input.progress) === null || _f === void 0 ? void 0 : _f.tick(\"Finding Issues - \" + obj.getType() + \" \" + obj.getName());\n for (const rule of rules) {\n const before = Date.now();\n issues.push(...rule.run(obj));\n const runtime = Date.now() - before;\n rulePerformance[rule.getMetadata().key] = rulePerformance[rule.getMetadata().key] + runtime;\n }\n }\n if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {\n const perf = [];\n for (const p in rulePerformance) {\n if (rulePerformance[p] > 100) { // ignore rules if it takes less than 100ms\n perf.push({ name: p, time: rulePerformance[p] });\n }\n }\n perf.sort((a, b) => { return b.time - a.time; });\n for (const p of perf) {\n process.stderr.write(\"\\t\" + p.time + \"ms\\t\" + p.name + \"\\n\");\n }\n }\n return this.excludeIssues(issues);\n }\n excludeIssues(issues) {\n var _a;\n const ret = issues;\n const globalNoIssues = this.conf.getGlobal().noIssues || [];\n const globalNoIssuesPatterns = globalNoIssues.map(x => new RegExp(x, \"i\"));\n if (globalNoIssuesPatterns.length > 0) {\n for (let i = ret.length - 1; i >= 0; i--) {\n const filename = ret[i].getFilename();\n if (excludeHelper_1.ExcludeHelper.isExcluded(filename, globalNoIssuesPatterns)) {\n ret.splice(i, 1);\n }\n }\n }\n // exclude issues, as now we know both the filename and issue key\n for (const rule of artifacts_rules_1.ArtifactsRules.getRules()) {\n const key = rule.getMetadata().key;\n const ruleExclude = (_a = this.conf.readByKey(key, \"exclude\")) !== null && _a !== void 0 ? _a : [];\n if (ruleExclude.length === 0) {\n continue;\n }\n const ruleExcludePatterns = ruleExclude.map(x => new RegExp(x, \"i\"));\n for (let i = ret.length - 1; i >= 0; i--) {\n if (ret[i].getKey() !== key) {\n continue;\n }\n const filename = ret[i].getFilename();\n if (excludeHelper_1.ExcludeHelper.isExcluded(filename, ruleExcludePatterns)) {\n ret.splice(i, 1);\n }\n }\n }\n return ret;\n }\n findOrCreate(name, type) {\n try {\n return this.find(name, type);\n }\n catch (_a) {\n const newName = name.toUpperCase();\n const newType = type ? type : \"UNKNOWN\";\n const add = artifacts_objects_1.ArtifactsObjects.newObject(newName, newType);\n if (this.objects[newName] === undefined) {\n this.objects[newName] = {};\n }\n this.objects[newName][newType] = add;\n if (this.objectsByType[newType] === undefined) {\n this.objectsByType[newType] = {};\n }\n this.objectsByType[newType][newName] = add;\n return add;\n }\n }\n removeObject(remove) {\n if (remove === undefined) {\n return;\n }\n if (this.objects[remove.getName()][remove.getType()] === undefined) {\n throw new Error(\"removeObject: object not found\");\n }\n if (Object.keys(this.objects[remove.getName()]).length === 1) {\n delete this.objects[remove.getName()];\n }\n else {\n delete this.objects[remove.getName()][remove.getType()];\n }\n if (Object.keys(this.objectsByType[remove.getType()]).length === 1) {\n delete this.objectsByType[remove.getType()];\n }\n else {\n delete this.objectsByType[remove.getType()][remove.getName()];\n }\n }\n find(name, type) {\n const searchType = type ? type : \"UNKNOWN\";\n const searchName = name.toUpperCase();\n if (this.objects[searchName] !== undefined\n && this.objects[searchName][searchType]) {\n return this.objects[searchName][searchType];\n }\n throw new Error(\"find: object not found, \" + type + \" \" + name);\n }\n}\nexports.Registry = Registry;\n//# sourceMappingURL=registry.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/registry.js?");
|
|
11305
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Registry = void 0;\nconst config_1 = __webpack_require__(/*! ./config */ \"./node_modules/@abaplint/core/build/src/config.js\");\nconst artifacts_objects_1 = __webpack_require__(/*! ./artifacts_objects */ \"./node_modules/@abaplint/core/build/src/artifacts_objects.js\");\nconst artifacts_rules_1 = __webpack_require__(/*! ./artifacts_rules */ \"./node_modules/@abaplint/core/build/src/artifacts_rules.js\");\nconst skip_logic_1 = __webpack_require__(/*! ./skip_logic */ \"./node_modules/@abaplint/core/build/src/skip_logic.js\");\nconst _abap_object_1 = __webpack_require__(/*! ./objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\nconst find_global_definitions_1 = __webpack_require__(/*! ./abap/5_syntax/global_definitions/find_global_definitions */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/global_definitions/find_global_definitions.js\");\nconst syntax_1 = __webpack_require__(/*! ./abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\nconst excludeHelper_1 = __webpack_require__(/*! ./utils/excludeHelper */ \"./node_modules/@abaplint/core/build/src/utils/excludeHelper.js\");\nconst ddic_references_1 = __webpack_require__(/*! ./ddic_references */ \"./node_modules/@abaplint/core/build/src/ddic_references.js\");\n// todo, this should really be an instance in case there are multiple Registry'ies\nclass ParsingPerformance {\n static clear() {\n this.results = [];\n this.lexing = 0;\n this.statements = 0;\n this.structure = 0;\n }\n static push(obj, result) {\n if (result.runtimeExtra) {\n this.lexing += result.runtimeExtra.lexing;\n this.statements += result.runtimeExtra.statements;\n this.structure += result.runtimeExtra.structure;\n }\n if (result.runtime < 100) {\n return;\n }\n if (this.results === undefined) {\n this.results = [];\n }\n let extra = \"\";\n if (result.runtimeExtra) {\n extra = `\\t(lexing: ${result.runtimeExtra.lexing}ms, statements: ${result.runtimeExtra.statements}ms, structure: ${result.runtimeExtra.structure}ms)`;\n }\n this.results.push({\n runtime: result.runtime,\n extra,\n name: obj.getType() + \" \" + obj.getName(),\n });\n }\n static output() {\n const MAX = 10;\n this.results.sort((a, b) => { return b.runtime - a.runtime; });\n for (let i = 0; i < MAX; i++) {\n const row = this.results[i];\n if (row === undefined) {\n break;\n }\n process.stderr.write(`\\t${row.runtime}ms\\t${row.name} ${row.extra}\\n`);\n }\n process.stderr.write(`\\tTotal lexing: ${this.lexing}ms\\n`);\n process.stderr.write(`\\tTotal statements: ${this.statements}ms\\n`);\n process.stderr.write(`\\tTotal structure: ${this.structure}ms\\n`);\n }\n}\n///////////////////////////////////////////////////////////////////////////////////////////////\nclass Registry {\n constructor(conf) {\n this.objects = {};\n this.objectsByType = {};\n /** object containing filenames of dependencies */\n this.dependencies = {};\n this.issues = [];\n this.conf = conf ? conf : config_1.Config.getDefault();\n this.references = new ddic_references_1.DDICReferences();\n }\n static abaplintVersion() {\n // magic, see build script \"version.sh\"\n return \"2.91.5\";\n }\n getDDICReferences() {\n return this.references;\n }\n *getObjects() {\n for (const name in this.objects) {\n for (const type in this.objects[name]) {\n yield this.objects[name][type];\n }\n }\n }\n *getObjectsByType(type) {\n for (const name in this.objectsByType[type] || []) {\n yield this.objectsByType[type][name];\n }\n }\n *getFiles() {\n for (const obj of this.getObjects()) {\n for (const file of obj.getFiles()) {\n yield file;\n }\n }\n }\n getFirstObject() {\n for (const name in this.objects) {\n for (const type in this.objects[name]) {\n return this.objects[name][type];\n }\n }\n return undefined;\n }\n getObjectCount(skipDependencies = true) {\n let res = 0;\n for (const o of this.getObjects()) {\n if (skipDependencies === true && this.isDependency(o)) {\n continue;\n }\n res = res + 1;\n }\n return res;\n }\n getFileByName(filename) {\n const upper = filename.toUpperCase();\n for (const o of this.getObjects()) {\n for (const f of o.getFiles()) {\n if (f.getFilename().toUpperCase() === upper) {\n return f;\n }\n }\n }\n return undefined;\n }\n getObject(type, name) {\n if (type === undefined || name === undefined) {\n return undefined;\n }\n const searchName = name.toUpperCase();\n if (this.objects[searchName]) {\n return this.objects[searchName][type];\n }\n return undefined;\n }\n getConfig() {\n return this.conf;\n }\n // assumption: Config is immutable, and can only be changed via this method\n setConfig(conf) {\n for (const obj of this.getObjects()) {\n obj.setDirty();\n }\n this.conf = conf;\n return this;\n }\n inErrorNamespace(name) {\n const reg = new RegExp(this.getConfig().getSyntaxSetttings().errorNamespace, \"i\");\n return reg.test(name);\n }\n addFile(file) {\n return this.addFiles([file]);\n }\n updateFile(file) {\n const obj = this.find(file.getObjectName(), file.getObjectType());\n obj.updateFile(file);\n return this;\n }\n removeFile(file) {\n const obj = this.find(file.getObjectName(), file.getObjectType());\n obj.removeFile(file);\n if (obj.getFiles().length === 0) {\n this.references.clear(obj);\n this.removeObject(obj);\n }\n return this;\n }\n addFiles(files) {\n var _a;\n const globalExclude = ((_a = this.conf.getGlobal().exclude) !== null && _a !== void 0 ? _a : [])\n .map(pattern => new RegExp(pattern, \"i\"));\n for (const f of files) {\n const filename = f.getFilename();\n const isNotAbapgitFile = filename.split(\".\").length <= 2;\n if (isNotAbapgitFile || excludeHelper_1.ExcludeHelper.isExcluded(filename, globalExclude)) {\n continue;\n }\n const found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n found.addFile(f);\n }\n return this;\n }\n addDependencies(files) {\n for (const f of files) {\n this.dependencies[f.getFilename().toUpperCase()] = true;\n }\n return this.addFiles(files);\n }\n addDependency(file) {\n this.dependencies[file.getFilename().toUpperCase()] = true;\n this.addFile(file);\n return this;\n }\n isDependency(obj) {\n const filename = obj.getFiles()[0].getFilename().toUpperCase();\n return this.dependencies[filename] === true;\n }\n isFileDependency(filename) {\n return this.dependencies[filename.toUpperCase()] === true;\n }\n // assumption: the file is already in the registry\n findObjectForFile(file) {\n const filename = file.getFilename();\n for (const obj of this.getObjects()) {\n for (const ofile of obj.getFiles()) {\n if (ofile.getFilename() === filename) {\n return obj;\n }\n }\n }\n return undefined;\n }\n // todo, this will be changed to async sometime\n findIssues(input) {\n if (this.isDirty() === true) {\n this.parse();\n }\n return this.runRules(input);\n }\n // todo, this will be changed to async sometime\n findIssuesObject(iobj) {\n if (this.isDirty() === true) {\n this.parse();\n }\n return this.runRules(undefined, iobj);\n }\n // todo, this will be changed to async sometime\n parse() {\n if (this.isDirty() === false) {\n return this;\n }\n ParsingPerformance.clear();\n this.issues = [];\n for (const o of this.getObjects()) {\n this.parsePrivate(o);\n this.issues.push(...o.getParsingIssues());\n }\n new find_global_definitions_1.FindGlobalDefinitions(this).run();\n return this;\n }\n async parseAsync(input) {\n var _a, _b;\n if (this.isDirty() === false) {\n return this;\n }\n ParsingPerformance.clear();\n (_a = input === null || input === void 0 ? void 0 : input.progress) === null || _a === void 0 ? void 0 : _a.set(this.getObjectCount(false), \"Lexing and parsing\");\n this.issues = [];\n for (const o of this.getObjects()) {\n await ((_b = input === null || input === void 0 ? void 0 : input.progress) === null || _b === void 0 ? void 0 : _b.tick(\"Lexing and parsing(\" + this.conf.getVersion() + \") - \" + o.getType() + \" \" + o.getName()));\n this.parsePrivate(o);\n this.issues.push(...o.getParsingIssues());\n }\n if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {\n ParsingPerformance.output();\n }\n new find_global_definitions_1.FindGlobalDefinitions(this).run(input === null || input === void 0 ? void 0 : input.progress);\n return this;\n }\n //////////////////////////////////////////\n // todo, refactor, this is a mess, see where-used, a lot of the code should be in this method instead\n parsePrivate(input) {\n const config = this.getConfig();\n const result = input.parse(config.getVersion(), config.getSyntaxSetttings().globalMacros, this);\n ParsingPerformance.push(input, result);\n }\n isDirty() {\n for (const o of this.getObjects()) {\n const dirty = o.isDirty();\n if (dirty === true) {\n return true;\n }\n }\n return false;\n }\n runRules(input, iobj) {\n var _a, _b, _c, _d, _e, _f;\n const rulePerformance = {};\n const issues = this.issues.slice(0);\n const objects = iobj ? [iobj] : this.getObjects();\n const rules = this.conf.getEnabledRules();\n const skipLogic = new skip_logic_1.SkipLogic(this);\n (_a = input === null || input === void 0 ? void 0 : input.progress) === null || _a === void 0 ? void 0 : _a.set(iobj ? 1 : this.getObjectCount(false), \"Run Syntax\");\n const check = [];\n for (const obj of objects) {\n (_b = input === null || input === void 0 ? void 0 : input.progress) === null || _b === void 0 ? void 0 : _b.tick(\"Run Syntax - \" + obj.getName());\n if (skipLogic.skip(obj) || this.isDependency(obj)) {\n continue;\n }\n if (obj instanceof _abap_object_1.ABAPObject) {\n new syntax_1.SyntaxLogic(this, obj).run();\n }\n check.push(obj);\n }\n (_c = input === null || input === void 0 ? void 0 : input.progress) === null || _c === void 0 ? void 0 : _c.set(rules.length, \"Initialize Rules\");\n for (const rule of rules) {\n (_d = input === null || input === void 0 ? void 0 : input.progress) === null || _d === void 0 ? void 0 : _d.tick(\"Initialize Rules - \" + rule.getMetadata().key);\n if (rule.initialize === undefined) {\n throw new Error(rule.getMetadata().key + \" missing initialize method\");\n }\n rule.initialize(this);\n rulePerformance[rule.getMetadata().key] = 0;\n }\n (_e = input === null || input === void 0 ? void 0 : input.progress) === null || _e === void 0 ? void 0 : _e.set(check.length, \"Finding Issues\");\n for (const obj of check) {\n (_f = input === null || input === void 0 ? void 0 : input.progress) === null || _f === void 0 ? void 0 : _f.tick(\"Finding Issues - \" + obj.getType() + \" \" + obj.getName());\n for (const rule of rules) {\n const before = Date.now();\n issues.push(...rule.run(obj));\n const runtime = Date.now() - before;\n rulePerformance[rule.getMetadata().key] = rulePerformance[rule.getMetadata().key] + runtime;\n }\n }\n if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {\n const perf = [];\n for (const p in rulePerformance) {\n if (rulePerformance[p] > 100) { // ignore rules if it takes less than 100ms\n perf.push({ name: p, time: rulePerformance[p] });\n }\n }\n perf.sort((a, b) => { return b.time - a.time; });\n for (const p of perf) {\n process.stderr.write(\"\\t\" + p.time + \"ms\\t\" + p.name + \"\\n\");\n }\n }\n return this.excludeIssues(issues);\n }\n excludeIssues(issues) {\n var _a;\n const ret = issues;\n const globalNoIssues = this.conf.getGlobal().noIssues || [];\n const globalNoIssuesPatterns = globalNoIssues.map(x => new RegExp(x, \"i\"));\n if (globalNoIssuesPatterns.length > 0) {\n for (let i = ret.length - 1; i >= 0; i--) {\n const filename = ret[i].getFilename();\n if (excludeHelper_1.ExcludeHelper.isExcluded(filename, globalNoIssuesPatterns)) {\n ret.splice(i, 1);\n }\n }\n }\n // exclude issues, as now we know both the filename and issue key\n for (const rule of artifacts_rules_1.ArtifactsRules.getRules()) {\n const key = rule.getMetadata().key;\n const ruleExclude = (_a = this.conf.readByKey(key, \"exclude\")) !== null && _a !== void 0 ? _a : [];\n if (ruleExclude.length === 0) {\n continue;\n }\n const ruleExcludePatterns = ruleExclude.map(x => new RegExp(x, \"i\"));\n for (let i = ret.length - 1; i >= 0; i--) {\n if (ret[i].getKey() !== key) {\n continue;\n }\n const filename = ret[i].getFilename();\n if (excludeHelper_1.ExcludeHelper.isExcluded(filename, ruleExcludePatterns)) {\n ret.splice(i, 1);\n }\n }\n }\n return ret;\n }\n findOrCreate(name, type) {\n try {\n return this.find(name, type);\n }\n catch (_a) {\n const newName = name.toUpperCase();\n const newType = type ? type : \"UNKNOWN\";\n const add = artifacts_objects_1.ArtifactsObjects.newObject(newName, newType);\n if (this.objects[newName] === undefined) {\n this.objects[newName] = {};\n }\n this.objects[newName][newType] = add;\n if (this.objectsByType[newType] === undefined) {\n this.objectsByType[newType] = {};\n }\n this.objectsByType[newType][newName] = add;\n return add;\n }\n }\n removeObject(remove) {\n if (remove === undefined) {\n return;\n }\n if (this.objects[remove.getName()][remove.getType()] === undefined) {\n throw new Error(\"removeObject: object not found\");\n }\n if (Object.keys(this.objects[remove.getName()]).length === 1) {\n delete this.objects[remove.getName()];\n }\n else {\n delete this.objects[remove.getName()][remove.getType()];\n }\n if (Object.keys(this.objectsByType[remove.getType()]).length === 1) {\n delete this.objectsByType[remove.getType()];\n }\n else {\n delete this.objectsByType[remove.getType()][remove.getName()];\n }\n }\n find(name, type) {\n const searchType = type ? type : \"UNKNOWN\";\n const searchName = name.toUpperCase();\n if (this.objects[searchName] !== undefined\n && this.objects[searchName][searchType]) {\n return this.objects[searchName][searchType];\n }\n throw new Error(\"find: object not found, \" + type + \" \" + name);\n }\n}\nexports.Registry = Registry;\n//# sourceMappingURL=registry.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/registry.js?");
|
|
11306
11306
|
|
|
11307
11307
|
/***/ }),
|
|
11308
11308
|
|
|
@@ -12380,7 +12380,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12380
12380
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12381
12381
|
|
|
12382
12382
|
"use strict";
|
|
12383
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ObsoleteStatement = exports.ObsoleteStatementConf = void 0;\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nclass ObsoleteStatementConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Check for REFRESH statement */\r\n this.refresh = true;\r\n /** Check for COMPUTE statement */\r\n this.compute = true;\r\n /** Check for ADD statement */\r\n this.add = true;\r\n /** Check for SUBTRACT statement */\r\n this.subtract = true;\r\n /** Check for MULTIPLY statement */\r\n this.multiply = true;\r\n /** Check for DIVIDE statement */\r\n this.divide = true;\r\n /** Check for MOVE statement */\r\n this.move = true;\r\n /** Checks for usages of IS REQUESTED */\r\n this.requested = true;\r\n /** Checks for usages of OCCURS */\r\n this.occurs = true;\r\n /** Checks for SET EXTENDED CHECK */\r\n this.setExtended = true;\r\n /** Checks for WITH HEADER LINE */\r\n this.withHeaderLine = true;\r\n /** Checks for FIELD-SYMBOLS ... STRUCTURE */\r\n this.fieldSymbolStructure = true;\r\n /** Checks for TYPE-POOLS */\r\n this.typePools = true;\r\n /** Checks for addition LOAD */\r\n this.load = true;\r\n /** Checks for PARAMETER */\r\n this.parameter = true;\r\n /** Checks for RANGES */\r\n this.ranges = true;\r\n /** Checks for COMMUNICATION */\r\n this.communication = true;\r\n /** Checks for PACK */\r\n this.pack = true;\r\n /** Checks for SELECT without INTO */\r\n this.selectWithoutInto = true;\r\n /** FREE MEMORY, without ID */\r\n this.freeMemory = true;\r\n /** Checks for EXIT FROM SQL */\r\n this.exitFromSQL = true;\r\n /** Checks for SORT itab BY <fs> */\r\n this.sortByFS = true;\r\n /** Checks for CALL TRANSFORMATION OBJECTS */\r\n this.callTransformation = true;\r\n /** Check for POSIX REGEX usage */\r\n this.regex = true;\r\n /** Check for OCCURENCES vs OCCURRENCES usage */\r\n this.occurences = true;\r\n }\r\n}\r\nexports.ObsoleteStatementConf = ObsoleteStatementConf;\r\nclass ObsoleteStatement extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ObsoleteStatementConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"obsolete_statement\",\r\n title: \"Obsolete statements\",\r\n shortDescription: `Checks for usages of certain obsolete statements`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix],\r\n extendedInformation: `\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-functional-to-procedural-language-constructs\n\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-obsolete-language-elements\n\nSET EXTENDED CHECK: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapset_extended_check.htm\n\nIS REQUESTED: https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenlogexp_requested.htm\n\nWITH HEADER LINE: https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abapdata_header_line.htm\n\nFIELD-SYMBOLS STRUCTURE: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapfield-symbols_obsolete_typing.htm\n\nTYPE-POOLS: from 702, https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abennews-71-program_load.htm\n\nLOAD addition: from 702, https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abennews-71-program_load.htm\n\nCOMMUICATION: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapcommunication.htm\n\nOCCURS: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapdata_occurs.htm\n\nPARAMETER: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abapparameter.htm\n\nRANGES: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abapranges.htm\n\nPACK: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abappack.htm\n\nMOVE: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapmove_obs.htm\n\nSELECT without INTO: https://help.sap.com/doc/abapdocu_731_index_htm/7.31/en-US/abapselect_obsolete.htm\nSELECT COUNT(*) is considered okay\n\nFREE MEMORY: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abapfree_mem_id_obsolete.htm\n\nSORT BY FS: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abapsort_itab_obsolete.htm\n\nCALL TRANSFORMATION OBJECTS: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abapcall_transformation_objects.htm\n\nPOSIX REGEX: https://help.sap.com/doc/abapdocu_755_index_htm/7.55/en-US/index.htm\n\nOCCURENCES: check for OCCURENCES vs OCCURRENCES`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n var _a, _b, _c;\r\n const issues = [];\r\n const statements = file.getStatements();\r\n let prev = undefined;\r\n const configVersion = this.reg.getConfig().getVersion();\r\n for (const staNode of statements) {\r\n const sta = staNode.get();\r\n if ((sta instanceof Statements.Refresh && this.conf.refresh)\r\n || (sta instanceof Statements.Compute && this.conf.compute)\r\n || (sta instanceof Statements.Add && this.conf.add)\r\n || (sta instanceof Statements.Subtract && this.conf.subtract)\r\n || (sta instanceof Statements.ClassDefinitionLoad && this.conf.load && configVersion >= version_1.Version.v702)\r\n || (sta instanceof Statements.InterfaceLoad && this.conf.load && configVersion >= version_1.Version.v702)\r\n || (sta instanceof Statements.Multiply && this.conf.multiply)\r\n || (sta instanceof Statements.Divide && this.conf.divide)\r\n || (sta instanceof Statements.Move && this.conf.move\r\n && staNode.getTokens()[0].getStr().toUpperCase() === \"MOVE\"\r\n && staNode.getTokens()[1].getStr() !== \"-\"\r\n && staNode.getTokens()[1].getStr().toUpperCase() !== \"EXACT\")) {\r\n if (prev === undefined || staNode.getStart().getCol() !== prev.getCol() || staNode.getStart().getRow() !== prev.getRow()) {\r\n const message = \"Statement \\\"\" + staNode.getFirstToken().getStr() + \"\\\" is obsolete\";\r\n const fix = this.getFix(file, sta, staNode);\r\n const issue = issue_1.Issue.atStatement(file, staNode, message, this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n prev = staNode.getStart();\r\n }\r\n if (this.conf.setExtended && sta instanceof Statements.SetExtendedCheck) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"SET EXTENDED CHECK is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n if (this.conf.communication && sta instanceof Statements.Communication) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"COMMUNICATION is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n if (this.conf.pack && sta instanceof Statements.Pack) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"PACK is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n if (this.conf.parameter && sta instanceof Statements.Parameter) {\r\n const token = staNode.getFirstToken();\r\n if (token.getStr().toUpperCase() === \"PARAMETER\") {\r\n const fix = edit_helper_1.EditHelper.replaceToken(file, token, \"PARAMETERS\");\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Use PARAMETERS instead of PARAMETER\", this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.ranges && sta instanceof Statements.Ranges) {\r\n const children = staNode.getChildren();\r\n let fix = undefined;\r\n if (children.length === 5) {\r\n const simpleNameString = children[1].concatTokens();\r\n const fieldSubString = children[3].concatTokens();\r\n const replacement = \"TYPES \" + simpleNameString + \" LIKE RANGE OF \" + fieldSubString + \".\";\r\n fix = edit_helper_1.EditHelper.replaceRange(file, staNode.getStart(), staNode.getEnd(), replacement);\r\n }\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Use LIKE RANGE OF instead of RANGES\", this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n if (this.conf.selectWithoutInto\r\n && (sta instanceof Statements.Select || sta instanceof Statements.SelectLoop)\r\n && staNode.findFirstExpression(Expressions.SQLIntoStructure) === undefined\r\n && staNode.findFirstExpression(Expressions.SQLIntoTable) === undefined) {\r\n const concat = (_a = staNode.findFirstExpression(Expressions.SQLFieldList)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();\r\n if (concat !== \"COUNT(*)\" && concat !== \"COUNT( * )\") {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"SELECT without INTO\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.requested && sta instanceof Statements.If) {\r\n for (const compare of staNode.findAllExpressions(Expressions.Compare)) {\r\n const token = compare.findDirectTokenByText(\"REQUESTED\");\r\n if (token) {\r\n const fix = edit_helper_1.EditHelper.replaceToken(file, token, \"SUPPLIED\");\r\n const issue = issue_1.Issue.atToken(file, token, \"IS REQUESTED is obsolete\", this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n if (this.conf.occurs) {\r\n if ((sta instanceof Statements.Describe)\r\n || (sta instanceof Statements.Ranges)\r\n || (sta instanceof Statements.DataBegin)\r\n || (sta instanceof Statements.TypeBegin)) {\r\n const token = staNode.findDirectTokenByText(\"OCCURS\");\r\n if (token) {\r\n const issue = issue_1.Issue.atToken(file, token, \"OCCURS is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n for (const dataDef of staNode.findAllExpressions(Expressions.DataDefinition)) {\r\n const token = (_b = dataDef.findDirectExpression(Expressions.TypeTable)) === null || _b === void 0 ? void 0 : _b.findDirectTokenByText(\"OCCURS\");\r\n if (token) {\r\n const issue = issue_1.Issue.atToken(file, token, \"OCCURS is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n if (this.conf.withHeaderLine === true && sta instanceof Statements.Data) {\r\n if (staNode.concatTokens().toUpperCase().includes(\"WITH HEADER LINE\")) {\r\n const token = staNode.getFirstToken();\r\n if (token) {\r\n const issue = issue_1.Issue.atToken(file, token, \"WITH HEADER LINE is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n if (this.conf.fieldSymbolStructure && sta instanceof Statements.FieldSymbol) {\r\n const token = staNode.findDirectTokenByText(\"STRUCTURE\");\r\n if (token) {\r\n const issue = issue_1.Issue.atToken(file, token, \"FIELD-SYMBOLS ... STRUCTURE is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.typePools && sta instanceof Statements.TypePools && configVersion >= version_1.Version.v702) {\r\n const fix = edit_helper_1.EditHelper.deleteStatement(file, staNode);\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Statement \\\"TYPE-POOLS\\\" is obsolete\", this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n if (this.conf.freeMemory && sta instanceof Statements.FreeMemory) {\r\n const concat = staNode.concatTokens().toUpperCase();\r\n if (concat === \"FREE MEMORY.\") {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Statement \\\"FREE MEMORY\\\" without ID is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.exitFromSQL && sta instanceof Statements.Exit) {\r\n const concat = staNode.concatTokens().toUpperCase();\r\n if (concat === \"EXIT FROM SQL.\") {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Statement \\\"EXIT FROM SQL\\\" is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.sortByFS && sta instanceof Statements.Sort) {\r\n const afterBy = staNode.findExpressionAfterToken(\"BY\");\r\n if (afterBy instanceof nodes_1.ExpressionNode && afterBy.get() instanceof expressions_1.SourceFieldSymbol) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Statement \\\"SORT itab BY <fs>\\\" is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.callTransformation && sta instanceof Statements.CallTransformation) {\r\n const objects = staNode.findExpressionAfterToken(\"OBJECTS\");\r\n if (objects) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Use PARAMETERS instead of OBJECTS\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.occurences && sta instanceof Statements.Replace) {\r\n const concat = staNode.concatTokens().toUpperCase();\r\n if (concat.includes(\" OCCURENCES \")) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Use \\\"OCCURRENCES\\\"\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (configVersion >= version_1.Version.v756 && this.conf.regex) {\r\n if (sta instanceof Statements.Find || sta instanceof Statements.Replace) {\r\n if ((_c = staNode.findFirstExpression(Expressions.FindType)) === null || _c === void 0 ? void 0 : _c.concatTokens().includes(\"REGEX\")) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"REGEX obsolete, use PCRE\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n else {\r\n const classNameExpression = staNode.findAllExpressions(Expressions.ClassName);\r\n const methodNameExpression = staNode.findAllExpressions(Expressions.MethodName);\r\n if (classNameExpression.length !== 0 && methodNameExpression.length !== 0) {\r\n const className = classNameExpression[0].concatTokens();\r\n const methodName = methodNameExpression[0].concatTokens();\r\n if (className === \"cl_abap_regex\") {\r\n if (methodName === \"create_posix\") {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"create_posix obsolete, use create_pcre\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n else if (className === \"cl_abap_matcher\") {\r\n if (methodName.includes(\"posix\")) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"posix methods obsolete, use pcre methods\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n getFix(file, statement, statementNode) {\r\n if (statement instanceof Statements.Refresh) {\r\n if (statementNode.getChildren().length === 6) {\r\n return undefined;\r\n }\r\n return edit_helper_1.EditHelper.replaceToken(file, statementNode.getFirstToken(), \"CLEAR\");\r\n }\r\n else if (statement instanceof Statements.Compute) {\r\n const children = statementNode.getChildren();\r\n if (children.length === 5) {\r\n const tokenForDeletion = statementNode.getFirstToken();\r\n let endPosition = tokenForDeletion.getEnd();\r\n endPosition = new position_1.Position(endPosition.getRow(), endPosition.getCol() + 1);\r\n return edit_helper_1.EditHelper.deleteRange(file, tokenForDeletion.getStart(), endPosition);\r\n }\r\n else {\r\n const targetString = children[2].concatTokens();\r\n const sourceString = children[4].concatTokens();\r\n const replacement = targetString + \" = EXACT #( \" + sourceString + \" ).\";\r\n return edit_helper_1.EditHelper.replaceRange(file, statementNode.getStart(), statementNode.getEnd(), replacement);\r\n }\r\n }\r\n else if (statement instanceof Statements.Add ||\r\n statement instanceof Statements.Subtract) {\r\n const children = statementNode.getChildren();\r\n const sourceString = children[1].concatTokens();\r\n const targetString = children[3].concatTokens();\r\n let replacement = \"\";\r\n if (statement instanceof Statements.Add) {\r\n replacement = targetString + \" = \" + targetString + \" + \" + sourceString + \".\";\r\n }\r\n else if (statement instanceof Statements.Subtract) {\r\n replacement = targetString + \" = \" + targetString + \" - \" + sourceString + \".\";\r\n }\r\n return edit_helper_1.EditHelper.replaceRange(file, statementNode.getStart(), statementNode.getEnd(), replacement);\r\n }\r\n else if (statement instanceof Statements.Multiply ||\r\n statement instanceof Statements.Divide) {\r\n const children = statementNode.getChildren();\r\n const targetString = children[1].concatTokens();\r\n const sourceString = children[3].concatTokens();\r\n let replacement = \"\";\r\n if (statement instanceof Statements.Multiply) {\r\n replacement = targetString + \" = \" + targetString + \" * \" + sourceString + \".\";\r\n }\r\n else if (statement instanceof Statements.Divide) {\r\n replacement = targetString + \" = \" + targetString + \" / \" + sourceString + \".\";\r\n }\r\n return edit_helper_1.EditHelper.replaceRange(file, statementNode.getStart(), statementNode.getEnd(), replacement);\r\n }\r\n else if (statement instanceof Statements.Move) {\r\n if (statementNode.getColon() !== undefined) {\r\n return undefined;\r\n }\r\n const children = statementNode.getChildren();\r\n const sourceString = children[1].concatTokens();\r\n const targetString = children[3].concatTokens();\r\n let operator = children[2].concatTokens();\r\n if (operator === \"TO\") {\r\n operator = \" = \";\r\n }\r\n else {\r\n operator = \" ?= \";\r\n }\r\n const replacement = targetString + operator + sourceString + \".\";\r\n return edit_helper_1.EditHelper.replaceRange(file, statementNode.getStart(), statementNode.getEnd(), replacement);\r\n }\r\n else if (statement instanceof Statements.ClassDefinitionLoad ||\r\n statement instanceof Statements.InterfaceLoad) {\r\n let token = undefined;\r\n if (statement instanceof Statements.ClassDefinitionLoad) {\r\n token = statementNode.getChildren()[3].getFirstToken();\r\n }\r\n else {\r\n token = statementNode.getChildren()[2].getFirstToken();\r\n }\r\n let startPosition = token.getStart();\r\n startPosition = new position_1.Position(startPosition.getRow(), startPosition.getCol() - 1);\r\n return edit_helper_1.EditHelper.deleteRange(file, startPosition, token.getEnd());\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.ObsoleteStatement = ObsoleteStatement;\r\n//# sourceMappingURL=obsolete_statement.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/obsolete_statement.js?");
|
|
12383
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ObsoleteStatement = exports.ObsoleteStatementConf = void 0;\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nclass ObsoleteStatementConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Check for REFRESH statement */\r\n this.refresh = true;\r\n /** Check for COMPUTE statement */\r\n this.compute = true;\r\n /** Check for ADD statement */\r\n this.add = true;\r\n /** Check for SUBTRACT statement */\r\n this.subtract = true;\r\n /** Check for MULTIPLY statement */\r\n this.multiply = true;\r\n /** Check for DIVIDE statement */\r\n this.divide = true;\r\n /** Check for MOVE statement */\r\n this.move = true;\r\n /** Checks for usages of IS REQUESTED */\r\n this.requested = true;\r\n /** Checks for usages of OCCURS */\r\n this.occurs = true;\r\n /** Checks for SET EXTENDED CHECK */\r\n this.setExtended = true;\r\n /** Checks for WITH HEADER LINE */\r\n this.withHeaderLine = true;\r\n /** Checks for FIELD-SYMBOLS ... STRUCTURE */\r\n this.fieldSymbolStructure = true;\r\n /** Checks for TYPE-POOLS */\r\n this.typePools = true;\r\n /** Checks for addition LOAD */\r\n this.load = true;\r\n /** Checks for PARAMETER */\r\n this.parameter = true;\r\n /** Checks for RANGES */\r\n this.ranges = true;\r\n /** Checks for COMMUNICATION */\r\n this.communication = true;\r\n /** Checks for PACK */\r\n this.pack = true;\r\n /** Checks for SELECT without INTO */\r\n this.selectWithoutInto = true;\r\n /** FREE MEMORY, without ID */\r\n this.freeMemory = true;\r\n /** Checks for EXIT FROM SQL */\r\n this.exitFromSQL = true;\r\n /** Checks for SORT itab BY <fs> */\r\n this.sortByFS = true;\r\n /** Checks for CALL TRANSFORMATION OBJECTS */\r\n this.callTransformation = true;\r\n /** Check for POSIX REGEX usage */\r\n this.regex = true;\r\n /** Check for OCCURENCES vs OCCURRENCES usage */\r\n this.occurences = true;\r\n /** Check for CLIENT SPECIFIED */\r\n this.clientSpecified = true;\r\n }\r\n}\r\nexports.ObsoleteStatementConf = ObsoleteStatementConf;\r\nclass ObsoleteStatement extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ObsoleteStatementConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"obsolete_statement\",\r\n title: \"Obsolete statements\",\r\n shortDescription: `Checks for usages of certain obsolete statements`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix],\r\n extendedInformation: `\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-functional-to-procedural-language-constructs\n\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-obsolete-language-elements\n\nSET EXTENDED CHECK: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapset_extended_check.htm\n\nIS REQUESTED: https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenlogexp_requested.htm\n\nWITH HEADER LINE: https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abapdata_header_line.htm\n\nFIELD-SYMBOLS STRUCTURE: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapfield-symbols_obsolete_typing.htm\n\nTYPE-POOLS: from 702, https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abennews-71-program_load.htm\n\nLOAD addition: from 702, https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abennews-71-program_load.htm\n\nCOMMUICATION: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapcommunication.htm\n\nOCCURS: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapdata_occurs.htm\n\nPARAMETER: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abapparameter.htm\n\nRANGES: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abapranges.htm\n\nPACK: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abappack.htm\n\nMOVE: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapmove_obs.htm\n\nSELECT without INTO: https://help.sap.com/doc/abapdocu_731_index_htm/7.31/en-US/abapselect_obsolete.htm\nSELECT COUNT(*) is considered okay\n\nFREE MEMORY: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abapfree_mem_id_obsolete.htm\n\nSORT BY FS: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abapsort_itab_obsolete.htm\n\nCALL TRANSFORMATION OBJECTS: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abapcall_transformation_objects.htm\n\nPOSIX REGEX: https://help.sap.com/doc/abapdocu_755_index_htm/7.55/en-US/index.htm\n\nOCCURENCES: check for OCCURENCES vs OCCURRENCES\n\nCLIENT SPECIFIED, from 754: https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abapselect_client_obsolete.htm`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n var _a, _b, _c;\r\n const issues = [];\r\n const statements = file.getStatements();\r\n let prev = undefined;\r\n const configVersion = this.reg.getConfig().getVersion();\r\n for (const staNode of statements) {\r\n const sta = staNode.get();\r\n if ((sta instanceof Statements.Refresh && this.conf.refresh)\r\n || (sta instanceof Statements.Compute && this.conf.compute)\r\n || (sta instanceof Statements.Add && this.conf.add)\r\n || (sta instanceof Statements.Subtract && this.conf.subtract)\r\n || (sta instanceof Statements.ClassDefinitionLoad && this.conf.load && configVersion >= version_1.Version.v702)\r\n || (sta instanceof Statements.InterfaceLoad && this.conf.load && configVersion >= version_1.Version.v702)\r\n || (sta instanceof Statements.Multiply && this.conf.multiply)\r\n || (sta instanceof Statements.Divide && this.conf.divide)\r\n || (sta instanceof Statements.Move && this.conf.move\r\n && staNode.getTokens()[0].getStr().toUpperCase() === \"MOVE\"\r\n && staNode.getTokens()[1].getStr() !== \"-\"\r\n && staNode.getTokens()[1].getStr().toUpperCase() !== \"EXACT\")) {\r\n if (prev === undefined || staNode.getStart().getCol() !== prev.getCol() || staNode.getStart().getRow() !== prev.getRow()) {\r\n const message = \"Statement \\\"\" + staNode.getFirstToken().getStr() + \"\\\" is obsolete\";\r\n const fix = this.getFix(file, sta, staNode);\r\n const issue = issue_1.Issue.atStatement(file, staNode, message, this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n prev = staNode.getStart();\r\n }\r\n if (this.conf.setExtended && sta instanceof Statements.SetExtendedCheck) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"SET EXTENDED CHECK is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n if (this.conf.communication && sta instanceof Statements.Communication) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"COMMUNICATION is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n if (this.conf.pack && sta instanceof Statements.Pack) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"PACK is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n if (this.conf.parameter && sta instanceof Statements.Parameter) {\r\n const token = staNode.getFirstToken();\r\n if (token.getStr().toUpperCase() === \"PARAMETER\") {\r\n const fix = edit_helper_1.EditHelper.replaceToken(file, token, \"PARAMETERS\");\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Use PARAMETERS instead of PARAMETER\", this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.ranges && sta instanceof Statements.Ranges) {\r\n const children = staNode.getChildren();\r\n let fix = undefined;\r\n if (children.length === 5) {\r\n const simpleNameString = children[1].concatTokens();\r\n const fieldSubString = children[3].concatTokens();\r\n const replacement = \"TYPES \" + simpleNameString + \" LIKE RANGE OF \" + fieldSubString + \".\";\r\n fix = edit_helper_1.EditHelper.replaceRange(file, staNode.getStart(), staNode.getEnd(), replacement);\r\n }\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Use LIKE RANGE OF instead of RANGES\", this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n if (this.conf.selectWithoutInto\r\n && (sta instanceof Statements.Select || sta instanceof Statements.SelectLoop)\r\n && staNode.findFirstExpression(Expressions.SQLIntoStructure) === undefined\r\n && staNode.findFirstExpression(Expressions.SQLIntoTable) === undefined) {\r\n const concat = (_a = staNode.findFirstExpression(Expressions.SQLFieldList)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();\r\n if (concat !== \"COUNT(*)\" && concat !== \"COUNT( * )\") {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"SELECT without INTO\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.requested && sta instanceof Statements.If) {\r\n for (const compare of staNode.findAllExpressions(Expressions.Compare)) {\r\n const token = compare.findDirectTokenByText(\"REQUESTED\");\r\n if (token) {\r\n const fix = edit_helper_1.EditHelper.replaceToken(file, token, \"SUPPLIED\");\r\n const issue = issue_1.Issue.atToken(file, token, \"IS REQUESTED is obsolete\", this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n if (this.conf.occurs) {\r\n if ((sta instanceof Statements.Describe)\r\n || (sta instanceof Statements.Ranges)\r\n || (sta instanceof Statements.DataBegin)\r\n || (sta instanceof Statements.TypeBegin)) {\r\n const token = staNode.findDirectTokenByText(\"OCCURS\");\r\n if (token) {\r\n const issue = issue_1.Issue.atToken(file, token, \"OCCURS is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n for (const dataDef of staNode.findAllExpressions(Expressions.DataDefinition)) {\r\n const token = (_b = dataDef.findDirectExpression(Expressions.TypeTable)) === null || _b === void 0 ? void 0 : _b.findDirectTokenByText(\"OCCURS\");\r\n if (token) {\r\n const issue = issue_1.Issue.atToken(file, token, \"OCCURS is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n if (this.conf.withHeaderLine === true && sta instanceof Statements.Data) {\r\n if (staNode.concatTokens().toUpperCase().includes(\"WITH HEADER LINE\")) {\r\n const token = staNode.getTokens().find(t => t.getStr().toUpperCase() === \"WITH\");\r\n if (token) {\r\n const issue = issue_1.Issue.atToken(file, token, \"WITH HEADER LINE is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n if (this.conf.fieldSymbolStructure && sta instanceof Statements.FieldSymbol) {\r\n const token = staNode.findDirectTokenByText(\"STRUCTURE\");\r\n if (token) {\r\n const issue = issue_1.Issue.atToken(file, token, \"FIELD-SYMBOLS ... STRUCTURE is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.typePools && sta instanceof Statements.TypePools && configVersion >= version_1.Version.v702) {\r\n const fix = edit_helper_1.EditHelper.deleteStatement(file, staNode);\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Statement \\\"TYPE-POOLS\\\" is obsolete\", this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n if (this.conf.freeMemory && sta instanceof Statements.FreeMemory) {\r\n const concat = staNode.concatTokens().toUpperCase();\r\n if (concat === \"FREE MEMORY.\") {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Statement \\\"FREE MEMORY\\\" without ID is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.exitFromSQL && sta instanceof Statements.Exit) {\r\n const concat = staNode.concatTokens().toUpperCase();\r\n if (concat === \"EXIT FROM SQL.\") {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Statement \\\"EXIT FROM SQL\\\" is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.sortByFS && sta instanceof Statements.Sort) {\r\n const afterBy = staNode.findExpressionAfterToken(\"BY\");\r\n if (afterBy instanceof nodes_1.ExpressionNode && afterBy.get() instanceof expressions_1.SourceFieldSymbol) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Statement \\\"SORT itab BY <fs>\\\" is obsolete\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.callTransformation && sta instanceof Statements.CallTransformation) {\r\n const objects = staNode.findExpressionAfterToken(\"OBJECTS\");\r\n if (objects) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Use PARAMETERS instead of OBJECTS\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.conf.occurences && sta instanceof Statements.Replace) {\r\n const concat = staNode.concatTokens().toUpperCase();\r\n if (concat.includes(\" OCCURENCES \")) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Use \\\"OCCURRENCES\\\"\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (configVersion >= version_1.Version.v754 && this.conf.clientSpecified\r\n && (sta instanceof Statements.Select\r\n || sta instanceof Statements.SelectLoop\r\n || sta instanceof Statements.DeleteDatabase\r\n || sta instanceof Statements.InsertDatabase\r\n || sta instanceof Statements.ModifyDatabase\r\n || sta instanceof Statements.UpdateDatabase)) {\r\n const concat = staNode.concatTokens().toUpperCase();\r\n if (concat.includes(\" CLIENT SPECIFIED\")) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"Use USING CLIENT\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (configVersion >= version_1.Version.v756 && this.conf.regex) {\r\n if (sta instanceof Statements.Find || sta instanceof Statements.Replace) {\r\n if ((_c = staNode.findFirstExpression(Expressions.FindType)) === null || _c === void 0 ? void 0 : _c.concatTokens().includes(\"REGEX\")) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"REGEX obsolete, use PCRE\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n else {\r\n const classNameExpression = staNode.findAllExpressions(Expressions.ClassName);\r\n const methodNameExpression = staNode.findAllExpressions(Expressions.MethodName);\r\n if (classNameExpression.length !== 0 && methodNameExpression.length !== 0) {\r\n const className = classNameExpression[0].concatTokens();\r\n const methodName = methodNameExpression[0].concatTokens();\r\n if (className === \"cl_abap_regex\") {\r\n if (methodName === \"create_posix\") {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"create_posix obsolete, use create_pcre\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n else if (className === \"cl_abap_matcher\") {\r\n if (methodName.includes(\"posix\")) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"posix methods obsolete, use pcre methods\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n getFix(file, statement, statementNode) {\r\n if (statement instanceof Statements.Refresh) {\r\n if (statementNode.getChildren().length === 6) {\r\n return undefined;\r\n }\r\n return edit_helper_1.EditHelper.replaceToken(file, statementNode.getFirstToken(), \"CLEAR\");\r\n }\r\n else if (statement instanceof Statements.Compute) {\r\n const children = statementNode.getChildren();\r\n if (children.length === 5) {\r\n const tokenForDeletion = statementNode.getFirstToken();\r\n let endPosition = tokenForDeletion.getEnd();\r\n endPosition = new position_1.Position(endPosition.getRow(), endPosition.getCol() + 1);\r\n return edit_helper_1.EditHelper.deleteRange(file, tokenForDeletion.getStart(), endPosition);\r\n }\r\n else {\r\n const targetString = children[2].concatTokens();\r\n const sourceString = children[4].concatTokens();\r\n const replacement = targetString + \" = EXACT #( \" + sourceString + \" ).\";\r\n return edit_helper_1.EditHelper.replaceRange(file, statementNode.getStart(), statementNode.getEnd(), replacement);\r\n }\r\n }\r\n else if (statement instanceof Statements.Add ||\r\n statement instanceof Statements.Subtract) {\r\n const children = statementNode.getChildren();\r\n const sourceString = children[1].concatTokens();\r\n const targetString = children[3].concatTokens();\r\n let replacement = \"\";\r\n if (statement instanceof Statements.Add) {\r\n replacement = targetString + \" = \" + targetString + \" + \" + sourceString + \".\";\r\n }\r\n else if (statement instanceof Statements.Subtract) {\r\n replacement = targetString + \" = \" + targetString + \" - \" + sourceString + \".\";\r\n }\r\n return edit_helper_1.EditHelper.replaceRange(file, statementNode.getStart(), statementNode.getEnd(), replacement);\r\n }\r\n else if (statement instanceof Statements.Multiply ||\r\n statement instanceof Statements.Divide) {\r\n const children = statementNode.getChildren();\r\n const targetString = children[1].concatTokens();\r\n const sourceString = children[3].concatTokens();\r\n let replacement = \"\";\r\n if (statement instanceof Statements.Multiply) {\r\n replacement = targetString + \" = \" + targetString + \" * \" + sourceString + \".\";\r\n }\r\n else if (statement instanceof Statements.Divide) {\r\n replacement = targetString + \" = \" + targetString + \" / \" + sourceString + \".\";\r\n }\r\n return edit_helper_1.EditHelper.replaceRange(file, statementNode.getStart(), statementNode.getEnd(), replacement);\r\n }\r\n else if (statement instanceof Statements.Move) {\r\n if (statementNode.getColon() !== undefined) {\r\n return undefined;\r\n }\r\n const children = statementNode.getChildren();\r\n const sourceString = children[1].concatTokens();\r\n const targetString = children[3].concatTokens();\r\n let operator = children[2].concatTokens();\r\n if (operator === \"TO\") {\r\n operator = \" = \";\r\n }\r\n else {\r\n operator = \" ?= \";\r\n }\r\n const replacement = targetString + operator + sourceString + \".\";\r\n return edit_helper_1.EditHelper.replaceRange(file, statementNode.getStart(), statementNode.getEnd(), replacement);\r\n }\r\n else if (statement instanceof Statements.ClassDefinitionLoad ||\r\n statement instanceof Statements.InterfaceLoad) {\r\n let token = undefined;\r\n if (statement instanceof Statements.ClassDefinitionLoad) {\r\n token = statementNode.getChildren()[3].getFirstToken();\r\n }\r\n else {\r\n token = statementNode.getChildren()[2].getFirstToken();\r\n }\r\n let startPosition = token.getStart();\r\n startPosition = new position_1.Position(startPosition.getRow(), startPosition.getCol() - 1);\r\n return edit_helper_1.EditHelper.deleteRange(file, startPosition, token.getEnd());\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.ObsoleteStatement = ObsoleteStatement;\r\n//# sourceMappingURL=obsolete_statement.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/obsolete_statement.js?");
|
|
12384
12384
|
|
|
12385
12385
|
/***/ }),
|
|
12386
12386
|
|
|
@@ -12611,7 +12611,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12611
12611
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12612
12612
|
|
|
12613
12613
|
"use strict";
|
|
12614
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SelectPerformance = exports.SelectPerformanceConf = void 0;\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst structure_type_1 = __webpack_require__(/*! ../abap/types/basic/structure_type */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/structure_type.js\");\r\nconst DEFAULT_COLUMNS = 10;\r\nclass SelectPerformanceConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Detects ENDSELECT */\r\n this.endSelect = true;\r\n /** Detects SELECT * */\r\n this.selectStar = true;\r\n /** \"SELECT\" * is considered okay if the table is less than X columns, the table must be known to the linter */\r\n this.starOkayIfFewColumns = DEFAULT_COLUMNS;\r\n }\r\n}\r\nexports.SelectPerformanceConf = SelectPerformanceConf;\r\nclass SelectPerformance {\r\n constructor() {\r\n this.conf = new SelectPerformanceConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"select_performance\",\r\n title: \"SELECT performance\",\r\n shortDescription: `Various checks regarding SELECT performance.`,\r\n extendedInformation: `ENDSELECT: not reported when the corresponding SELECT has PACKAGE SIZE\n\nSELECT *: not reported if using INTO/APPENDING CORRESPONDING FIELDS OF`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Performance],\r\n };\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n getConfig() {\r\n if (this.conf.starOkayIfFewColumns === undefined) {\r\n this.conf.starOkayIfFewColumns = DEFAULT_COLUMNS;\r\n }\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof _abap_object_1.ABAPObject)) {\r\n return [];\r\n }\r\n const issues = [];\r\n for (const file of obj.getABAPFiles()) {\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return issues;\r\n }\r\n if (this.conf.endSelect) {\r\n for (const s of stru.findAllStructures(Structures.Select) || []) {\r\n const select = s.findDirectStatement(Statements.SelectLoop);\r\n if (select === undefined || select.concatTokens().toUpperCase().includes(\"PACKAGE SIZE\")) {\r\n continue;\r\n }\r\n const message = \"Avoid use of ENDSELECT\";\r\n issues.push(issue_1.Issue.atStatement(file, select, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n if (this.conf.selectStar) {\r\n const spaghetti = new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti;\r\n const selects = stru.findAllStatements(Statements.Select);\r\n selects.push(...stru.findAllStatements(Statements.SelectLoop));\r\n for (const s of selects) {\r\n const concat = s.concatTokens().toUpperCase();\r\n if (concat.startsWith(\"SELECT * \") === false\r\n && concat.startsWith(\"SELECT SINGLE * \") === false) {\r\n continue;\r\n }\r\n else if (concat.includes(\" INTO CORRESPONDING FIELDS OF \")\r\n || concat.includes(\" APPENDING CORRESPONDING FIELDS OF \")) {\r\n continue;\r\n }\r\n const columnCount = this.findNumberOfColumns(s, file, spaghetti);\r\n if (columnCount\r\n && columnCount <= this.getConfig().starOkayIfFewColumns) {\r\n continue;\r\n }\r\n const message = \"Avoid use of SELECT *\";\r\n issues.push(issue_1.Issue.atToken(file, s.getFirstToken(), message, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n findNumberOfColumns(s, file, spaghetti) {\r\n const dbnames = s.findAllExpressions(Expressions.DatabaseTable);\r\n if (dbnames.length === 1) {\r\n const start = dbnames[0].getFirstToken().getStart();\r\n const scope = spaghetti.lookupPosition(start, file.getFilename());\r\n const name = scope === null || scope === void 0 ? void 0 : scope.findTableReference(start);\r\n const tabl = this.reg.getObject(\"TABL\", name);\r\n const parsed = tabl === null || tabl === void 0 ? void 0 : tabl.parseType(this.reg);\r\n if (parsed instanceof structure_type_1.StructureType) {\r\n return parsed.getComponents().length;\r\n }\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.SelectPerformance = SelectPerformance;\r\n//# sourceMappingURL=select_performance.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/select_performance.js?");
|
|
12614
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SelectPerformance = exports.SelectPerformanceConf = void 0;\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst structure_type_1 = __webpack_require__(/*! ../abap/types/basic/structure_type */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/structure_type.js\");\r\nconst DEFAULT_COLUMNS = 10;\r\nclass SelectPerformanceConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Detects ENDSELECT */\r\n this.endSelect = true;\r\n /** Detects SELECT * */\r\n this.selectStar = true;\r\n /** \"SELECT\" * is considered okay if the table is less than X columns, the table must be known to the linter */\r\n this.starOkayIfFewColumns = DEFAULT_COLUMNS;\r\n }\r\n}\r\nexports.SelectPerformanceConf = SelectPerformanceConf;\r\nclass SelectPerformance {\r\n constructor() {\r\n this.conf = new SelectPerformanceConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"select_performance\",\r\n title: \"SELECT performance\",\r\n shortDescription: `Various checks regarding SELECT performance.`,\r\n extendedInformation: `ENDSELECT: not reported when the corresponding SELECT has PACKAGE SIZE\n\nSELECT *: not reported if using INTO/APPENDING CORRESPONDING FIELDS OF`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Performance],\r\n badExample: `SELECT field1, field2 FROM table\n INTO @DATA(structure) UP TO 1 ROWS ORDER BY field3 DESCENDING.\nENDSELECT.`,\r\n goodExample: `SELECT field1, field2 FROM table UP TO 1 ROWS\n INTO TABLE @DATA(table) ORDER BY field3 DESCENDING`,\r\n };\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n getConfig() {\r\n if (this.conf.starOkayIfFewColumns === undefined) {\r\n this.conf.starOkayIfFewColumns = DEFAULT_COLUMNS;\r\n }\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof _abap_object_1.ABAPObject)) {\r\n return [];\r\n }\r\n const issues = [];\r\n for (const file of obj.getABAPFiles()) {\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return issues;\r\n }\r\n if (this.conf.endSelect) {\r\n for (const s of stru.findAllStructures(Structures.Select) || []) {\r\n const select = s.findDirectStatement(Statements.SelectLoop);\r\n if (select === undefined || select.concatTokens().toUpperCase().includes(\"PACKAGE SIZE\")) {\r\n continue;\r\n }\r\n const message = \"Avoid use of ENDSELECT\";\r\n issues.push(issue_1.Issue.atStatement(file, select, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n if (this.conf.selectStar) {\r\n const spaghetti = new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti;\r\n const selects = stru.findAllStatements(Statements.Select);\r\n selects.push(...stru.findAllStatements(Statements.SelectLoop));\r\n for (const s of selects) {\r\n const concat = s.concatTokens().toUpperCase();\r\n if (concat.startsWith(\"SELECT * \") === false\r\n && concat.startsWith(\"SELECT SINGLE * \") === false) {\r\n continue;\r\n }\r\n else if (concat.includes(\" INTO CORRESPONDING FIELDS OF \")\r\n || concat.includes(\" APPENDING CORRESPONDING FIELDS OF \")) {\r\n continue;\r\n }\r\n const columnCount = this.findNumberOfColumns(s, file, spaghetti);\r\n if (columnCount\r\n && columnCount <= this.getConfig().starOkayIfFewColumns) {\r\n continue;\r\n }\r\n const message = \"Avoid use of SELECT *\";\r\n issues.push(issue_1.Issue.atToken(file, s.getFirstToken(), message, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n findNumberOfColumns(s, file, spaghetti) {\r\n const dbnames = s.findAllExpressions(Expressions.DatabaseTable);\r\n if (dbnames.length === 1) {\r\n const start = dbnames[0].getFirstToken().getStart();\r\n const scope = spaghetti.lookupPosition(start, file.getFilename());\r\n const name = scope === null || scope === void 0 ? void 0 : scope.findTableReference(start);\r\n const tabl = this.reg.getObject(\"TABL\", name);\r\n const parsed = tabl === null || tabl === void 0 ? void 0 : tabl.parseType(this.reg);\r\n if (parsed instanceof structure_type_1.StructureType) {\r\n return parsed.getComponents().length;\r\n }\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.SelectPerformance = SelectPerformance;\r\n//# sourceMappingURL=select_performance.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/select_performance.js?");
|
|
12615
12615
|
|
|
12616
12616
|
/***/ }),
|
|
12617
12617
|
|
|
@@ -12622,7 +12622,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12622
12622
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12623
12623
|
|
|
12624
12624
|
"use strict";
|
|
12625
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SelectionScreenNaming = exports.SelectionScreenNamingConf = void 0;\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _naming_rule_config_1 = __webpack_require__(/*! ./_naming_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_naming_rule_config.js\");\r\nconst statements_1 = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst name_validator_1 = __webpack_require__(/*! ../utils/name_validator */ \"./node_modules/@abaplint/core/build/src/utils/name_validator.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass SelectionScreenNamingConf extends _naming_rule_config_1.NamingRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** The pattern for selection-screen parameters */\r\n this.parameter = \"^P_.+$\";\r\n /** The pattern for selection-screen select-options */\r\n this.selectOption = \"^S_.+$\";\r\n }\r\n}\r\nexports.SelectionScreenNamingConf = SelectionScreenNamingConf;\r\nclass SelectionScreenNaming extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new SelectionScreenNamingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"selection_screen_naming\",\r\n title: \"Selection screen naming conventions\",\r\n shortDescription: `Allows you to enforce a pattern, such as a prefix, for selection-screen variable names.`,\r\n tags: [_irule_1.RuleTag.Naming, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getDescription(expected, actual) {\r\n return this.conf.patternKind === \"required\" ?\r\n `Selection-Screen variable name does not match pattern ${expected}: ${actual}` :\r\n `Selection-Screen variable name must not match pattern ${expected}: ${actual}`;\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n if (this.conf.patternKind === undefined) {\r\n this.conf.patternKind = \"required\";\r\n }\r\n let parameterCheckDisabled = false;\r\n let selectOptionDisabled = false;\r\n if (this.conf.parameter === undefined || this.conf.parameter.length === 0) {\r\n parameterCheckDisabled = true;\r\n }\r\n if (this.conf.selectOption === undefined || this.conf.selectOption.length === 0) {\r\n selectOptionDisabled = true;\r\n }\r\n for (const stat of file.getStatements()) {\r\n if ((stat.get() instanceof statements_1.Parameter && !parameterCheckDisabled)\r\n || (stat.get() instanceof statements_1.SelectOption && !selectOptionDisabled)) {\r\n const fieldNode = this.getFieldForStatementNode(stat);\r\n const regex = new RegExp(this.getPatternForStatement(stat.get()), \"i\");\r\n if (fieldNode && name_validator_1.NameValidator.violatesRule(fieldNode.getFirstToken().getStr(), regex, this.conf)) {\r\n issues.push(issue_1.Issue.atToken(file, fieldNode.getFirstToken(), this.getDescription(this.getPatternForStatement(stat.get()), fieldNode.getFirstToken().getStr()), this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n getPatternForStatement(statement) {\r\n let pattern = \"\";\r\n if (statement instanceof statements_1.Parameter) {\r\n pattern = this.conf.parameter;\r\n }\r\n else if (statement instanceof statements_1.SelectOption) {\r\n pattern = this.conf.selectOption;\r\n }\r\n return pattern;\r\n }\r\n getFieldForStatementNode(statNode) {\r\n if (statNode.get() instanceof statements_1.Parameter) {\r\n return statNode.findFirstExpression(expressions_1.FieldSub);\r\n }\r\n else if (statNode.get() instanceof statements_1.SelectOption) {\r\n return statNode.findFirstExpression(expressions_1.FieldSub);\r\n }\r\n else {\r\n return undefined;\r\n }\r\n }\r\n}\r\nexports.SelectionScreenNaming = SelectionScreenNaming;\r\n//# sourceMappingURL=selection_screen_naming.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/selection_screen_naming.js?");
|
|
12625
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SelectionScreenNaming = exports.SelectionScreenNamingConf = void 0;\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _naming_rule_config_1 = __webpack_require__(/*! ./_naming_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_naming_rule_config.js\");\r\nconst statements_1 = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst name_validator_1 = __webpack_require__(/*! ../utils/name_validator */ \"./node_modules/@abaplint/core/build/src/utils/name_validator.js\");\r\nconst expressions_1 = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass SelectionScreenNamingConf extends _naming_rule_config_1.NamingRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** The pattern for selection-screen parameters */\r\n this.parameter = \"^P_.+$\";\r\n /** The pattern for selection-screen select-options */\r\n this.selectOption = \"^S_.+$\";\r\n /** The pattern for selection-screen screen elements */\r\n this.screenElement = \"^SC_.+$\";\r\n }\r\n}\r\nexports.SelectionScreenNamingConf = SelectionScreenNamingConf;\r\nclass SelectionScreenNaming extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new SelectionScreenNamingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"selection_screen_naming\",\r\n title: \"Selection screen naming conventions\",\r\n shortDescription: `Allows you to enforce a pattern, such as a prefix, for selection-screen variable names.`,\r\n tags: [_irule_1.RuleTag.Naming, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getDescription(expected, actual) {\r\n return this.conf.patternKind === \"required\" ?\r\n `Selection-Screen variable name does not match pattern ${expected}: ${actual}` :\r\n `Selection-Screen variable name must not match pattern ${expected}: ${actual}`;\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n if (this.conf.patternKind === undefined) {\r\n this.conf.patternKind = \"required\";\r\n }\r\n let parameterCheckDisabled = false;\r\n let selectOptionDisabled = false;\r\n let screenElementDisabled = false;\r\n if (this.conf.parameter === undefined || this.conf.parameter.length === 0) {\r\n parameterCheckDisabled = true;\r\n }\r\n if (this.conf.selectOption === undefined || this.conf.selectOption.length === 0) {\r\n selectOptionDisabled = true;\r\n }\r\n if (this.conf.screenElement === undefined || this.conf.screenElement.length === 0) {\r\n screenElementDisabled = true;\r\n }\r\n for (const stat of file.getStatements()) {\r\n if ((stat.get() instanceof statements_1.Parameter && !parameterCheckDisabled)\r\n || (stat.get() instanceof statements_1.SelectOption && !selectOptionDisabled)\r\n || (stat.get() instanceof statements_1.SelectionScreen && !screenElementDisabled)) {\r\n const fieldNode = this.getFieldForStatementNode(stat);\r\n const regex = new RegExp(this.getPatternForStatement(stat.get()), \"i\");\r\n if (fieldNode && name_validator_1.NameValidator.violatesRule(fieldNode.getFirstToken().getStr(), regex, this.conf)) {\r\n issues.push(issue_1.Issue.atToken(file, fieldNode.getFirstToken(), this.getDescription(this.getPatternForStatement(stat.get()), fieldNode.getFirstToken().getStr()), this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n getPatternForStatement(statement) {\r\n let pattern = \"\";\r\n if (statement instanceof statements_1.Parameter) {\r\n pattern = this.conf.parameter;\r\n }\r\n else if (statement instanceof statements_1.SelectOption) {\r\n pattern = this.conf.selectOption;\r\n }\r\n else if (statement instanceof statements_1.SelectionScreen) {\r\n pattern = this.conf.screenElement;\r\n }\r\n return pattern;\r\n }\r\n getFieldForStatementNode(statNode) {\r\n if (statNode.get() instanceof statements_1.Parameter) {\r\n return statNode.findFirstExpression(expressions_1.FieldSub);\r\n }\r\n else if (statNode.get() instanceof statements_1.SelectOption) {\r\n return statNode.findFirstExpression(expressions_1.FieldSub);\r\n }\r\n else if (statNode.get() instanceof statements_1.SelectionScreen) {\r\n return statNode.findFirstExpression(expressions_1.InlineField);\r\n }\r\n else {\r\n return undefined;\r\n }\r\n }\r\n}\r\nexports.SelectionScreenNaming = SelectionScreenNaming;\r\n//# sourceMappingURL=selection_screen_naming.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/selection_screen_naming.js?");
|
|
12626
12626
|
|
|
12627
12627
|
/***/ }),
|
|
12628
12628
|
|
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Junit = void 0;
|
|
4
4
|
const xml_js_1 = require("xml-js");
|
|
5
|
+
const fs = require("fs");
|
|
5
6
|
class Junit {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.currentFilename = "";
|
|
9
|
+
this.currentFileLinesCount = 0;
|
|
10
|
+
this.fileContent = [];
|
|
11
|
+
}
|
|
6
12
|
output(issues, _fileCount) {
|
|
7
13
|
const outputObj = {
|
|
8
14
|
_declaration: {
|
|
@@ -34,10 +40,10 @@ class Junit {
|
|
|
34
40
|
},
|
|
35
41
|
failure: {
|
|
36
42
|
_attributes: {
|
|
37
|
-
message: issue.
|
|
43
|
+
message: this.formatFailureMessage(issue.getMessage()),
|
|
38
44
|
type: issue.getSeverity().toString(),
|
|
39
45
|
},
|
|
40
|
-
_cdata: `${
|
|
46
|
+
_cdata: `${this.renderIssue(issue)}`,
|
|
41
47
|
},
|
|
42
48
|
});
|
|
43
49
|
}
|
|
@@ -53,6 +59,33 @@ class Junit {
|
|
|
53
59
|
const xml = (0, xml_js_1.js2xml)(outputObj, { compact: true, spaces: 2 });
|
|
54
60
|
return xml;
|
|
55
61
|
}
|
|
62
|
+
cacheFile(filename) {
|
|
63
|
+
if (filename !== this.currentFilename) {
|
|
64
|
+
this.currentFilename = filename;
|
|
65
|
+
this.fileContent = fs.readFileSync(filename, "utf8").split(/\r?\n/);
|
|
66
|
+
this.currentFileLinesCount = this.fileContent.length;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
renderIssue(issue) {
|
|
70
|
+
this.cacheFile(issue.getFilename());
|
|
71
|
+
const frameSize = 1;
|
|
72
|
+
const lineFrom = Math.max(issue.getStart().getRow() - frameSize, 1);
|
|
73
|
+
const lineTo = Math.min(issue.getStart().getRow() + frameSize, this.currentFileLinesCount);
|
|
74
|
+
const issueLineIndex = issue.getStart().getRow() - 1;
|
|
75
|
+
const padSize = Math.ceil(Math.log10(lineTo)) + 4;
|
|
76
|
+
const code = [];
|
|
77
|
+
for (let lineIndex = lineFrom - 1; lineIndex < lineTo; lineIndex++) {
|
|
78
|
+
const prefix = `${" "}${lineIndex + 1} |`.padStart(padSize);
|
|
79
|
+
code.push(prefix + this.fileContent[lineIndex]);
|
|
80
|
+
if (lineIndex === issueLineIndex) {
|
|
81
|
+
code.push("|".padStart(padSize) + " ".repeat(issue.getStart().getCol() - 1) + "^");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return code.map(str => str).join("\n");
|
|
85
|
+
}
|
|
86
|
+
formatFailureMessage(message) {
|
|
87
|
+
return message.replace("<", "").replace(">", "");
|
|
88
|
+
}
|
|
56
89
|
}
|
|
57
90
|
exports.Junit = Junit;
|
|
58
91
|
//# sourceMappingURL=junit.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/cli",
|
|
3
|
-
"version": "2.91.
|
|
3
|
+
"version": "2.91.5",
|
|
4
4
|
"description": "abaplint - Command Line Interface",
|
|
5
5
|
"bin": {
|
|
6
6
|
"abaplint": "./abaplint"
|
|
@@ -39,25 +39,25 @@
|
|
|
39
39
|
},
|
|
40
40
|
"homepage": "https://abaplint.org",
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@abaplint/core": "^2.91.
|
|
42
|
+
"@abaplint/core": "^2.91.5",
|
|
43
43
|
"@types/chai": "^4.3.1",
|
|
44
44
|
"@types/glob": "^7.2.0",
|
|
45
45
|
"@types/minimist": "^1.2.2",
|
|
46
46
|
"@types/mocha": "^9.1.1",
|
|
47
|
-
"@types/node": "^
|
|
47
|
+
"@types/node": "^18.0.0",
|
|
48
48
|
"@types/progress": "^2.0.5",
|
|
49
49
|
"chai": "^4.3.6",
|
|
50
50
|
"chalk": "^5.0.1",
|
|
51
|
-
"eslint": "^8.
|
|
51
|
+
"eslint": "^8.18.0",
|
|
52
52
|
"glob": "^7.2.3",
|
|
53
53
|
"json5": "^2.2.1",
|
|
54
|
-
"memfs": "^3.4.
|
|
54
|
+
"memfs": "^3.4.7",
|
|
55
55
|
"minimist": "^1.2.6",
|
|
56
56
|
"mocha": "^10.0.0",
|
|
57
57
|
"progress": "^2.0.3",
|
|
58
|
-
"typescript": "^4.7.
|
|
58
|
+
"typescript": "^4.7.4",
|
|
59
59
|
"webpack": "^5.73.0",
|
|
60
|
-
"webpack-cli": "^4.
|
|
60
|
+
"webpack-cli": "^4.10.0",
|
|
61
61
|
"xml-js": "^1.6.11"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {}
|