@abaplint/cli 2.94.10 → 2.94.12
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/README.md +21 -21
- package/abaplint +2 -2
- package/build/cli.js +84 -84
- package/package.json +62 -62
package/build/cli.js
CHANGED
|
@@ -8849,7 +8849,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
8849
8849
|
/***/ ((__unused_webpack_module, exports) => {
|
|
8850
8850
|
|
|
8851
8851
|
"use strict";
|
|
8852
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FlowGraph = void 0;\r\nclass FlowGraph {\r\n constructor(counter) {\r\n this.edges = {};\r\n this.label = \"undefined\";\r\n this.startNode = \"start#\" + counter;\r\n this.endNode = \"end#\" + counter;\r\n }\r\n getStart() {\r\n return this.startNode;\r\n }\r\n getEnd() {\r\n return this.endNode;\r\n }\r\n addEdge(from, to) {\r\n if (this.edges[from] === undefined) {\r\n this.edges[from] = {};\r\n }\r\n this.edges[from][to] = true;\r\n }\r\n removeEdge(from, to) {\r\n if (this.edges[from] === undefined) {\r\n return;\r\n }\r\n delete this.edges[from][to];\r\n if (Object.keys(this.edges[from]).length === 0) {\r\n delete this.edges[from];\r\n }\r\n }\r\n listEdges() {\r\n const list = [];\r\n for (const from of Object.keys(this.edges)) {\r\n for (const to of Object.keys(this.edges[from])) {\r\n list.push({ from, to });\r\n }\r\n }\r\n return list;\r\n }\r\n listInto(to, skipStart = true) {\r\n const ret = [];\r\n for (const e of this.listEdges()) {\r\n if (skipStart === true && e.from === this.getStart()) {\r\n continue;\r\n }\r\n if (e.to === to) {\r\n ret.push(e.from);\r\n }\r\n }\r\n return ret;\r\n }\r\n listNodes() {\r\n const set = new Set();\r\n for (const l of this.listEdges()) {\r\n set.add(l.from);\r\n set.add(l.to);\r\n }\r\n return Array.from(set.values());\r\n }\r\n hasEdges() {\r\n return Object.keys(this.edges).length > 0;\r\n }\r\n /** return value: end node of to graph */\r\n addGraph(from, to) {\r\n if (to.hasEdges() === false) {\r\n return from;\r\n }\r\n this.addEdge(from, to.getStart());\r\n to.listEdges().forEach(e => this.addEdge(e.from, e.to));\r\n return to.getEnd();\r\n }\r\n toJSON() {\r\n return JSON.stringify(this.edges);\r\n }\r\n toTextEdges() {\r\n let graph = \"\";\r\n for (const l of this.listEdges()) {\r\n graph += `\"${l.from}\" -> \"${l.to}\";\\n`;\r\n }\r\n return graph.trim();\r\n }\r\n setLabel(label) {\r\n this.label = label;\r\n }\r\n toDigraph() {\r\n return `digraph G {\nlabelloc=\"t\";\nlabel=\"${this.label}\";\ngraph [fontname = \"helvetica\"];\nnode [fontname = \"helvetica\", shape=\"box\"];\nedge [fontname = \"helvetica\"];\n${this.toTextEdges()}\n}`;\r\n }\r\n listSources(node) {\r\n const set = new Set();\r\n for (const l of this.listEdges()) {\r\n if (node === l.to) {\r\n set.add(l.from);\r\n }\r\n }\r\n return Array.from(set.values());\r\n }\r\n listTargets(node) {\r\n const set = new Set();\r\n for (const l of this.listEdges()) {\r\n if (node === l.from) {\r\n set.add(l.to);\r\n }\r\n }\r\n return Array.from(set.values());\r\n }\r\n /** removes all nodes containing \"#\" that have one in-going and one out-going edge */\r\n reduce() {\r\n for (const node of this.listNodes()) {\r\n if (node.includes(\"#\") === false) {\r\n continue;\r\n }\r\n const sources = this.listSources(node);\r\n const targets = this.listTargets(node);\r\n if (sources.length > 0 && targets.length > 0) {\r\n // hash node in the middle of the graph\r\n for (const s of sources) {\r\n this.removeEdge(s, node);\r\n }\r\n for (const t of targets) {\r\n this.removeEdge(node, t);\r\n }\r\n for (const s of sources) {\r\n for (const t of targets) {\r\n this.addEdge(s, t);\r\n }\r\n }\r\n }\r\n if (node.startsWith(\"end#\") && sources.length === 0) {\r\n for (const t of targets) {\r\n this.removeEdge(node, t);\r\n }\r\n }\r\n }\r\n return this;\r\n }\r\n}\r\nexports.FlowGraph = FlowGraph;\r\n//# sourceMappingURL=flow_graph.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/flow/flow_graph.js?");
|
|
8852
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FlowGraph = void 0;\r\nclass FlowGraph {\r\n constructor(counter) {\r\n this.edges = {};\r\n this.label = \"undefined\";\r\n this.startNode = \"start#\" + counter;\r\n this.endNode = \"end#\" + counter;\r\n }\r\n getStart() {\r\n return this.startNode;\r\n }\r\n getEnd() {\r\n return this.endNode;\r\n }\r\n addEdge(from, to) {\r\n if (this.edges[from] === undefined) {\r\n this.edges[from] = {};\r\n }\r\n this.edges[from][to] = true;\r\n }\r\n removeEdge(from, to) {\r\n if (this.edges[from] === undefined) {\r\n return;\r\n }\r\n delete this.edges[from][to];\r\n if (Object.keys(this.edges[from]).length === 0) {\r\n delete this.edges[from];\r\n }\r\n }\r\n listEdges() {\r\n const list = [];\r\n for (const from of Object.keys(this.edges)) {\r\n for (const to of Object.keys(this.edges[from])) {\r\n list.push({ from, to });\r\n }\r\n }\r\n return list;\r\n }\r\n listInto(to, skipStart = true) {\r\n const ret = [];\r\n for (const e of this.listEdges()) {\r\n if (skipStart === true && e.from === this.getStart()) {\r\n continue;\r\n }\r\n if (e.to === to) {\r\n ret.push(e.from);\r\n }\r\n }\r\n return ret;\r\n }\r\n listNodes() {\r\n const set = new Set();\r\n for (const l of this.listEdges()) {\r\n set.add(l.from);\r\n set.add(l.to);\r\n }\r\n return Array.from(set.values());\r\n }\r\n hasEdges() {\r\n return Object.keys(this.edges).length > 0;\r\n }\r\n /** return value: end node of to graph */\r\n addGraph(from, to) {\r\n if (to.hasEdges() === false) {\r\n return from;\r\n }\r\n this.addEdge(from, to.getStart());\r\n to.listEdges().forEach(e => this.addEdge(e.from, e.to));\r\n return to.getEnd();\r\n }\r\n toJSON() {\r\n return JSON.stringify(this.edges);\r\n }\r\n toTextEdges() {\r\n let graph = \"\";\r\n for (const l of this.listEdges()) {\r\n graph += `\"${l.from}\" -> \"${l.to}\";\\n`;\r\n }\r\n return graph.trim();\r\n }\r\n setLabel(label) {\r\n this.label = label;\r\n }\r\n toDigraph() {\r\n return `digraph G {\r\nlabelloc=\"t\";\r\nlabel=\"${this.label}\";\r\ngraph [fontname = \"helvetica\"];\r\nnode [fontname = \"helvetica\", shape=\"box\"];\r\nedge [fontname = \"helvetica\"];\r\n${this.toTextEdges()}\r\n}`;\r\n }\r\n listSources(node) {\r\n const set = new Set();\r\n for (const l of this.listEdges()) {\r\n if (node === l.to) {\r\n set.add(l.from);\r\n }\r\n }\r\n return Array.from(set.values());\r\n }\r\n listTargets(node) {\r\n const set = new Set();\r\n for (const l of this.listEdges()) {\r\n if (node === l.from) {\r\n set.add(l.to);\r\n }\r\n }\r\n return Array.from(set.values());\r\n }\r\n /** removes all nodes containing \"#\" that have one in-going and one out-going edge */\r\n reduce() {\r\n for (const node of this.listNodes()) {\r\n if (node.includes(\"#\") === false) {\r\n continue;\r\n }\r\n const sources = this.listSources(node);\r\n const targets = this.listTargets(node);\r\n if (sources.length > 0 && targets.length > 0) {\r\n // hash node in the middle of the graph\r\n for (const s of sources) {\r\n this.removeEdge(s, node);\r\n }\r\n for (const t of targets) {\r\n this.removeEdge(node, t);\r\n }\r\n for (const s of sources) {\r\n for (const t of targets) {\r\n this.addEdge(s, t);\r\n }\r\n }\r\n }\r\n if (node.startsWith(\"end#\") && sources.length === 0) {\r\n for (const t of targets) {\r\n this.removeEdge(node, t);\r\n }\r\n }\r\n }\r\n return this;\r\n }\r\n}\r\nexports.FlowGraph = FlowGraph;\r\n//# sourceMappingURL=flow_graph.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/flow/flow_graph.js?");
|
|
8853
8853
|
|
|
8854
8854
|
/***/ }),
|
|
8855
8855
|
|
|
@@ -10202,7 +10202,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
10202
10202
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
10203
10203
|
|
|
10204
10204
|
"use strict";
|
|
10205
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Help = void 0;\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst _lsp_utils_1 = __webpack_require__(/*! ./_lsp_utils */ \"./node_modules/@abaplint/core/build/src/lsp/_lsp_utils.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst dump_scope_1 = __webpack_require__(/*! ./dump_scope */ \"./node_modules/@abaplint/core/build/src/lsp/dump_scope.js\");\r\nclass Help {\r\n static find(reg, textDocument, position) {\r\n const file = _lsp_utils_1.LSPUtils.getABAPFile(reg, textDocument.uri);\r\n if (file === undefined) {\r\n return \"file not found\";\r\n }\r\n else {\r\n return this.dumpABAP(file, reg, textDocument, position);\r\n }\r\n }\r\n /////////////////////////////////////////////////\r\n static dumpABAP(file, reg, textDocument, position) {\r\n let content = \"\";\r\n content = `\n <a href=\"#_tokens\" rel=\"no-refresh\">Tokens</a> |\n <a href=\"#_statements\" rel=\"no-refresh\">Statements</a> |\n <a href=\"#_structure\" rel=\"no-refresh\">Structure</a> |\n <a href=\"#_files\" rel=\"no-refresh\">Files</a> |\n <a href=\"#_info\" rel=\"no-refresh\">Info Dump</a>\n <hr>\n ` +\r\n \"<tt>\" + textDocument.uri + \" (\" +\r\n (position.line + 1) + \", \" +\r\n (position.character + 1) + \")</tt>\";\r\n content = content + \"<hr>\";\r\n content = content + this.cursorInformation(reg, textDocument, position, file);\r\n content = content + this.fileInformation(file);\r\n content = content + \"<hr>\";\r\n content = content + this.dumpFiles(reg);\r\n content = content + \"<hr>\";\r\n content = content + this.dumpInfo(file);\r\n return content;\r\n }\r\n static dumpInfo(file) {\r\n const info = file.getInfo();\r\n const dump = {\r\n classDefinitions: info.listClassDefinitions(),\r\n classImplementations: info.listClassImplementations(),\r\n interfaceDefinitions: info.listInterfaceDefinitions(),\r\n forms: info.listFormDefinitions(),\r\n };\r\n const text = JSON.stringify(dump, null, 2);\r\n return `<h3 id=\"_info\">Info Dump</h3><pre>` + text + \"</pre>\";\r\n }\r\n static cursorInformation(reg, textDocument, position, file) {\r\n let ret = \"\";\r\n const found = _lsp_utils_1.LSPUtils.findCursor(reg, { textDocument, position });\r\n if (found !== undefined) {\r\n ret = \"Statement: \" + this.linkToStatement(found.snode.get()) + \"<br>\\n\" +\r\n \"Token: \" + found.token.constructor.name + \"<br>\\n\" +\r\n this.fullPath(file, found.token).value;\r\n }\r\n else {\r\n ret = \"No token found at cursor position\";\r\n }\r\n const obj = reg.getObject(file.getObjectType(), file.getObjectName());\r\n if (obj instanceof _abap_object_1.ABAPObject) {\r\n const spaghetti = new syntax_1.SyntaxLogic(reg, obj).run().spaghetti;\r\n ret = ret + dump_scope_1.DumpScope.dump(spaghetti);\r\n if (found !== undefined) {\r\n ret = ret + \"<hr>Spaghetti Scope by Cursor Position:<br><br>\\n\";\r\n const lookup = spaghetti.lookupPosition(found.token.getStart(), textDocument.uri);\r\n if (lookup) {\r\n const identifier = lookup.getIdentifier();\r\n ret = ret + \"<u>\" + identifier.stype + \", <tt>\" + identifier.sname + \"</tt>, \" + identifier.filename;\r\n ret = ret + \", (\" + identifier.start.getRow() + \", \" + identifier.start.getCol() + \")</u><br>\";\r\n }\r\n else {\r\n ret = ret + \"Not found\";\r\n }\r\n }\r\n }\r\n return ret;\r\n }\r\n static fullPath(file, token) {\r\n const structure = file.getStructure();\r\n if (structure === undefined) {\r\n return { value: \"\", keyword: false };\r\n }\r\n const found = this.traverse(structure, \"\", token);\r\n if (found === undefined) {\r\n return { value: \"\", keyword: false };\r\n }\r\n return { value: \"\\n\\n\" + found.value, keyword: found.keyword };\r\n }\r\n static traverse(node, parents, search) {\r\n let local = parents;\r\n if (local !== \"\") {\r\n local = local + \" -> \";\r\n }\r\n if (node instanceof nodes_1.StructureNode) {\r\n local = local + \"Structure: \" + this.linkToStructure(node.get());\r\n }\r\n else if (node instanceof nodes_1.StatementNode) {\r\n local = local + \"Statement: \" + this.linkToStatement(node.get());\r\n }\r\n else if (node instanceof nodes_1.ExpressionNode) {\r\n local = local + \"Expression: \" + this.linkToExpression(node.get());\r\n }\r\n else if (node instanceof nodes_1.TokenNode) {\r\n local = local + \"Token: \" + node.get().constructor.name;\r\n const token = node.get();\r\n if (token.getStr() === search.getStr()\r\n && token.getCol() === search.getCol()\r\n && token.getRow() === search.getRow()) {\r\n const keyword = !(node instanceof nodes_1.TokenNodeRegex);\r\n return { value: local, keyword };\r\n }\r\n }\r\n else {\r\n throw new Error(\"hover, traverse, unexpected node type\");\r\n }\r\n for (const child of node.getChildren()) {\r\n const ret = this.traverse(child, local, search);\r\n if (ret) {\r\n return ret;\r\n }\r\n }\r\n return undefined;\r\n }\r\n static fileInformation(file) {\r\n let content = \"\";\r\n content = content + `<hr><h3 id=\"_tokens\">Tokens</h3>\\n`;\r\n content = content + this.tokens(file);\r\n content = content + `<hr><h3 id=\"_statements\">Statements</h3>\\n`;\r\n content = content + this.buildStatements(file);\r\n content = content + `<hr><h3 id=\"_structure\">Structure</h3>\\n`;\r\n const structure = file.getStructure();\r\n if (structure !== undefined) {\r\n content = content + this.buildStructure([structure]);\r\n }\r\n else {\r\n content = content + \"structure undefined\";\r\n }\r\n return content;\r\n }\r\n static escape(str) {\r\n str = str.replace(/&/g, \"&\");\r\n str = str.replace(/>/g, \">\");\r\n str = str.replace(/</g, \"<\");\r\n str = str.replace(/\"/g, \""\");\r\n str = str.replace(/'/g, \"'\");\r\n return str;\r\n }\r\n static linkToStatement(statement) {\r\n return `<a href=\"https://syntax.abaplint.org/#/statement/${statement.constructor.name}\" target=\"_blank\">${statement.constructor.name}</a>\\n`;\r\n }\r\n static linkToStructure(structure) {\r\n return `<a href=\"https://syntax.abaplint.org/#/structure/${structure.constructor.name}\" target=\"_blank\">${structure.constructor.name}</a>\\n`;\r\n }\r\n static linkToExpression(expression) {\r\n return `<a href=\"https://syntax.abaplint.org/#/expression/${expression.constructor.name}\" target=\"_blank\">${expression.constructor.name}</a>\\n`;\r\n }\r\n static outputNodes(nodes) {\r\n let ret = \"<ul>\";\r\n for (const node of nodes) {\r\n let extra = \"\";\r\n switch (node.constructor.name) {\r\n case \"TokenNode\":\r\n case \"TokenNodeRegex\":\r\n extra = node.get().constructor.name + \", \\\"\" + node.get().getStr() + \"\\\"\";\r\n break;\r\n case \"ExpressionNode\":\r\n extra = this.linkToExpression(node.get()) + this.outputNodes(node.getChildren());\r\n break;\r\n default:\r\n break;\r\n }\r\n ret = ret + \"<li>\" + node.constructor.name + \", \" + extra + \"</li>\";\r\n }\r\n return ret + \"</ul>\";\r\n }\r\n static tokens(file) {\r\n let inner = \"<table><tr><td><b>String</b></td><td><b>Type</b></td><td><b>Row</b></td><td><b>Column</b></td></tr>\";\r\n for (const token of file.getTokens()) {\r\n inner = inner + \"<tr><td><tt>\" +\r\n this.escape(token.getStr()) + \"</tt></td><td>\" +\r\n token.constructor.name + \"</td><td align=\\\"right\\\">\" +\r\n token.getRow() + \"</td><td align=\\\"right\\\">\" +\r\n token.getCol() + \"</td></tr>\";\r\n }\r\n inner = inner + \"</table>\";\r\n return inner;\r\n }\r\n static buildStatements(file) {\r\n let output = \"\";\r\n for (const statement of file.getStatements()) {\r\n const row = statement.getStart().getRow();\r\n // getting the class name only works if uglify does not mangle names\r\n output = output +\r\n row + \": \" +\r\n this.linkToStatement(statement.get()) +\r\n \"</div></b>\\n\" + this.outputNodes(statement.getChildren());\r\n }\r\n return output;\r\n }\r\n static buildStructure(nodes) {\r\n let output = \"<ul>\";\r\n for (const node of nodes) {\r\n if (node instanceof nodes_1.StructureNode) {\r\n output = output + \"<li>\" + this.linkToStructure(node.get()) + \", Structure \" + this.buildStructure(node.getChildren()) + \"</li>\";\r\n }\r\n else if (node instanceof nodes_1.StatementNode) {\r\n output = output + \"<li>\" + this.linkToStatement(node.get()) + \", Statement</li>\";\r\n }\r\n }\r\n return output + \"</ul>\";\r\n }\r\n static dumpFiles(reg) {\r\n let output = `<h3 id=\"_files\">Files</h3><table>\\n`;\r\n for (const o of reg.getObjects()) {\r\n if (reg.isDependency(o) === true) {\r\n continue;\r\n }\r\n output = output + \"<tr><td valign=\\\"top\\\">\" + o.getType() + \" \" + o.getName() + \"</td><td>\";\r\n for (const f of o.getFiles()) {\r\n output = output + f.getFilename() + \"<br>\";\r\n }\r\n output = output + \"</td></tr>\\n\";\r\n }\r\n return output + \"</table>\\n\";\r\n }\r\n}\r\nexports.Help = Help;\r\n//# sourceMappingURL=help.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/lsp/help.js?");
|
|
10205
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Help = void 0;\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst _lsp_utils_1 = __webpack_require__(/*! ./_lsp_utils */ \"./node_modules/@abaplint/core/build/src/lsp/_lsp_utils.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst dump_scope_1 = __webpack_require__(/*! ./dump_scope */ \"./node_modules/@abaplint/core/build/src/lsp/dump_scope.js\");\r\nclass Help {\r\n static find(reg, textDocument, position) {\r\n const file = _lsp_utils_1.LSPUtils.getABAPFile(reg, textDocument.uri);\r\n if (file === undefined) {\r\n return \"file not found\";\r\n }\r\n else {\r\n return this.dumpABAP(file, reg, textDocument, position);\r\n }\r\n }\r\n /////////////////////////////////////////////////\r\n static dumpABAP(file, reg, textDocument, position) {\r\n let content = \"\";\r\n content = `\r\n <a href=\"#_tokens\" rel=\"no-refresh\">Tokens</a> |\r\n <a href=\"#_statements\" rel=\"no-refresh\">Statements</a> |\r\n <a href=\"#_structure\" rel=\"no-refresh\">Structure</a> |\r\n <a href=\"#_files\" rel=\"no-refresh\">Files</a> |\r\n <a href=\"#_info\" rel=\"no-refresh\">Info Dump</a>\r\n <hr>\r\n ` +\r\n \"<tt>\" + textDocument.uri + \" (\" +\r\n (position.line + 1) + \", \" +\r\n (position.character + 1) + \")</tt>\";\r\n content = content + \"<hr>\";\r\n content = content + this.cursorInformation(reg, textDocument, position, file);\r\n content = content + this.fileInformation(file);\r\n content = content + \"<hr>\";\r\n content = content + this.dumpFiles(reg);\r\n content = content + \"<hr>\";\r\n content = content + this.dumpInfo(file);\r\n return content;\r\n }\r\n static dumpInfo(file) {\r\n const info = file.getInfo();\r\n const dump = {\r\n classDefinitions: info.listClassDefinitions(),\r\n classImplementations: info.listClassImplementations(),\r\n interfaceDefinitions: info.listInterfaceDefinitions(),\r\n forms: info.listFormDefinitions(),\r\n };\r\n const text = JSON.stringify(dump, null, 2);\r\n return `<h3 id=\"_info\">Info Dump</h3><pre>` + text + \"</pre>\";\r\n }\r\n static cursorInformation(reg, textDocument, position, file) {\r\n let ret = \"\";\r\n const found = _lsp_utils_1.LSPUtils.findCursor(reg, { textDocument, position });\r\n if (found !== undefined) {\r\n ret = \"Statement: \" + this.linkToStatement(found.snode.get()) + \"<br>\\n\" +\r\n \"Token: \" + found.token.constructor.name + \"<br>\\n\" +\r\n this.fullPath(file, found.token).value;\r\n }\r\n else {\r\n ret = \"No token found at cursor position\";\r\n }\r\n const obj = reg.getObject(file.getObjectType(), file.getObjectName());\r\n if (obj instanceof _abap_object_1.ABAPObject) {\r\n const spaghetti = new syntax_1.SyntaxLogic(reg, obj).run().spaghetti;\r\n ret = ret + dump_scope_1.DumpScope.dump(spaghetti);\r\n if (found !== undefined) {\r\n ret = ret + \"<hr>Spaghetti Scope by Cursor Position:<br><br>\\n\";\r\n const lookup = spaghetti.lookupPosition(found.token.getStart(), textDocument.uri);\r\n if (lookup) {\r\n const identifier = lookup.getIdentifier();\r\n ret = ret + \"<u>\" + identifier.stype + \", <tt>\" + identifier.sname + \"</tt>, \" + identifier.filename;\r\n ret = ret + \", (\" + identifier.start.getRow() + \", \" + identifier.start.getCol() + \")</u><br>\";\r\n }\r\n else {\r\n ret = ret + \"Not found\";\r\n }\r\n }\r\n }\r\n return ret;\r\n }\r\n static fullPath(file, token) {\r\n const structure = file.getStructure();\r\n if (structure === undefined) {\r\n return { value: \"\", keyword: false };\r\n }\r\n const found = this.traverse(structure, \"\", token);\r\n if (found === undefined) {\r\n return { value: \"\", keyword: false };\r\n }\r\n return { value: \"\\n\\n\" + found.value, keyword: found.keyword };\r\n }\r\n static traverse(node, parents, search) {\r\n let local = parents;\r\n if (local !== \"\") {\r\n local = local + \" -> \";\r\n }\r\n if (node instanceof nodes_1.StructureNode) {\r\n local = local + \"Structure: \" + this.linkToStructure(node.get());\r\n }\r\n else if (node instanceof nodes_1.StatementNode) {\r\n local = local + \"Statement: \" + this.linkToStatement(node.get());\r\n }\r\n else if (node instanceof nodes_1.ExpressionNode) {\r\n local = local + \"Expression: \" + this.linkToExpression(node.get());\r\n }\r\n else if (node instanceof nodes_1.TokenNode) {\r\n local = local + \"Token: \" + node.get().constructor.name;\r\n const token = node.get();\r\n if (token.getStr() === search.getStr()\r\n && token.getCol() === search.getCol()\r\n && token.getRow() === search.getRow()) {\r\n const keyword = !(node instanceof nodes_1.TokenNodeRegex);\r\n return { value: local, keyword };\r\n }\r\n }\r\n else {\r\n throw new Error(\"hover, traverse, unexpected node type\");\r\n }\r\n for (const child of node.getChildren()) {\r\n const ret = this.traverse(child, local, search);\r\n if (ret) {\r\n return ret;\r\n }\r\n }\r\n return undefined;\r\n }\r\n static fileInformation(file) {\r\n let content = \"\";\r\n content = content + `<hr><h3 id=\"_tokens\">Tokens</h3>\\n`;\r\n content = content + this.tokens(file);\r\n content = content + `<hr><h3 id=\"_statements\">Statements</h3>\\n`;\r\n content = content + this.buildStatements(file);\r\n content = content + `<hr><h3 id=\"_structure\">Structure</h3>\\n`;\r\n const structure = file.getStructure();\r\n if (structure !== undefined) {\r\n content = content + this.buildStructure([structure]);\r\n }\r\n else {\r\n content = content + \"structure undefined\";\r\n }\r\n return content;\r\n }\r\n static escape(str) {\r\n str = str.replace(/&/g, \"&\");\r\n str = str.replace(/>/g, \">\");\r\n str = str.replace(/</g, \"<\");\r\n str = str.replace(/\"/g, \""\");\r\n str = str.replace(/'/g, \"'\");\r\n return str;\r\n }\r\n static linkToStatement(statement) {\r\n return `<a href=\"https://syntax.abaplint.org/#/statement/${statement.constructor.name}\" target=\"_blank\">${statement.constructor.name}</a>\\n`;\r\n }\r\n static linkToStructure(structure) {\r\n return `<a href=\"https://syntax.abaplint.org/#/structure/${structure.constructor.name}\" target=\"_blank\">${structure.constructor.name}</a>\\n`;\r\n }\r\n static linkToExpression(expression) {\r\n return `<a href=\"https://syntax.abaplint.org/#/expression/${expression.constructor.name}\" target=\"_blank\">${expression.constructor.name}</a>\\n`;\r\n }\r\n static outputNodes(nodes) {\r\n let ret = \"<ul>\";\r\n for (const node of nodes) {\r\n let extra = \"\";\r\n switch (node.constructor.name) {\r\n case \"TokenNode\":\r\n case \"TokenNodeRegex\":\r\n extra = node.get().constructor.name + \", \\\"\" + node.get().getStr() + \"\\\"\";\r\n break;\r\n case \"ExpressionNode\":\r\n extra = this.linkToExpression(node.get()) + this.outputNodes(node.getChildren());\r\n break;\r\n default:\r\n break;\r\n }\r\n ret = ret + \"<li>\" + node.constructor.name + \", \" + extra + \"</li>\";\r\n }\r\n return ret + \"</ul>\";\r\n }\r\n static tokens(file) {\r\n let inner = \"<table><tr><td><b>String</b></td><td><b>Type</b></td><td><b>Row</b></td><td><b>Column</b></td></tr>\";\r\n for (const token of file.getTokens()) {\r\n inner = inner + \"<tr><td><tt>\" +\r\n this.escape(token.getStr()) + \"</tt></td><td>\" +\r\n token.constructor.name + \"</td><td align=\\\"right\\\">\" +\r\n token.getRow() + \"</td><td align=\\\"right\\\">\" +\r\n token.getCol() + \"</td></tr>\";\r\n }\r\n inner = inner + \"</table>\";\r\n return inner;\r\n }\r\n static buildStatements(file) {\r\n let output = \"\";\r\n for (const statement of file.getStatements()) {\r\n const row = statement.getStart().getRow();\r\n // getting the class name only works if uglify does not mangle names\r\n output = output +\r\n row + \": \" +\r\n this.linkToStatement(statement.get()) +\r\n \"</div></b>\\n\" + this.outputNodes(statement.getChildren());\r\n }\r\n return output;\r\n }\r\n static buildStructure(nodes) {\r\n let output = \"<ul>\";\r\n for (const node of nodes) {\r\n if (node instanceof nodes_1.StructureNode) {\r\n output = output + \"<li>\" + this.linkToStructure(node.get()) + \", Structure \" + this.buildStructure(node.getChildren()) + \"</li>\";\r\n }\r\n else if (node instanceof nodes_1.StatementNode) {\r\n output = output + \"<li>\" + this.linkToStatement(node.get()) + \", Statement</li>\";\r\n }\r\n }\r\n return output + \"</ul>\";\r\n }\r\n static dumpFiles(reg) {\r\n let output = `<h3 id=\"_files\">Files</h3><table>\\n`;\r\n for (const o of reg.getObjects()) {\r\n if (reg.isDependency(o) === true) {\r\n continue;\r\n }\r\n output = output + \"<tr><td valign=\\\"top\\\">\" + o.getType() + \" \" + o.getName() + \"</td><td>\";\r\n for (const f of o.getFiles()) {\r\n output = output + f.getFilename() + \"<br>\";\r\n }\r\n output = output + \"</td></tr>\\n\";\r\n }\r\n return output + \"</table>\\n\";\r\n }\r\n}\r\nexports.Help = Help;\r\n//# sourceMappingURL=help.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/lsp/help.js?");
|
|
10206
10206
|
|
|
10207
10207
|
/***/ }),
|
|
10208
10208
|
|
|
@@ -11709,7 +11709,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11709
11709
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11710
11710
|
|
|
11711
11711
|
"use strict";
|
|
11712
|
-
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 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 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\");\nconst rules_runner_1 = __webpack_require__(/*! ./rules_runner */ \"./node_modules/@abaplint/core/build/src/rules_runner.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 this.dependencies = {};\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.94.10\";\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 // todo: performance? cache regexp?\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, dependency) {\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 let found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n if (dependency === false && found && this.isDependency(found)) {\n this.removeDependency(found);\n found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n }\n found.addFile(f);\n }\n return this;\n }\n addFiles(files) {\n this._addFiles(files, false);\n return this;\n }\n addDependencies(files) {\n for (const f of files) {\n this.addDependency(f);\n }\n return this;\n }\n addDependency(file) {\n var _a;\n const type = (_a = file.getObjectType()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\n if (type === undefined) {\n return this;\n }\n const name = file.getObjectName().toUpperCase();\n if (this.dependencies[type] === undefined) {\n this.dependencies[type] = {};\n }\n this.dependencies[type][name] = true;\n this._addFiles([file], true);\n return this;\n }\n removeDependency(obj) {\n var _a;\n (_a = this.dependencies[obj.getType()]) === null || _a === void 0 ? true : delete _a[obj.getName()];\n this.removeObject(obj);\n }\n isDependency(obj) {\n var _a;\n return ((_a = this.dependencies[obj.getType()]) === null || _a === void 0 ? void 0 : _a[obj.getName()]) === true;\n }\n isFileDependency(filename) {\n var _a, _b;\n const f = this.getFileByName(filename);\n if (f === undefined) {\n return false;\n }\n const type = (_a = f.getObjectType()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\n if (type === undefined) {\n return false;\n }\n const name = f.getObjectName().toUpperCase();\n return ((_b = this.dependencies[type]) === null || _b === void 0 ? void 0 : _b[name]) === 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 new rules_runner_1.RulesRunner(this).runRules(this.getObjects(), 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 new rules_runner_1.RulesRunner(this).runRules([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 for (const o of this.getObjects()) {\n this.parsePrivate(o);\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 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 }\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 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?");
|
|
11712
|
+
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 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 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\");\nconst rules_runner_1 = __webpack_require__(/*! ./rules_runner */ \"./node_modules/@abaplint/core/build/src/rules_runner.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 this.dependencies = {};\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.94.12\";\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 // todo: performance? cache regexp?\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, dependency) {\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 let found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n if (dependency === false && found && this.isDependency(found)) {\n this.removeDependency(found);\n found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n }\n found.addFile(f);\n }\n return this;\n }\n addFiles(files) {\n this._addFiles(files, false);\n return this;\n }\n addDependencies(files) {\n for (const f of files) {\n this.addDependency(f);\n }\n return this;\n }\n addDependency(file) {\n var _a;\n const type = (_a = file.getObjectType()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\n if (type === undefined) {\n return this;\n }\n const name = file.getObjectName().toUpperCase();\n if (this.dependencies[type] === undefined) {\n this.dependencies[type] = {};\n }\n this.dependencies[type][name] = true;\n this._addFiles([file], true);\n return this;\n }\n removeDependency(obj) {\n var _a;\n (_a = this.dependencies[obj.getType()]) === null || _a === void 0 ? true : delete _a[obj.getName()];\n this.removeObject(obj);\n }\n isDependency(obj) {\n var _a;\n return ((_a = this.dependencies[obj.getType()]) === null || _a === void 0 ? void 0 : _a[obj.getName()]) === true;\n }\n isFileDependency(filename) {\n var _a, _b;\n const f = this.getFileByName(filename);\n if (f === undefined) {\n return false;\n }\n const type = (_a = f.getObjectType()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\n if (type === undefined) {\n return false;\n }\n const name = f.getObjectName().toUpperCase();\n return ((_b = this.dependencies[type]) === null || _b === void 0 ? void 0 : _b[name]) === 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 new rules_runner_1.RulesRunner(this).runRules(this.getObjects(), 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 new rules_runner_1.RulesRunner(this).runRules([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 for (const o of this.getObjects()) {\n this.parsePrivate(o);\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 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 }\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 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?");
|
|
11713
11713
|
|
|
11714
11714
|
/***/ }),
|
|
11715
11715
|
|
|
@@ -11720,7 +11720,7 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
11720
11720
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11721
11721
|
|
|
11722
11722
|
"use strict";
|
|
11723
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SevenBitAscii = exports.SevenBitAsciiConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass SevenBitAsciiConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.SevenBitAsciiConf = SevenBitAsciiConf;\r\nclass SevenBitAscii {\r\n constructor() {\r\n this.conf = new SevenBitAsciiConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"7bit_ascii\",\r\n title: \"Check for 7bit ascii\",\r\n shortDescription: `Only allow characters from the 7bit ASCII set.`,\r\n extendedInformation: `https://docs.abapopenchecks.org/checks/05/\n\nCheckes files with extension \".abap\" and \".asddls\"`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n initialize(_reg) {\r\n return this;\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 run(obj) {\r\n const output = [];\r\n for (const file of obj.getFiles()) {\r\n const filename = file.getFilename();\r\n if (filename.endsWith(\".abap\") || filename.endsWith(\".asddls\")) {\r\n const rows = file.getRawRows();\r\n for (let i = 0; i < rows.length; i++) {\r\n const found = /[\\u007f-\\uffff]/.exec(rows[i]);\r\n if (found !== null) {\r\n const column = found.index + 1;\r\n const start = new position_1.Position(i + 1, column);\r\n const end = new position_1.Position(i + 1, column + 1);\r\n const message = \"Contains non 7 bit ascii character\";\r\n const issue = issue_1.Issue.atRange(file, start, end, message, this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n // method getRawRows() splits by newline, so the carraige return\r\n // should always be last character if present\r\n const carriage = /\\r.+$/.exec(rows[i]);\r\n if (carriage !== null) {\r\n const column = carriage.index + 1;\r\n const start = new position_1.Position(i + 1, column);\r\n const end = new position_1.Position(i + 1, column + 1);\r\n const message = \"Dangling carriage return\";\r\n const issue = issue_1.Issue.atRange(file, start, end, message, this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n }\r\n }\r\n }\r\n return output;\r\n }\r\n}\r\nexports.SevenBitAscii = SevenBitAscii;\r\n//# sourceMappingURL=7bit_ascii.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/7bit_ascii.js?");
|
|
11723
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SevenBitAscii = exports.SevenBitAsciiConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass SevenBitAsciiConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.SevenBitAsciiConf = SevenBitAsciiConf;\r\nclass SevenBitAscii {\r\n constructor() {\r\n this.conf = new SevenBitAsciiConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"7bit_ascii\",\r\n title: \"Check for 7bit ascii\",\r\n shortDescription: `Only allow characters from the 7bit ASCII set.`,\r\n extendedInformation: `https://docs.abapopenchecks.org/checks/05/\r\n\r\nCheckes files with extension \".abap\" and \".asddls\"`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n initialize(_reg) {\r\n return this;\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 run(obj) {\r\n const output = [];\r\n for (const file of obj.getFiles()) {\r\n const filename = file.getFilename();\r\n if (filename.endsWith(\".abap\") || filename.endsWith(\".asddls\")) {\r\n const rows = file.getRawRows();\r\n for (let i = 0; i < rows.length; i++) {\r\n const found = /[\\u007f-\\uffff]/.exec(rows[i]);\r\n if (found !== null) {\r\n const column = found.index + 1;\r\n const start = new position_1.Position(i + 1, column);\r\n const end = new position_1.Position(i + 1, column + 1);\r\n const message = \"Contains non 7 bit ascii character\";\r\n const issue = issue_1.Issue.atRange(file, start, end, message, this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n // method getRawRows() splits by newline, so the carraige return\r\n // should always be last character if present\r\n const carriage = /\\r.+$/.exec(rows[i]);\r\n if (carriage !== null) {\r\n const column = carriage.index + 1;\r\n const start = new position_1.Position(i + 1, column);\r\n const end = new position_1.Position(i + 1, column + 1);\r\n const message = \"Dangling carriage return\";\r\n const issue = issue_1.Issue.atRange(file, start, end, message, this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n }\r\n }\r\n }\r\n return output;\r\n }\r\n}\r\nexports.SevenBitAscii = SevenBitAscii;\r\n//# sourceMappingURL=7bit_ascii.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/7bit_ascii.js?");
|
|
11724
11724
|
|
|
11725
11725
|
/***/ }),
|
|
11726
11726
|
|
|
@@ -11775,7 +11775,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11775
11775
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11776
11776
|
|
|
11777
11777
|
"use strict";
|
|
11778
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Abapdoc = exports.AbapdocConf = void 0;\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 issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst visibility_1 = __webpack_require__(/*! ../abap/4_file_information/visibility */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass AbapdocConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Check local classes and interfaces for abapdoc. */\r\n this.checkLocal = false;\r\n this.classDefinition = false;\r\n this.interfaceDefinition = false;\r\n }\r\n}\r\nexports.AbapdocConf = AbapdocConf;\r\nclass Abapdoc extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new AbapdocConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"abapdoc\",\r\n title: \"Check abapdoc\",\r\n shortDescription: `Various checks regarding abapdoc.\nBase rule checks for existence of abapdoc for public class methods and all interface methods.\n\nPlus class and interface definitions.`,\r\n tags: [_irule_1.RuleTag.SingleFile],\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;\r\n const issues = [];\r\n const rows = file.getRawRows();\r\n let methods = [];\r\n for (const classDef of file.getInfo().listClassDefinitions()) {\r\n if (this.conf.checkLocal === false && classDef.isLocal === true) {\r\n continue;\r\n }\r\n methods = methods.concat(classDef.methods.filter(m => m.visibility === visibility_1.Visibility.Public));\r\n if (this.getConfig().classDefinition === true) {\r\n const previousRow = classDef.identifier.getStart().getRow() - 2;\r\n if (((_a = rows[previousRow]) === null || _a === void 0 ? void 0 : _a.trim().substring(0, 2)) !== \"\\\"!\") {\r\n const message = \"Missing ABAP Doc for class \" + classDef.identifier.getToken().getStr();\r\n const issue = issue_1.Issue.atIdentifier(classDef.identifier, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n for (const interfaceDef of file.getInfo().listInterfaceDefinitions()) {\r\n if (this.conf.checkLocal === false && interfaceDef.isLocal === true) {\r\n continue;\r\n }\r\n methods = methods.concat(interfaceDef.methods);\r\n if (this.getConfig().interfaceDefinition === true) {\r\n const previousRow = interfaceDef.identifier.getStart().getRow() - 2;\r\n if (((_b = rows[previousRow]) === null || _b === void 0 ? void 0 : _b.trim().substring(0, 2)) !== \"\\\"!\") {\r\n const message = \"Missing ABAP Doc for interface \" + interfaceDef.identifier.getToken().getStr();\r\n const issue = issue_1.Issue.atIdentifier(interfaceDef.identifier, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n for (const method of methods) {\r\n if (method.isRedefinition === true) {\r\n continue;\r\n }\r\n const previousRowText = this.getPreviousRow(rows, method.identifier.getStart());\r\n if (!(previousRowText.substring(0, 2) === \"\\\"!\")) {\r\n const message = \"Missing ABAP Doc for method \" + method.identifier.getToken().getStr();\r\n const issue = issue_1.Issue.atIdentifier(method.identifier, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n getPreviousRow(rows, pos) {\r\n const previousRow = pos.getRow() - 2;\r\n const text = rows[previousRow].trim().toUpperCase();\r\n if (text === \"METHODS\" || text === \"CLASS-METHODS\") {\r\n const previousRow = pos.getRow() - 3;\r\n const text = rows[previousRow].trim().toUpperCase();\r\n return text;\r\n }\r\n return text;\r\n }\r\n}\r\nexports.Abapdoc = Abapdoc;\r\n//# sourceMappingURL=abapdoc.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/abapdoc.js?");
|
|
11778
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Abapdoc = exports.AbapdocConf = void 0;\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 issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst visibility_1 = __webpack_require__(/*! ../abap/4_file_information/visibility */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass AbapdocConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Check local classes and interfaces for abapdoc. */\r\n this.checkLocal = false;\r\n this.classDefinition = false;\r\n this.interfaceDefinition = false;\r\n }\r\n}\r\nexports.AbapdocConf = AbapdocConf;\r\nclass Abapdoc extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new AbapdocConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"abapdoc\",\r\n title: \"Check abapdoc\",\r\n shortDescription: `Various checks regarding abapdoc.\r\nBase rule checks for existence of abapdoc for public class methods and all interface methods.\r\n\r\nPlus class and interface definitions.`,\r\n tags: [_irule_1.RuleTag.SingleFile],\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;\r\n const issues = [];\r\n const rows = file.getRawRows();\r\n let methods = [];\r\n for (const classDef of file.getInfo().listClassDefinitions()) {\r\n if (this.conf.checkLocal === false && classDef.isLocal === true) {\r\n continue;\r\n }\r\n methods = methods.concat(classDef.methods.filter(m => m.visibility === visibility_1.Visibility.Public));\r\n if (this.getConfig().classDefinition === true) {\r\n const previousRow = classDef.identifier.getStart().getRow() - 2;\r\n if (((_a = rows[previousRow]) === null || _a === void 0 ? void 0 : _a.trim().substring(0, 2)) !== \"\\\"!\") {\r\n const message = \"Missing ABAP Doc for class \" + classDef.identifier.getToken().getStr();\r\n const issue = issue_1.Issue.atIdentifier(classDef.identifier, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n for (const interfaceDef of file.getInfo().listInterfaceDefinitions()) {\r\n if (this.conf.checkLocal === false && interfaceDef.isLocal === true) {\r\n continue;\r\n }\r\n methods = methods.concat(interfaceDef.methods);\r\n if (this.getConfig().interfaceDefinition === true) {\r\n const previousRow = interfaceDef.identifier.getStart().getRow() - 2;\r\n if (((_b = rows[previousRow]) === null || _b === void 0 ? void 0 : _b.trim().substring(0, 2)) !== \"\\\"!\") {\r\n const message = \"Missing ABAP Doc for interface \" + interfaceDef.identifier.getToken().getStr();\r\n const issue = issue_1.Issue.atIdentifier(interfaceDef.identifier, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n for (const method of methods) {\r\n if (method.isRedefinition === true) {\r\n continue;\r\n }\r\n const previousRowText = this.getPreviousRow(rows, method.identifier.getStart());\r\n if (!(previousRowText.substring(0, 2) === \"\\\"!\")) {\r\n const message = \"Missing ABAP Doc for method \" + method.identifier.getToken().getStr();\r\n const issue = issue_1.Issue.atIdentifier(method.identifier, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n getPreviousRow(rows, pos) {\r\n const previousRow = pos.getRow() - 2;\r\n const text = rows[previousRow].trim().toUpperCase();\r\n if (text === \"METHODS\" || text === \"CLASS-METHODS\") {\r\n const previousRow = pos.getRow() - 3;\r\n const text = rows[previousRow].trim().toUpperCase();\r\n return text;\r\n }\r\n return text;\r\n }\r\n}\r\nexports.Abapdoc = Abapdoc;\r\n//# sourceMappingURL=abapdoc.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/abapdoc.js?");
|
|
11779
11779
|
|
|
11780
11780
|
/***/ }),
|
|
11781
11781
|
|
|
@@ -11786,7 +11786,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11786
11786
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11787
11787
|
|
|
11788
11788
|
"use strict";
|
|
11789
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.AlignParameters = exports.AlignParametersConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst __1 = __webpack_require__(/*! .. */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nclass AlignParametersConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.AlignParametersConf = AlignParametersConf;\r\nclass AlignParameters extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new AlignParametersConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"align_parameters\",\r\n title: \"Align Parameters\",\r\n shortDescription: `Checks for vertially aligned parameters`,\r\n extendedInformation: `Checks:\n* function module calls\n* method calls\n* VALUE constructors\n* NEW constructors\n* RAISE EXCEPTION statements\n* CREATE OBJECT statements\n* RAISE EVENT statements\n\nhttps://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#align-parameters\n\nDoes not take effect on non functional method calls, use https://rules.abaplint.org/functional_writing/\n\nAlso https://rules.abaplint.org/max_one_method_parameter_per_line/ can help aligning parameter syntax`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Styleguide],\r\n badExample: `CALL FUNCTION 'FOOBAR'\n EXPORTING\n foo = 2\n parameter = 3.\n\nfoobar( moo = 1\n param = 1 ).\n\nfoo = VALUE #(\n foo = bar\n moo = 2 ).`,\r\n goodExample: `CALL FUNCTION 'FOOBAR'\n EXPORTING\n foo = 2\n parameter = 3.\n\nfoobar( moo = 1\n param = 1 ).\n\nfoo = VALUE #(\n foo = bar\n moo = 2 ).\n\nDATA(sdf) = VALUE type(\n common_val = 2\n another_common = 5\n ( row_value = 4\n value_foo = 5 ) ).`,\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 const issues = [];\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return issues; // parser error\r\n }\r\n const candidates = [];\r\n candidates.push(...this.functionParameterCandidates(stru));\r\n candidates.push(...this.methodCallParamCandidates(stru));\r\n candidates.push(...this.valueBodyCandidates(stru));\r\n candidates.push(...this.raiseAndCreateCandidates(stru));\r\n candidates.push(...this.newCandidates(stru));\r\n for (const c of candidates) {\r\n const i = this.checkCandidate(c, file);\r\n if (i) {\r\n issues.push(i);\r\n }\r\n }\r\n return issues;\r\n }\r\n checkCandidate(candidate, file) {\r\n if (candidate.parameters.length === 0) {\r\n return undefined;\r\n }\r\n let expectedEqualsColumn = 0;\r\n for (const p of candidate.parameters) {\r\n const currentCol = p.left.getLastToken().getCol() + p.left.getLastToken().getStr().length + 1;\r\n if (currentCol > expectedEqualsColumn) {\r\n expectedEqualsColumn = currentCol;\r\n }\r\n }\r\n for (const p of candidate.parameters) {\r\n if (p.eq.getCol() !== expectedEqualsColumn) {\r\n const message = \"Align parameters to column \" + expectedEqualsColumn;\r\n return issue_1.Issue.atPosition(file, p.eq, message, this.getMetadata().key, this.getConfig().severity);\r\n }\r\n }\r\n return undefined;\r\n }\r\n newCandidates(stru) {\r\n const candidates = [];\r\n for (const vb of stru.findAllExpressionsRecursive(Expressions.NewObject)) {\r\n const parameters = [];\r\n const fieldAssignments = vb.findDirectExpressions(Expressions.FieldAssignment);\r\n if (fieldAssignments.length >= 2) {\r\n for (const fs of fieldAssignments) {\r\n const children = fs.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n if (parameters.length > 0) {\r\n candidates.push({ parameters });\r\n continue;\r\n }\r\n }\r\n const list = vb.findDirectExpression(Expressions.ParameterListS);\r\n if (list) {\r\n for (const c of list.getChildren()) {\r\n const children = c.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n if (parameters.length > 0) {\r\n candidates.push({ parameters });\r\n }\r\n }\r\n }\r\n return candidates;\r\n }\r\n valueBodyCandidates(stru) {\r\n const candidates = [];\r\n for (const vb of stru.findAllExpressionsRecursive(Expressions.ValueBody)) {\r\n const parameters = [];\r\n const fieldAssignments = vb.findDirectExpressions(Expressions.FieldAssignment);\r\n if (fieldAssignments.length <= 1) {\r\n continue;\r\n }\r\n for (const fs of fieldAssignments) {\r\n const children = fs.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n if (parameters.length > 0) {\r\n candidates.push({ parameters });\r\n }\r\n }\r\n for (const vb of stru.findAllExpressionsRecursive(Expressions.ValueBodyLine)) {\r\n const parameters = [];\r\n const fieldAssignments = vb.findDirectExpressions(Expressions.FieldAssignment);\r\n if (fieldAssignments.length <= 1) {\r\n continue;\r\n }\r\n for (const fs of fieldAssignments) {\r\n const children = fs.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n if (parameters.length > 0) {\r\n candidates.push({ parameters });\r\n }\r\n }\r\n return candidates;\r\n }\r\n raiseAndCreateCandidates(stru) {\r\n const candidates = [];\r\n const statements = stru.findAllStatements(__1.Statements.Raise);\r\n statements.push(...stru.findAllStatements(__1.Statements.CreateObject));\r\n statements.push(...stru.findAllStatements(__1.Statements.RaiseEvent));\r\n for (const raise of statements) {\r\n const parameters = [];\r\n const param = raise.findDirectExpression(Expressions.ParameterListS);\r\n for (const p of (param === null || param === void 0 ? void 0 : param.getChildren()) || []) {\r\n const children = p.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n const ex = raise.findDirectExpression(Expressions.ParameterListExceptions);\r\n for (const e of (ex === null || ex === void 0 ? void 0 : ex.getChildren()) || []) {\r\n const children = e.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n if (parameters.length > 0) {\r\n candidates.push({ parameters });\r\n }\r\n }\r\n return candidates;\r\n }\r\n methodCallParamCandidates(stru) {\r\n var _a, _b, _c;\r\n const candidates = [];\r\n for (const mcp of stru.findAllExpressionsRecursive(Expressions.MethodCallParam)) {\r\n const parameters = [];\r\n for (const param of ((_a = mcp.findDirectExpression(Expressions.ParameterListS)) === null || _a === void 0 ? void 0 : _a.getChildren()) || []) {\r\n const children = param.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n const mp = mcp.findDirectExpression(Expressions.MethodParameters);\r\n if (mp) {\r\n for (const p of ((_b = mp.findDirectExpression(Expressions.ParameterListS)) === null || _b === void 0 ? void 0 : _b.getChildren()) || []) {\r\n const children = p.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n for (const l of mp.findDirectExpressions(Expressions.ParameterListT)) {\r\n for (const p of l.findDirectExpressions(Expressions.ParameterT) || []) {\r\n const children = p.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n }\r\n const rec = mp.findDirectExpression(Expressions.ParameterT);\r\n if (rec) {\r\n const children = rec.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n for (const ex of ((_c = mp.findDirectExpression(Expressions.ParameterListExceptions)) === null || _c === void 0 ? void 0 : _c.getChildren()) || []) {\r\n const children = ex.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n }\r\n if (parameters.length > 0) {\r\n candidates.push({ parameters });\r\n }\r\n }\r\n return candidates;\r\n }\r\n functionParameterCandidates(stru) {\r\n const candidates = [];\r\n for (const fp of stru.findAllExpressionsRecursive(Expressions.FunctionParameters)) {\r\n const parameters = [];\r\n for (const p of fp.findAllExpressions(Expressions.FunctionExportingParameter)) {\r\n const children = p.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n for (const list of fp.findDirectExpressions(Expressions.ParameterListT)) {\r\n for (const pt of list.findDirectExpressions(Expressions.ParameterT)) {\r\n const children = pt.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n }\r\n const list = fp.findDirectExpression(Expressions.ParameterListExceptions);\r\n if (list) {\r\n for (const pt of list.findDirectExpressions(Expressions.ParameterException)) {\r\n const children = pt.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n }\r\n if (parameters.length > 0) {\r\n candidates.push({ parameters });\r\n }\r\n }\r\n return candidates;\r\n }\r\n}\r\nexports.AlignParameters = AlignParameters;\r\n//# sourceMappingURL=align_parameters.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/align_parameters.js?");
|
|
11789
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.AlignParameters = exports.AlignParametersConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst __1 = __webpack_require__(/*! .. */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nclass AlignParametersConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.AlignParametersConf = AlignParametersConf;\r\nclass AlignParameters extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new AlignParametersConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"align_parameters\",\r\n title: \"Align Parameters\",\r\n shortDescription: `Checks for vertially aligned parameters`,\r\n extendedInformation: `Checks:\r\n* function module calls\r\n* method calls\r\n* VALUE constructors\r\n* NEW constructors\r\n* RAISE EXCEPTION statements\r\n* CREATE OBJECT statements\r\n* RAISE EVENT statements\r\n\r\nhttps://github.com/SAP/styleguides/blob/master/clean-abap/CleanABAP.md#align-parameters\r\n\r\nDoes not take effect on non functional method calls, use https://rules.abaplint.org/functional_writing/\r\n\r\nAlso https://rules.abaplint.org/max_one_method_parameter_per_line/ can help aligning parameter syntax`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Styleguide],\r\n badExample: `CALL FUNCTION 'FOOBAR'\r\n EXPORTING\r\n foo = 2\r\n parameter = 3.\r\n\r\nfoobar( moo = 1\r\n param = 1 ).\r\n\r\nfoo = VALUE #(\r\n foo = bar\r\n moo = 2 ).`,\r\n goodExample: `CALL FUNCTION 'FOOBAR'\r\n EXPORTING\r\n foo = 2\r\n parameter = 3.\r\n\r\nfoobar( moo = 1\r\n param = 1 ).\r\n\r\nfoo = VALUE #(\r\n foo = bar\r\n moo = 2 ).\r\n\r\nDATA(sdf) = VALUE type(\r\n common_val = 2\r\n another_common = 5\r\n ( row_value = 4\r\n value_foo = 5 ) ).`,\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 const issues = [];\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return issues; // parser error\r\n }\r\n const candidates = [];\r\n candidates.push(...this.functionParameterCandidates(stru));\r\n candidates.push(...this.methodCallParamCandidates(stru));\r\n candidates.push(...this.valueBodyCandidates(stru));\r\n candidates.push(...this.raiseAndCreateCandidates(stru));\r\n candidates.push(...this.newCandidates(stru));\r\n for (const c of candidates) {\r\n const i = this.checkCandidate(c, file);\r\n if (i) {\r\n issues.push(i);\r\n }\r\n }\r\n return issues;\r\n }\r\n checkCandidate(candidate, file) {\r\n if (candidate.parameters.length === 0) {\r\n return undefined;\r\n }\r\n let expectedEqualsColumn = 0;\r\n for (const p of candidate.parameters) {\r\n const currentCol = p.left.getLastToken().getCol() + p.left.getLastToken().getStr().length + 1;\r\n if (currentCol > expectedEqualsColumn) {\r\n expectedEqualsColumn = currentCol;\r\n }\r\n }\r\n for (const p of candidate.parameters) {\r\n if (p.eq.getCol() !== expectedEqualsColumn) {\r\n const message = \"Align parameters to column \" + expectedEqualsColumn;\r\n return issue_1.Issue.atPosition(file, p.eq, message, this.getMetadata().key, this.getConfig().severity);\r\n }\r\n }\r\n return undefined;\r\n }\r\n newCandidates(stru) {\r\n const candidates = [];\r\n for (const vb of stru.findAllExpressionsRecursive(Expressions.NewObject)) {\r\n const parameters = [];\r\n const fieldAssignments = vb.findDirectExpressions(Expressions.FieldAssignment);\r\n if (fieldAssignments.length >= 2) {\r\n for (const fs of fieldAssignments) {\r\n const children = fs.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n if (parameters.length > 0) {\r\n candidates.push({ parameters });\r\n continue;\r\n }\r\n }\r\n const list = vb.findDirectExpression(Expressions.ParameterListS);\r\n if (list) {\r\n for (const c of list.getChildren()) {\r\n const children = c.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n if (parameters.length > 0) {\r\n candidates.push({ parameters });\r\n }\r\n }\r\n }\r\n return candidates;\r\n }\r\n valueBodyCandidates(stru) {\r\n const candidates = [];\r\n for (const vb of stru.findAllExpressionsRecursive(Expressions.ValueBody)) {\r\n const parameters = [];\r\n const fieldAssignments = vb.findDirectExpressions(Expressions.FieldAssignment);\r\n if (fieldAssignments.length <= 1) {\r\n continue;\r\n }\r\n for (const fs of fieldAssignments) {\r\n const children = fs.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n if (parameters.length > 0) {\r\n candidates.push({ parameters });\r\n }\r\n }\r\n for (const vb of stru.findAllExpressionsRecursive(Expressions.ValueBodyLine)) {\r\n const parameters = [];\r\n const fieldAssignments = vb.findDirectExpressions(Expressions.FieldAssignment);\r\n if (fieldAssignments.length <= 1) {\r\n continue;\r\n }\r\n for (const fs of fieldAssignments) {\r\n const children = fs.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n if (parameters.length > 0) {\r\n candidates.push({ parameters });\r\n }\r\n }\r\n return candidates;\r\n }\r\n raiseAndCreateCandidates(stru) {\r\n const candidates = [];\r\n const statements = stru.findAllStatements(__1.Statements.Raise);\r\n statements.push(...stru.findAllStatements(__1.Statements.CreateObject));\r\n statements.push(...stru.findAllStatements(__1.Statements.RaiseEvent));\r\n for (const raise of statements) {\r\n const parameters = [];\r\n const param = raise.findDirectExpression(Expressions.ParameterListS);\r\n for (const p of (param === null || param === void 0 ? void 0 : param.getChildren()) || []) {\r\n const children = p.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n const ex = raise.findDirectExpression(Expressions.ParameterListExceptions);\r\n for (const e of (ex === null || ex === void 0 ? void 0 : ex.getChildren()) || []) {\r\n const children = e.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n if (parameters.length > 0) {\r\n candidates.push({ parameters });\r\n }\r\n }\r\n return candidates;\r\n }\r\n methodCallParamCandidates(stru) {\r\n var _a, _b, _c;\r\n const candidates = [];\r\n for (const mcp of stru.findAllExpressionsRecursive(Expressions.MethodCallParam)) {\r\n const parameters = [];\r\n for (const param of ((_a = mcp.findDirectExpression(Expressions.ParameterListS)) === null || _a === void 0 ? void 0 : _a.getChildren()) || []) {\r\n const children = param.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n const mp = mcp.findDirectExpression(Expressions.MethodParameters);\r\n if (mp) {\r\n for (const p of ((_b = mp.findDirectExpression(Expressions.ParameterListS)) === null || _b === void 0 ? void 0 : _b.getChildren()) || []) {\r\n const children = p.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n for (const l of mp.findDirectExpressions(Expressions.ParameterListT)) {\r\n for (const p of l.findDirectExpressions(Expressions.ParameterT) || []) {\r\n const children = p.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n }\r\n const rec = mp.findDirectExpression(Expressions.ParameterT);\r\n if (rec) {\r\n const children = rec.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n for (const ex of ((_c = mp.findDirectExpression(Expressions.ParameterListExceptions)) === null || _c === void 0 ? void 0 : _c.getChildren()) || []) {\r\n const children = ex.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n }\r\n if (parameters.length > 0) {\r\n candidates.push({ parameters });\r\n }\r\n }\r\n return candidates;\r\n }\r\n functionParameterCandidates(stru) {\r\n const candidates = [];\r\n for (const fp of stru.findAllExpressionsRecursive(Expressions.FunctionParameters)) {\r\n const parameters = [];\r\n for (const p of fp.findAllExpressions(Expressions.FunctionExportingParameter)) {\r\n const children = p.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n for (const list of fp.findDirectExpressions(Expressions.ParameterListT)) {\r\n for (const pt of list.findDirectExpressions(Expressions.ParameterT)) {\r\n const children = pt.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n }\r\n const list = fp.findDirectExpression(Expressions.ParameterListExceptions);\r\n if (list) {\r\n for (const pt of list.findDirectExpressions(Expressions.ParameterException)) {\r\n const children = pt.getChildren();\r\n if (children.length < 3) {\r\n continue; // unexpected\r\n }\r\n parameters.push({\r\n left: children[0],\r\n eq: children[1].getFirstToken().getStart(),\r\n right: children[2],\r\n });\r\n }\r\n }\r\n if (parameters.length > 0) {\r\n candidates.push({ parameters });\r\n }\r\n }\r\n return candidates;\r\n }\r\n}\r\nexports.AlignParameters = AlignParameters;\r\n//# sourceMappingURL=align_parameters.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/align_parameters.js?");
|
|
11790
11790
|
|
|
11791
11791
|
/***/ }),
|
|
11792
11792
|
|
|
@@ -11819,7 +11819,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11819
11819
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11820
11820
|
|
|
11821
11821
|
"use strict";
|
|
11822
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.AmbiguousStatement = exports.AmbiguousStatementConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.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 combi_1 = __webpack_require__(/*! ../abap/2_statements/combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass AmbiguousStatementConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.AmbiguousStatementConf = AmbiguousStatementConf;\r\nclass AmbiguousStatement extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new AmbiguousStatementConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"ambiguous_statement\",\r\n title: \"Check for ambigious statements\",\r\n shortDescription: `Checks for ambiguity between deleting or modifying from internal and database table\nAdd \"TABLE\" keyword or \"@\" for escaping SQL variables\n\nOnly works if the target version is 740sp05 or above`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `DELETE foo FROM bar.\nMODIFY foo FROM bar.`,\r\n goodExample: `DELETE foo FROM @bar.\nMODIFY TABLE foo FROM bar.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"Ambiguous statement. Use explicit syntax.\";\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.reg.getConfig().getVersion() < version_1.Version.v740sp05) {\r\n return [];\r\n }\r\n for (const statement of file.getStatements()) {\r\n let match = false;\r\n if (statement.get() instanceof Statements.DeleteDatabase) {\r\n match = this.tryMatch(statement, this.reg, Statements.DeleteInternal);\r\n }\r\n else if (statement.get() instanceof Statements.DeleteInternal) {\r\n match = this.tryMatch(statement, this.reg, Statements.DeleteDatabase);\r\n }\r\n else if (statement.get() instanceof Statements.ModifyInternal) {\r\n match = this.tryMatch(statement, this.reg, Statements.ModifyDatabase);\r\n }\r\n else if (statement.get() instanceof Statements.ModifyDatabase) {\r\n match = this.tryMatch(statement, this.reg, Statements.ModifyInternal);\r\n }\r\n if (match) {\r\n const issue = issue_1.Issue.atStatement(file, statement, this.getMessage(), this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n tryMatch(st, reg, type1) {\r\n const ver = reg.getConfig().getVersion();\r\n const tokens = st.getTokens().slice(0);\r\n tokens.pop();\r\n const match = combi_1.Combi.run(new type1().getMatcher(), tokens, ver);\r\n return match !== undefined;\r\n }\r\n}\r\nexports.AmbiguousStatement = AmbiguousStatement;\r\n//# sourceMappingURL=ambiguous_statement.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/ambiguous_statement.js?");
|
|
11822
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.AmbiguousStatement = exports.AmbiguousStatementConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.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 combi_1 = __webpack_require__(/*! ../abap/2_statements/combi */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/combi.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass AmbiguousStatementConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.AmbiguousStatementConf = AmbiguousStatementConf;\r\nclass AmbiguousStatement extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new AmbiguousStatementConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"ambiguous_statement\",\r\n title: \"Check for ambigious statements\",\r\n shortDescription: `Checks for ambiguity between deleting or modifying from internal and database table\r\nAdd \"TABLE\" keyword or \"@\" for escaping SQL variables\r\n\r\nOnly works if the target version is 740sp05 or above`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `DELETE foo FROM bar.\r\nMODIFY foo FROM bar.`,\r\n goodExample: `DELETE foo FROM @bar.\r\nMODIFY TABLE foo FROM bar.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"Ambiguous statement. Use explicit syntax.\";\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.reg.getConfig().getVersion() < version_1.Version.v740sp05) {\r\n return [];\r\n }\r\n for (const statement of file.getStatements()) {\r\n let match = false;\r\n if (statement.get() instanceof Statements.DeleteDatabase) {\r\n match = this.tryMatch(statement, this.reg, Statements.DeleteInternal);\r\n }\r\n else if (statement.get() instanceof Statements.DeleteInternal) {\r\n match = this.tryMatch(statement, this.reg, Statements.DeleteDatabase);\r\n }\r\n else if (statement.get() instanceof Statements.ModifyInternal) {\r\n match = this.tryMatch(statement, this.reg, Statements.ModifyDatabase);\r\n }\r\n else if (statement.get() instanceof Statements.ModifyDatabase) {\r\n match = this.tryMatch(statement, this.reg, Statements.ModifyInternal);\r\n }\r\n if (match) {\r\n const issue = issue_1.Issue.atStatement(file, statement, this.getMessage(), this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n tryMatch(st, reg, type1) {\r\n const ver = reg.getConfig().getVersion();\r\n const tokens = st.getTokens().slice(0);\r\n tokens.pop();\r\n const match = combi_1.Combi.run(new type1().getMatcher(), tokens, ver);\r\n return match !== undefined;\r\n }\r\n}\r\nexports.AmbiguousStatement = AmbiguousStatement;\r\n//# sourceMappingURL=ambiguous_statement.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/ambiguous_statement.js?");
|
|
11823
11823
|
|
|
11824
11824
|
/***/ }),
|
|
11825
11825
|
|
|
@@ -11830,7 +11830,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11830
11830
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11831
11831
|
|
|
11832
11832
|
"use strict";
|
|
11833
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.AvoidUse = exports.AvoidUseConf = 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 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 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\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\nclass AvoidUseConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Do not emit quick fix suggestion */\r\n this.skipQuickFix = false;\r\n /** Detects DEFINE (macro definitions) */\r\n this.define = true;\r\n /** Detects statics */\r\n this.statics = true;\r\n /** Detects DEFAULT KEY definitions, from version v740sp02 and up */\r\n this.defaultKey = true;\r\n /** Detects BREAK and BREAK-POINTS */\r\n this.break = true;\r\n /** Detects TEST SEAMS */\r\n this.testSeams = true;\r\n /** Detects DESCRIBE TABLE LINES, use lines() instead */\r\n this.describeLines = true;\r\n }\r\n}\r\nexports.AvoidUseConf = AvoidUseConf;\r\nclass AvoidUse extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new AvoidUseConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"avoid_use\",\r\n title: \"Avoid use of certain statements\",\r\n shortDescription: `Detects usage of certain statements.`,\r\n extendedInformation: `DEFAULT KEY: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-default-key\n\nMacros: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abenmacros_guidl.htm\n\nSTATICS: use CLASS-DATA instead\n\nDESCRIBE TABLE LINES: use lines() instead (quickfix exists)\n\nTEST-SEAMS: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-test-seams-as-temporary-workaround`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getDescription(statement) {\r\n return \"Avoid use of \" + statement;\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;\r\n const issues = [];\r\n let isStaticsBlock = false;\r\n for (const statementNode of file.getStatements()) {\r\n const statement = statementNode.get();\r\n let message = undefined;\r\n let fix = undefined;\r\n if (this.conf.define && statement instanceof Statements.Define) {\r\n message = \"DEFINE\";\r\n }\r\n else if (this.conf.describeLines && statement instanceof Statements.Describe) {\r\n const children = statementNode.getChildren();\r\n if (children.length === 6 && children[3].getFirstToken().getStr().toUpperCase() === \"LINES\") {\r\n message = \"DESCRIBE LINES, use lines() instead\";\r\n fix = this.conf.skipQuickFix === true ? undefined : this.getDescribeLinesFix(file, statementNode);\r\n }\r\n }\r\n else if (this.conf.statics && statement instanceof Statements.StaticBegin) {\r\n isStaticsBlock = true;\r\n message = \"STATICS\";\r\n }\r\n else if (this.conf.statics && statement instanceof Statements.StaticEnd) {\r\n isStaticsBlock = false;\r\n }\r\n else if (this.conf.testSeams && statement instanceof Statements.TestSeam) {\r\n message = \"TEST-SEAM\";\r\n }\r\n else if (this.conf.statics && statement instanceof Statements.Static && isStaticsBlock === false) {\r\n message = \"STATICS\";\r\n }\r\n else if (this.conf.break && statement instanceof Statements.Break) {\r\n message = \"BREAK/BREAK-POINT\";\r\n fix = this.conf.skipQuickFix === true ? undefined : edit_helper_1.EditHelper.deleteStatement(file, statementNode);\r\n }\r\n if (message) {\r\n issues.push(issue_1.Issue.atStatement(file, statementNode, this.getDescription(message), this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n if (this.conf.defaultKey\r\n && (this.reg.getConfig().getVersion() >= version_1.Version.v740sp02\r\n || this.reg.getConfig().getVersion() === version_1.Version.Cloud)\r\n && (statement instanceof Statements.Data || statement instanceof Statements.Type)) {\r\n const tt = (_a = statementNode.findFirstExpression(expressions_1.TypeTable)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(expressions_1.TypeTableKey);\r\n const token = tt === null || tt === void 0 ? void 0 : tt.findDirectTokenByText(\"DEFAULT\");\r\n if (tt && token) {\r\n message = \"DEFAULT KEY\";\r\n issues.push(issue_1.Issue.atToken(file, token, this.getDescription(message), this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n getDescribeLinesFix(file, statementNode) {\r\n const children = statementNode.getChildren();\r\n const target = children[4].concatTokens();\r\n const source = children[2].concatTokens();\r\n const startPosition = children[0].getFirstToken().getStart();\r\n const insertText = target + \" = lines( \" + source + \" ).\";\r\n const deleteFix = edit_helper_1.EditHelper.deleteStatement(file, statementNode);\r\n const insertFix = edit_helper_1.EditHelper.insertAt(file, startPosition, insertText);\r\n const finalFix = edit_helper_1.EditHelper.merge(deleteFix, insertFix);\r\n return finalFix;\r\n }\r\n}\r\nexports.AvoidUse = AvoidUse;\r\n//# sourceMappingURL=avoid_use.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/avoid_use.js?");
|
|
11833
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.AvoidUse = exports.AvoidUseConf = 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 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 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\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\nclass AvoidUseConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Do not emit quick fix suggestion */\r\n this.skipQuickFix = false;\r\n /** Detects DEFINE (macro definitions) */\r\n this.define = true;\r\n /** Detects statics */\r\n this.statics = true;\r\n /** Detects DEFAULT KEY definitions, from version v740sp02 and up */\r\n this.defaultKey = true;\r\n /** Detects BREAK and BREAK-POINTS */\r\n this.break = true;\r\n /** Detects TEST SEAMS */\r\n this.testSeams = true;\r\n /** Detects DESCRIBE TABLE LINES, use lines() instead */\r\n this.describeLines = true;\r\n }\r\n}\r\nexports.AvoidUseConf = AvoidUseConf;\r\nclass AvoidUse extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new AvoidUseConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"avoid_use\",\r\n title: \"Avoid use of certain statements\",\r\n shortDescription: `Detects usage of certain statements.`,\r\n extendedInformation: `DEFAULT KEY: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-default-key\r\n\r\nMacros: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abenmacros_guidl.htm\r\n\r\nSTATICS: use CLASS-DATA instead\r\n\r\nDESCRIBE TABLE LINES: use lines() instead (quickfix exists)\r\n\r\nTEST-SEAMS: https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-test-seams-as-temporary-workaround`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getDescription(statement) {\r\n return \"Avoid use of \" + statement;\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;\r\n const issues = [];\r\n let isStaticsBlock = false;\r\n for (const statementNode of file.getStatements()) {\r\n const statement = statementNode.get();\r\n let message = undefined;\r\n let fix = undefined;\r\n if (this.conf.define && statement instanceof Statements.Define) {\r\n message = \"DEFINE\";\r\n }\r\n else if (this.conf.describeLines && statement instanceof Statements.Describe) {\r\n const children = statementNode.getChildren();\r\n if (children.length === 6 && children[3].getFirstToken().getStr().toUpperCase() === \"LINES\") {\r\n message = \"DESCRIBE LINES, use lines() instead\";\r\n fix = this.conf.skipQuickFix === true ? undefined : this.getDescribeLinesFix(file, statementNode);\r\n }\r\n }\r\n else if (this.conf.statics && statement instanceof Statements.StaticBegin) {\r\n isStaticsBlock = true;\r\n message = \"STATICS\";\r\n }\r\n else if (this.conf.statics && statement instanceof Statements.StaticEnd) {\r\n isStaticsBlock = false;\r\n }\r\n else if (this.conf.testSeams && statement instanceof Statements.TestSeam) {\r\n message = \"TEST-SEAM\";\r\n }\r\n else if (this.conf.statics && statement instanceof Statements.Static && isStaticsBlock === false) {\r\n message = \"STATICS\";\r\n }\r\n else if (this.conf.break && statement instanceof Statements.Break) {\r\n message = \"BREAK/BREAK-POINT\";\r\n fix = this.conf.skipQuickFix === true ? undefined : edit_helper_1.EditHelper.deleteStatement(file, statementNode);\r\n }\r\n if (message) {\r\n issues.push(issue_1.Issue.atStatement(file, statementNode, this.getDescription(message), this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n if (this.conf.defaultKey\r\n && (this.reg.getConfig().getVersion() >= version_1.Version.v740sp02\r\n || this.reg.getConfig().getVersion() === version_1.Version.Cloud)\r\n && (statement instanceof Statements.Data || statement instanceof Statements.Type)) {\r\n const tt = (_a = statementNode.findFirstExpression(expressions_1.TypeTable)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(expressions_1.TypeTableKey);\r\n const token = tt === null || tt === void 0 ? void 0 : tt.findDirectTokenByText(\"DEFAULT\");\r\n if (tt && token) {\r\n message = \"DEFAULT KEY\";\r\n issues.push(issue_1.Issue.atToken(file, token, this.getDescription(message), this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n getDescribeLinesFix(file, statementNode) {\r\n const children = statementNode.getChildren();\r\n const target = children[4].concatTokens();\r\n const source = children[2].concatTokens();\r\n const startPosition = children[0].getFirstToken().getStart();\r\n const insertText = target + \" = lines( \" + source + \" ).\";\r\n const deleteFix = edit_helper_1.EditHelper.deleteStatement(file, statementNode);\r\n const insertFix = edit_helper_1.EditHelper.insertAt(file, startPosition, insertText);\r\n const finalFix = edit_helper_1.EditHelper.merge(deleteFix, insertFix);\r\n return finalFix;\r\n }\r\n}\r\nexports.AvoidUse = AvoidUse;\r\n//# sourceMappingURL=avoid_use.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/avoid_use.js?");
|
|
11834
11834
|
|
|
11835
11835
|
/***/ }),
|
|
11836
11836
|
|
|
@@ -11841,7 +11841,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11841
11841
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11842
11842
|
|
|
11843
11843
|
"use strict";
|
|
11844
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.BeginEndNames = exports.BeginEndNamesConf = void 0;\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 Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/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 Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass BeginEndNamesConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.BeginEndNamesConf = BeginEndNamesConf;\r\nclass BeginEndNames extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new BeginEndNamesConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"begin_end_names\",\r\n title: \"Check BEGIN END names\",\r\n shortDescription: `Check BEGIN OF and END OF names match, plus there must be statements between BEGIN and END`,\r\n tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n badExample: `DATA: BEGIN OF stru,\n field TYPE i,\n END OF structure_not_the_same.`,\r\n goodExample: `DATA: BEGIN OF stru,\n field TYPE i,\n END OF stru.`,\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 const output = [];\r\n const struc = file.getStructure();\r\n if (struc === undefined) {\r\n return [];\r\n }\r\n output.push(...this.test(struc, Structures.Data, Statements.DataBegin, Statements.DataEnd, file));\r\n output.push(...this.test(struc, Structures.ClassData, Statements.ClassDataBegin, Statements.ClassDataEnd, file));\r\n output.push(...this.test(struc, Structures.Constants, Statements.ConstantBegin, Statements.ConstantEnd, file));\r\n output.push(...this.test(struc, Structures.Statics, Statements.StaticBegin, Statements.StaticEnd, file));\r\n output.push(...this.test(struc, Structures.TypeEnum, Statements.TypeEnumBegin, Statements.TypeEnumEnd, file));\r\n output.push(...this.test(struc, Structures.Types, Statements.TypeBegin, Statements.TypeEnd, file));\r\n return output;\r\n }\r\n test(stru, type, b, e, file) {\r\n const output = [];\r\n for (const sub of stru.findAllStructuresRecursive(type)) {\r\n let begin = sub.findDirectStatements(b)[0].findFirstExpression(Expressions.NamespaceSimpleName);\r\n if (begin === undefined) {\r\n begin = sub.findDirectStatements(b)[0].findFirstExpression(Expressions.DefinitionName);\r\n }\r\n if (begin === undefined) {\r\n continue;\r\n }\r\n const first = begin.getFirstToken();\r\n let end = sub.findDirectStatements(e)[0].findFirstExpression(Expressions.NamespaceSimpleName);\r\n if (end === undefined) {\r\n end = sub.findDirectStatements(e)[0].findFirstExpression(Expressions.DefinitionName);\r\n }\r\n if (end === undefined) {\r\n continue;\r\n }\r\n const last = end.getFirstToken();\r\n if (first.getStr().toUpperCase() !== last.getStr().toUpperCase()) {\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, last.getStart(), last.getEnd(), first.getStr());\r\n const message = \"BEGIN END names must match\";\r\n const issue = issue_1.Issue.atToken(file, first, message, this.getMetadata().key, this.conf.severity, fix);\r\n output.push(issue);\r\n }\r\n if (sub.getChildren().length === 2) {\r\n const message = \"There must be statements between BEGIN and END\";\r\n const issue = issue_1.Issue.atToken(file, first, message, this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n }\r\n return output;\r\n }\r\n}\r\nexports.BeginEndNames = BeginEndNames;\r\n//# sourceMappingURL=begin_end_names.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/begin_end_names.js?");
|
|
11844
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.BeginEndNames = exports.BeginEndNamesConf = void 0;\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 Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/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 Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass BeginEndNamesConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.BeginEndNamesConf = BeginEndNamesConf;\r\nclass BeginEndNames extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new BeginEndNamesConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"begin_end_names\",\r\n title: \"Check BEGIN END names\",\r\n shortDescription: `Check BEGIN OF and END OF names match, plus there must be statements between BEGIN and END`,\r\n tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n badExample: `DATA: BEGIN OF stru,\r\n field TYPE i,\r\n END OF structure_not_the_same.`,\r\n goodExample: `DATA: BEGIN OF stru,\r\n field TYPE i,\r\n END OF stru.`,\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 const output = [];\r\n const struc = file.getStructure();\r\n if (struc === undefined) {\r\n return [];\r\n }\r\n output.push(...this.test(struc, Structures.Data, Statements.DataBegin, Statements.DataEnd, file));\r\n output.push(...this.test(struc, Structures.ClassData, Statements.ClassDataBegin, Statements.ClassDataEnd, file));\r\n output.push(...this.test(struc, Structures.Constants, Statements.ConstantBegin, Statements.ConstantEnd, file));\r\n output.push(...this.test(struc, Structures.Statics, Statements.StaticBegin, Statements.StaticEnd, file));\r\n output.push(...this.test(struc, Structures.TypeEnum, Statements.TypeEnumBegin, Statements.TypeEnumEnd, file));\r\n output.push(...this.test(struc, Structures.Types, Statements.TypeBegin, Statements.TypeEnd, file));\r\n return output;\r\n }\r\n test(stru, type, b, e, file) {\r\n const output = [];\r\n for (const sub of stru.findAllStructuresRecursive(type)) {\r\n let begin = sub.findDirectStatements(b)[0].findFirstExpression(Expressions.NamespaceSimpleName);\r\n if (begin === undefined) {\r\n begin = sub.findDirectStatements(b)[0].findFirstExpression(Expressions.DefinitionName);\r\n }\r\n if (begin === undefined) {\r\n continue;\r\n }\r\n const first = begin.getFirstToken();\r\n let end = sub.findDirectStatements(e)[0].findFirstExpression(Expressions.NamespaceSimpleName);\r\n if (end === undefined) {\r\n end = sub.findDirectStatements(e)[0].findFirstExpression(Expressions.DefinitionName);\r\n }\r\n if (end === undefined) {\r\n continue;\r\n }\r\n const last = end.getFirstToken();\r\n if (first.getStr().toUpperCase() !== last.getStr().toUpperCase()) {\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, last.getStart(), last.getEnd(), first.getStr());\r\n const message = \"BEGIN END names must match\";\r\n const issue = issue_1.Issue.atToken(file, first, message, this.getMetadata().key, this.conf.severity, fix);\r\n output.push(issue);\r\n }\r\n if (sub.getChildren().length === 2) {\r\n const message = \"There must be statements between BEGIN and END\";\r\n const issue = issue_1.Issue.atToken(file, first, message, this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n }\r\n return output;\r\n }\r\n}\r\nexports.BeginEndNames = BeginEndNames;\r\n//# sourceMappingURL=begin_end_names.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/begin_end_names.js?");
|
|
11845
11845
|
|
|
11846
11846
|
/***/ }),
|
|
11847
11847
|
|
|
@@ -11852,7 +11852,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11852
11852
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11853
11853
|
|
|
11854
11854
|
"use strict";
|
|
11855
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.BeginSingleInclude = exports.BeginSingleIncludeConf = void 0;\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 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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass BeginSingleIncludeConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.BeginSingleIncludeConf = BeginSingleIncludeConf;\r\nclass BeginSingleInclude extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new BeginSingleIncludeConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"begin_single_include\",\r\n title: \"BEGIN contains single INCLUDE\",\r\n shortDescription: `Finds TYPE BEGIN with just one INCLUDE TYPE, and DATA with single INCLUDE STRUCTURE`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `TYPES: BEGIN OF dummy1.\n INCLUDE TYPE dselc.\nTYPES: END OF dummy1.\n\nDATA BEGIN OF foo.\nINCLUDE STRUCTURE syst.\nDATA END OF foo.\n\nSTATICS BEGIN OF bar.\nINCLUDE STRUCTURE syst.\nSTATICS END OF bar.`,\r\n goodExample: `DATA BEGIN OF foo.\nINCLUDE STRUCTURE dselc.\nDATA END OF foo.`,\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 const issues = [];\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return [];\r\n }\r\n for (const t of stru.findAllStructures(Structures.Types)) {\r\n if (t.getChildren().length !== 3) {\r\n continue;\r\n }\r\n if (t.findFirstStatement(Statements.IncludeType)) {\r\n const token = t.getFirstToken();\r\n const message = \"TYPE BEGIN with single INCLUDE\";\r\n const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n for (const t of stru.findAllStructures(Structures.Data)) {\r\n if (t.getChildren().length !== 3) {\r\n continue;\r\n }\r\n if (t.findFirstStatement(Statements.IncludeType)) {\r\n const token = t.getFirstToken();\r\n const message = \"DATA BEGIN with single INCLUDE\";\r\n const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n for (const t of stru.findAllStructures(Structures.Statics)) {\r\n if (t.getChildren().length !== 3) {\r\n continue;\r\n }\r\n if (t.findFirstStatement(Statements.IncludeType)) {\r\n const token = t.getFirstToken();\r\n const message = \"STATICS BEGIN with single INCLUDE\";\r\n const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.BeginSingleInclude = BeginSingleInclude;\r\n//# sourceMappingURL=begin_single_include.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/begin_single_include.js?");
|
|
11855
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.BeginSingleInclude = exports.BeginSingleIncludeConf = void 0;\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 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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass BeginSingleIncludeConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.BeginSingleIncludeConf = BeginSingleIncludeConf;\r\nclass BeginSingleInclude extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new BeginSingleIncludeConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"begin_single_include\",\r\n title: \"BEGIN contains single INCLUDE\",\r\n shortDescription: `Finds TYPE BEGIN with just one INCLUDE TYPE, and DATA with single INCLUDE STRUCTURE`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `TYPES: BEGIN OF dummy1.\r\n INCLUDE TYPE dselc.\r\nTYPES: END OF dummy1.\r\n\r\nDATA BEGIN OF foo.\r\nINCLUDE STRUCTURE syst.\r\nDATA END OF foo.\r\n\r\nSTATICS BEGIN OF bar.\r\nINCLUDE STRUCTURE syst.\r\nSTATICS END OF bar.`,\r\n goodExample: `DATA BEGIN OF foo.\r\nINCLUDE STRUCTURE dselc.\r\nDATA END OF foo.`,\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 const issues = [];\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return [];\r\n }\r\n for (const t of stru.findAllStructures(Structures.Types)) {\r\n if (t.getChildren().length !== 3) {\r\n continue;\r\n }\r\n if (t.findFirstStatement(Statements.IncludeType)) {\r\n const token = t.getFirstToken();\r\n const message = \"TYPE BEGIN with single INCLUDE\";\r\n const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n for (const t of stru.findAllStructures(Structures.Data)) {\r\n if (t.getChildren().length !== 3) {\r\n continue;\r\n }\r\n if (t.findFirstStatement(Statements.IncludeType)) {\r\n const token = t.getFirstToken();\r\n const message = \"DATA BEGIN with single INCLUDE\";\r\n const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n for (const t of stru.findAllStructures(Structures.Statics)) {\r\n if (t.getChildren().length !== 3) {\r\n continue;\r\n }\r\n if (t.findFirstStatement(Statements.IncludeType)) {\r\n const token = t.getFirstToken();\r\n const message = \"STATICS BEGIN with single INCLUDE\";\r\n const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.BeginSingleInclude = BeginSingleInclude;\r\n//# sourceMappingURL=begin_single_include.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/begin_single_include.js?");
|
|
11856
11856
|
|
|
11857
11857
|
/***/ }),
|
|
11858
11858
|
|
|
@@ -11863,7 +11863,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11863
11863
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11864
11864
|
|
|
11865
11865
|
"use strict";
|
|
11866
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CallTransactionAuthorityCheck = exports.CallTransactionAuthorityCheckConf = void 0;\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nclass CallTransactionAuthorityCheckConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.CallTransactionAuthorityCheckConf = CallTransactionAuthorityCheckConf;\r\nclass CallTransactionAuthorityCheck extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new CallTransactionAuthorityCheckConf();\r\n this.MINIMUM_VERSION = version_1.Version.v740sp02;\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"call_transaction_authority_check\",\r\n title: \"Call Transaction Authority-Check\",\r\n shortDescription: `Checks that usages of CALL TRANSACTION contain an authority-check.`,\r\n extendedInformation: `https://docs.abapopenchecks.org/checks/54/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Security],\r\n badExample: `CALL TRANSACTION 'FOO'.`,\r\n goodExample: `TRY.\n CALL TRANSACTION 'FOO' WITH AUTHORITY-CHECK.\n CATCH cx_sy_authorization_error.\nENDTRY.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"Add an authority check to CALL TRANSACTION\";\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, obj) {\r\n const currentVersion = this.reg.getConfig().getVersion();\r\n // Cloud version does not support CALL TRANSACTION\r\n if (currentVersion < this.MINIMUM_VERSION || currentVersion === version_1.Version.Cloud) {\r\n return [];\r\n }\r\n const issues = [];\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n for (const statNode of file.getStatements()) {\r\n const statement = statNode.get();\r\n if (statement instanceof Statements.CallTransaction && !statNode.concatTokensWithoutStringsAndComments().toUpperCase().includes(\"WITH AUTHORITY-CHECK\")) {\r\n issues.push(issue_1.Issue.atStatement(file, statNode, this.getMessage(), this.getMetadata().key));\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.CallTransactionAuthorityCheck = CallTransactionAuthorityCheck;\r\n//# sourceMappingURL=call_transaction_authority_check.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/call_transaction_authority_check.js?");
|
|
11866
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CallTransactionAuthorityCheck = exports.CallTransactionAuthorityCheckConf = void 0;\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nclass CallTransactionAuthorityCheckConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.CallTransactionAuthorityCheckConf = CallTransactionAuthorityCheckConf;\r\nclass CallTransactionAuthorityCheck extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new CallTransactionAuthorityCheckConf();\r\n this.MINIMUM_VERSION = version_1.Version.v740sp02;\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"call_transaction_authority_check\",\r\n title: \"Call Transaction Authority-Check\",\r\n shortDescription: `Checks that usages of CALL TRANSACTION contain an authority-check.`,\r\n extendedInformation: `https://docs.abapopenchecks.org/checks/54/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Security],\r\n badExample: `CALL TRANSACTION 'FOO'.`,\r\n goodExample: `TRY.\r\n CALL TRANSACTION 'FOO' WITH AUTHORITY-CHECK.\r\n CATCH cx_sy_authorization_error.\r\nENDTRY.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"Add an authority check to CALL TRANSACTION\";\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, obj) {\r\n const currentVersion = this.reg.getConfig().getVersion();\r\n // Cloud version does not support CALL TRANSACTION\r\n if (currentVersion < this.MINIMUM_VERSION || currentVersion === version_1.Version.Cloud) {\r\n return [];\r\n }\r\n const issues = [];\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n for (const statNode of file.getStatements()) {\r\n const statement = statNode.get();\r\n if (statement instanceof Statements.CallTransaction && !statNode.concatTokensWithoutStringsAndComments().toUpperCase().includes(\"WITH AUTHORITY-CHECK\")) {\r\n issues.push(issue_1.Issue.atStatement(file, statNode, this.getMessage(), this.getMetadata().key));\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.CallTransactionAuthorityCheck = CallTransactionAuthorityCheck;\r\n//# sourceMappingURL=call_transaction_authority_check.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/call_transaction_authority_check.js?");
|
|
11867
11867
|
|
|
11868
11868
|
/***/ }),
|
|
11869
11869
|
|
|
@@ -11874,7 +11874,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11874
11874
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11875
11875
|
|
|
11876
11876
|
"use strict";
|
|
11877
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CDSCommentStyle = exports.CDSCommentStyleConf = void 0;\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 _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst cds_lexer_1 = __webpack_require__(/*! ../cds/cds_lexer */ \"./node_modules/@abaplint/core/build/src/cds/cds_lexer.js\");\r\nconst tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nclass CDSCommentStyleConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.CDSCommentStyleConf = CDSCommentStyleConf;\r\nclass CDSCommentStyle {\r\n constructor() {\r\n this.conf = new CDSCommentStyleConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"cds_comment_style\",\r\n title: \"CDS Comment Style\",\r\n shortDescription: `Check for obsolete comment style`,\r\n extendedInformation: `Check for obsolete comment style\n\nComments starting with \"--\" are considered obsolete\n\nhttps://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abencds_general_syntax_rules.htm`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: \"-- this is a comment\",\r\n goodExample: \"// this is a comment\",\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 initialize(_reg) {\r\n return this;\r\n }\r\n run(object) {\r\n const issues = [];\r\n if ((object.getType() === \"DDLS\" && object instanceof objects_1.DataDefinition) ||\r\n (object.getType() === \"DDLX\" && object instanceof objects_1.CDSMetadataExtension)) {\r\n const file = object.findSourceFile();\r\n if (file === undefined) {\r\n return issues;\r\n }\r\n const tokens = cds_lexer_1.CDSLexer.run(file);\r\n for (const t of tokens) {\r\n if (t instanceof tokens_1.Comment && t.getStr().startsWith(\"--\")) {\r\n issues.push(issue_1.Issue.atToken(file, t, `Use \"//\" for comments instead of \"--\"`, this.getMetadata().key, this.getConfig().severity));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.CDSCommentStyle = CDSCommentStyle;\r\n//# sourceMappingURL=cds_comment_style.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/cds_comment_style.js?");
|
|
11877
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CDSCommentStyle = exports.CDSCommentStyleConf = void 0;\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 _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst cds_lexer_1 = __webpack_require__(/*! ../cds/cds_lexer */ \"./node_modules/@abaplint/core/build/src/cds/cds_lexer.js\");\r\nconst tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nclass CDSCommentStyleConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.CDSCommentStyleConf = CDSCommentStyleConf;\r\nclass CDSCommentStyle {\r\n constructor() {\r\n this.conf = new CDSCommentStyleConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"cds_comment_style\",\r\n title: \"CDS Comment Style\",\r\n shortDescription: `Check for obsolete comment style`,\r\n extendedInformation: `Check for obsolete comment style\r\n\r\nComments starting with \"--\" are considered obsolete\r\n\r\nhttps://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abencds_general_syntax_rules.htm`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: \"-- this is a comment\",\r\n goodExample: \"// this is a comment\",\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 initialize(_reg) {\r\n return this;\r\n }\r\n run(object) {\r\n const issues = [];\r\n if ((object.getType() === \"DDLS\" && object instanceof objects_1.DataDefinition) ||\r\n (object.getType() === \"DDLX\" && object instanceof objects_1.CDSMetadataExtension)) {\r\n const file = object.findSourceFile();\r\n if (file === undefined) {\r\n return issues;\r\n }\r\n const tokens = cds_lexer_1.CDSLexer.run(file);\r\n for (const t of tokens) {\r\n if (t instanceof tokens_1.Comment && t.getStr().startsWith(\"--\")) {\r\n issues.push(issue_1.Issue.atToken(file, t, `Use \"//\" for comments instead of \"--\"`, this.getMetadata().key, this.getConfig().severity));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.CDSCommentStyle = CDSCommentStyle;\r\n//# sourceMappingURL=cds_comment_style.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/cds_comment_style.js?");
|
|
11878
11878
|
|
|
11879
11879
|
/***/ }),
|
|
11880
11880
|
|
|
@@ -11885,7 +11885,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11885
11885
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11886
11886
|
|
|
11887
11887
|
"use strict";
|
|
11888
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CDSLegacyView = exports.CDSLegacyViewConf = void 0;\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 version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.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 objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nclass CDSLegacyViewConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.CDSLegacyViewConf = CDSLegacyViewConf;\r\nclass CDSLegacyView {\r\n constructor() {\r\n this.conf = new CDSLegacyViewConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"cds_legacy_view\",\r\n title: \"CDS Legacy View\",\r\n shortDescription: `Identify CDS Legacy Views`,\r\n // eslint-disable-next-line max-len\r\n extendedInformation: `Use DEFINE VIEW ENTITY instead of DEFINE VIEW\n\nhttps://blogs.sap.com/2021/10/16/a-new-generation-of-cds-views-how-to-migrate-your-cds-views-to-cds-view-entities/\n\nv755 and up`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Upport],\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 initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(o) {\r\n const issues = [];\r\n if (this.reg.getConfig().getVersion() < version_1.Version.v755\r\n && this.reg.getConfig().getVersion() !== version_1.Version.Cloud) {\r\n return [];\r\n }\r\n if (o.getType() !== \"DDLS\") {\r\n return [];\r\n }\r\n if (o instanceof objects_1.DataDefinition) {\r\n const tree = o.getTree();\r\n if (tree === undefined) {\r\n return []; // parser error\r\n }\r\n if (tree.findDirectTokenByText(\"ENTITY\") === undefined) {\r\n const file = o.findSourceFile();\r\n if (file) {\r\n issues.push(issue_1.Issue.atRow(file, 1, \"CDS Legacy View\", this.getMetadata().key, this.getConfig().severity));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.CDSLegacyView = CDSLegacyView;\r\n//# sourceMappingURL=cds_legacy_view.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/cds_legacy_view.js?");
|
|
11888
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CDSLegacyView = exports.CDSLegacyViewConf = void 0;\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 version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.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 objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nclass CDSLegacyViewConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.CDSLegacyViewConf = CDSLegacyViewConf;\r\nclass CDSLegacyView {\r\n constructor() {\r\n this.conf = new CDSLegacyViewConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"cds_legacy_view\",\r\n title: \"CDS Legacy View\",\r\n shortDescription: `Identify CDS Legacy Views`,\r\n // eslint-disable-next-line max-len\r\n extendedInformation: `Use DEFINE VIEW ENTITY instead of DEFINE VIEW\r\n\r\nhttps://blogs.sap.com/2021/10/16/a-new-generation-of-cds-views-how-to-migrate-your-cds-views-to-cds-view-entities/\r\n\r\nv755 and up`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Upport],\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 initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(o) {\r\n const issues = [];\r\n if (this.reg.getConfig().getVersion() < version_1.Version.v755\r\n && this.reg.getConfig().getVersion() !== version_1.Version.Cloud) {\r\n return [];\r\n }\r\n if (o.getType() !== \"DDLS\") {\r\n return [];\r\n }\r\n if (o instanceof objects_1.DataDefinition) {\r\n const tree = o.getTree();\r\n if (tree === undefined) {\r\n return []; // parser error\r\n }\r\n if (tree.findDirectTokenByText(\"ENTITY\") === undefined) {\r\n const file = o.findSourceFile();\r\n if (file) {\r\n issues.push(issue_1.Issue.atRow(file, 1, \"CDS Legacy View\", this.getMetadata().key, this.getConfig().severity));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.CDSLegacyView = CDSLegacyView;\r\n//# sourceMappingURL=cds_legacy_view.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/cds_legacy_view.js?");
|
|
11889
11889
|
|
|
11890
11890
|
/***/ }),
|
|
11891
11891
|
|
|
@@ -11907,7 +11907,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11907
11907
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11908
11908
|
|
|
11909
11909
|
"use strict";
|
|
11910
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ChainMainlyDeclarations = exports.ChainMainlyDeclarationsConf = void 0;\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 Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass ChainMainlyDeclarationsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Allow definition statements to be chained */\r\n this.definitions = true;\r\n /** Allow WRITE statements to be chained */\r\n this.write = true;\r\n /** Allow MOVE statements to be chained */\r\n this.move = true;\r\n /** Allow REFRESH statements to be chained */\r\n this.refresh = true;\r\n /** Allow UNASSIGN statements to be chained */\r\n this.unassign = true;\r\n /** Allow CLEAR statements to be chained */\r\n this.clear = true;\r\n /** Allow HIDE statements to be chained */\r\n this.hide = true;\r\n /** Allow FREE statements to be chained */\r\n this.free = true;\r\n /** Allow INCLUDE statements to be chained */\r\n this.include = true;\r\n /** Allow CHECK statements to be chained */\r\n this.check = true;\r\n /** Allow SORT statements to be chained */\r\n this.sort = true;\r\n }\r\n}\r\nexports.ChainMainlyDeclarationsConf = ChainMainlyDeclarationsConf;\r\nclass ChainMainlyDeclarations extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ChainMainlyDeclarationsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"chain_mainly_declarations\",\r\n title: \"Chain mainly declarations\",\r\n shortDescription: `Chain mainly declarations, allows chaining for the configured statements, reports errors for other statements.`,\r\n extendedInformation: `\nhttps://docs.abapopenchecks.org/checks/23/\n\nhttps://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenchained_statements_guidl.htm\n`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],\r\n badExample: `CALL METHOD: bar.`,\r\n goodExample: `CALL METHOD bar.`,\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;\r\n const issues = [];\r\n const structure = file.getStructure();\r\n if (structure === undefined) {\r\n return [];\r\n }\r\n let previousRow;\r\n for (const statementNode of structure.findAllStatementNodes()) {\r\n const colon = statementNode.getColon();\r\n if (colon === undefined) {\r\n continue;\r\n }\r\n const statement = statementNode.get();\r\n if (this.conf.definitions === true\r\n && (statement instanceof Statements.ClassData\r\n || statement instanceof Statements.ClassDataBegin\r\n || statement instanceof Statements.ClassDataEnd\r\n || statement instanceof Statements.Static\r\n || statement instanceof Statements.StaticBegin\r\n || statement instanceof Statements.StaticEnd\r\n || statement instanceof Statements.Local\r\n || statement instanceof Statements.Constant\r\n || statement instanceof Statements.ConstantBegin\r\n || statement instanceof Statements.ConstantEnd\r\n || statement instanceof Statements.Controls\r\n || statement instanceof Statements.Parameter\r\n || statement instanceof Statements.SelectOption\r\n || statement instanceof Statements.SelectionScreen\r\n || statement instanceof Statements.Aliases\r\n || statement instanceof Statements.Tables\r\n || statement instanceof Statements.MethodDef\r\n || statement instanceof Statements.InterfaceDef\r\n || statement instanceof Statements.Type\r\n || statement instanceof Statements.TypeBegin\r\n || statement instanceof Statements.TypeEnd\r\n || statement instanceof Statements.TypeEnumBegin\r\n || statement instanceof Statements.TypeEnumEnd\r\n || statement instanceof Statements.TypeEnum\r\n || statement instanceof Statements.Events\r\n || statement instanceof Statements.Ranges\r\n || statement instanceof Statements.TypePools\r\n || statement instanceof Statements.FieldSymbol\r\n || statement instanceof Statements.Data\r\n || statement instanceof Statements.DataBegin\r\n || statement instanceof Statements.DataEnd)) {\r\n continue;\r\n }\r\n else if (this.conf.write === true && statement instanceof Statements.Write) {\r\n continue;\r\n }\r\n else if (this.conf.move === true && statement instanceof Statements.Move) {\r\n continue;\r\n }\r\n else if (this.conf.refresh === true && statement instanceof Statements.Refresh) {\r\n continue;\r\n }\r\n else if (this.conf.unassign === true && statement instanceof Statements.Unassign) {\r\n continue;\r\n }\r\n else if (this.conf.clear === true && statement instanceof Statements.Clear) {\r\n continue;\r\n }\r\n else if (this.conf.hide === true && statement instanceof Statements.Hide) {\r\n continue;\r\n }\r\n else if (this.conf.free === true && statement instanceof Statements.Free) {\r\n continue;\r\n }\r\n else if (this.conf.include === true && statement instanceof Statements.Include) {\r\n continue;\r\n }\r\n else if (this.conf.check === true && statement instanceof Statements.Check) {\r\n continue;\r\n }\r\n else if (this.conf.sort === true && statement instanceof Statements.Sort) {\r\n continue;\r\n }\r\n let prevFix;\r\n if (previousRow === colon.getStart().getRow()) {\r\n prevFix = (_a = issues.pop()) === null || _a === void 0 ? void 0 : _a.getFix();\r\n }\r\n const fix = this.getFix(file, statement, statementNode, prevFix);\r\n const message = \"Chain mainly declarations\";\r\n issues.push(issue_1.Issue.atToken(file, statementNode.getFirstToken(), message, this.getMetadata().key, this.conf.severity, fix));\r\n previousRow = statementNode.getColon().getStart().getRow();\r\n }\r\n return issues;\r\n }\r\n getFix(file, statement, statementNode, prevFix) {\r\n if (statement instanceof Statements.ClassDataBegin ||\r\n statement instanceof Statements.ClassDataEnd ||\r\n statement instanceof Statements.StaticBegin ||\r\n statement instanceof Statements.StaticEnd ||\r\n statement instanceof Statements.ConstantBegin ||\r\n statement instanceof Statements.ConstantEnd ||\r\n statement instanceof Statements.TypeBegin ||\r\n statement instanceof Statements.TypeEnd ||\r\n statement instanceof Statements.TypeEnumBegin ||\r\n statement instanceof Statements.TypeEnumEnd ||\r\n statement instanceof Statements.DataBegin ||\r\n statement instanceof Statements.DataEnd) {\r\n return undefined;\r\n }\r\n let replacement = statementNode.concatTokens();\r\n replacement = replacement.replace(\",\", \".\");\r\n let start;\r\n if (prevFix === undefined) {\r\n start = statementNode.getStart();\r\n }\r\n else {\r\n start = statementNode.getTokens()[1].getStart();\r\n }\r\n let fix = edit_helper_1.EditHelper.replaceRange(file, start, statementNode.getEnd(), replacement);\r\n if (prevFix !== undefined) {\r\n fix = edit_helper_1.EditHelper.merge(fix, prevFix);\r\n }\r\n return fix;\r\n }\r\n}\r\nexports.ChainMainlyDeclarations = ChainMainlyDeclarations;\r\n//# sourceMappingURL=chain_mainly_declarations.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/chain_mainly_declarations.js?");
|
|
11910
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ChainMainlyDeclarations = exports.ChainMainlyDeclarationsConf = void 0;\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 Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass ChainMainlyDeclarationsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Allow definition statements to be chained */\r\n this.definitions = true;\r\n /** Allow WRITE statements to be chained */\r\n this.write = true;\r\n /** Allow MOVE statements to be chained */\r\n this.move = true;\r\n /** Allow REFRESH statements to be chained */\r\n this.refresh = true;\r\n /** Allow UNASSIGN statements to be chained */\r\n this.unassign = true;\r\n /** Allow CLEAR statements to be chained */\r\n this.clear = true;\r\n /** Allow HIDE statements to be chained */\r\n this.hide = true;\r\n /** Allow FREE statements to be chained */\r\n this.free = true;\r\n /** Allow INCLUDE statements to be chained */\r\n this.include = true;\r\n /** Allow CHECK statements to be chained */\r\n this.check = true;\r\n /** Allow SORT statements to be chained */\r\n this.sort = true;\r\n }\r\n}\r\nexports.ChainMainlyDeclarationsConf = ChainMainlyDeclarationsConf;\r\nclass ChainMainlyDeclarations extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ChainMainlyDeclarationsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"chain_mainly_declarations\",\r\n title: \"Chain mainly declarations\",\r\n shortDescription: `Chain mainly declarations, allows chaining for the configured statements, reports errors for other statements.`,\r\n extendedInformation: `\r\nhttps://docs.abapopenchecks.org/checks/23/\r\n\r\nhttps://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenchained_statements_guidl.htm\r\n`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],\r\n badExample: `CALL METHOD: bar.`,\r\n goodExample: `CALL METHOD bar.`,\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;\r\n const issues = [];\r\n const structure = file.getStructure();\r\n if (structure === undefined) {\r\n return [];\r\n }\r\n let previousRow;\r\n for (const statementNode of structure.findAllStatementNodes()) {\r\n const colon = statementNode.getColon();\r\n if (colon === undefined) {\r\n continue;\r\n }\r\n const statement = statementNode.get();\r\n if (this.conf.definitions === true\r\n && (statement instanceof Statements.ClassData\r\n || statement instanceof Statements.ClassDataBegin\r\n || statement instanceof Statements.ClassDataEnd\r\n || statement instanceof Statements.Static\r\n || statement instanceof Statements.StaticBegin\r\n || statement instanceof Statements.StaticEnd\r\n || statement instanceof Statements.Local\r\n || statement instanceof Statements.Constant\r\n || statement instanceof Statements.ConstantBegin\r\n || statement instanceof Statements.ConstantEnd\r\n || statement instanceof Statements.Controls\r\n || statement instanceof Statements.Parameter\r\n || statement instanceof Statements.SelectOption\r\n || statement instanceof Statements.SelectionScreen\r\n || statement instanceof Statements.Aliases\r\n || statement instanceof Statements.Tables\r\n || statement instanceof Statements.MethodDef\r\n || statement instanceof Statements.InterfaceDef\r\n || statement instanceof Statements.Type\r\n || statement instanceof Statements.TypeBegin\r\n || statement instanceof Statements.TypeEnd\r\n || statement instanceof Statements.TypeEnumBegin\r\n || statement instanceof Statements.TypeEnumEnd\r\n || statement instanceof Statements.TypeEnum\r\n || statement instanceof Statements.Events\r\n || statement instanceof Statements.Ranges\r\n || statement instanceof Statements.TypePools\r\n || statement instanceof Statements.FieldSymbol\r\n || statement instanceof Statements.Data\r\n || statement instanceof Statements.DataBegin\r\n || statement instanceof Statements.DataEnd)) {\r\n continue;\r\n }\r\n else if (this.conf.write === true && statement instanceof Statements.Write) {\r\n continue;\r\n }\r\n else if (this.conf.move === true && statement instanceof Statements.Move) {\r\n continue;\r\n }\r\n else if (this.conf.refresh === true && statement instanceof Statements.Refresh) {\r\n continue;\r\n }\r\n else if (this.conf.unassign === true && statement instanceof Statements.Unassign) {\r\n continue;\r\n }\r\n else if (this.conf.clear === true && statement instanceof Statements.Clear) {\r\n continue;\r\n }\r\n else if (this.conf.hide === true && statement instanceof Statements.Hide) {\r\n continue;\r\n }\r\n else if (this.conf.free === true && statement instanceof Statements.Free) {\r\n continue;\r\n }\r\n else if (this.conf.include === true && statement instanceof Statements.Include) {\r\n continue;\r\n }\r\n else if (this.conf.check === true && statement instanceof Statements.Check) {\r\n continue;\r\n }\r\n else if (this.conf.sort === true && statement instanceof Statements.Sort) {\r\n continue;\r\n }\r\n let prevFix;\r\n if (previousRow === colon.getStart().getRow()) {\r\n prevFix = (_a = issues.pop()) === null || _a === void 0 ? void 0 : _a.getFix();\r\n }\r\n const fix = this.getFix(file, statement, statementNode, prevFix);\r\n const message = \"Chain mainly declarations\";\r\n issues.push(issue_1.Issue.atToken(file, statementNode.getFirstToken(), message, this.getMetadata().key, this.conf.severity, fix));\r\n previousRow = statementNode.getColon().getStart().getRow();\r\n }\r\n return issues;\r\n }\r\n getFix(file, statement, statementNode, prevFix) {\r\n if (statement instanceof Statements.ClassDataBegin ||\r\n statement instanceof Statements.ClassDataEnd ||\r\n statement instanceof Statements.StaticBegin ||\r\n statement instanceof Statements.StaticEnd ||\r\n statement instanceof Statements.ConstantBegin ||\r\n statement instanceof Statements.ConstantEnd ||\r\n statement instanceof Statements.TypeBegin ||\r\n statement instanceof Statements.TypeEnd ||\r\n statement instanceof Statements.TypeEnumBegin ||\r\n statement instanceof Statements.TypeEnumEnd ||\r\n statement instanceof Statements.DataBegin ||\r\n statement instanceof Statements.DataEnd) {\r\n return undefined;\r\n }\r\n let replacement = statementNode.concatTokens();\r\n replacement = replacement.replace(\",\", \".\");\r\n let start;\r\n if (prevFix === undefined) {\r\n start = statementNode.getStart();\r\n }\r\n else {\r\n start = statementNode.getTokens()[1].getStart();\r\n }\r\n let fix = edit_helper_1.EditHelper.replaceRange(file, start, statementNode.getEnd(), replacement);\r\n if (prevFix !== undefined) {\r\n fix = edit_helper_1.EditHelper.merge(fix, prevFix);\r\n }\r\n return fix;\r\n }\r\n}\r\nexports.ChainMainlyDeclarations = ChainMainlyDeclarations;\r\n//# sourceMappingURL=chain_mainly_declarations.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/chain_mainly_declarations.js?");
|
|
11911
11911
|
|
|
11912
11912
|
/***/ }),
|
|
11913
11913
|
|
|
@@ -11918,7 +11918,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11918
11918
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11919
11919
|
|
|
11920
11920
|
"use strict";
|
|
11921
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ChangeIfToCase = exports.ChangeIfToCaseConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\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 _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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass ChangeIfToCaseConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** skip specific names, case insensitive regular expression\r\n * @uniqueItems true\r\n */\r\n this.skipNames = [];\r\n }\r\n}\r\nexports.ChangeIfToCaseConf = ChangeIfToCaseConf;\r\nclass ChangeIfToCase extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ChangeIfToCaseConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"change_if_to_case\",\r\n title: \"Change IF to CASE\",\r\n shortDescription: `Finds IF constructs that can be changed to CASE`,\r\n // eslint-disable-next-line max-len\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-case-to-else-if-for-multiple-alternative-conditions\n\nIf the first comparison is a boolean compare, no issue is reported.`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide],\r\n badExample: `IF l_fcat-fieldname EQ 'FOO'.\nELSEIF l_fcat-fieldname = 'BAR'\n OR l_fcat-fieldname = 'MOO'.\nENDIF.`,\r\n goodExample: `CASE l_fcat-fieldname.\n WHEN 'FOO'.\n WHEN 'BAR' OR 'MOO'.\nENDCASE.`,\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;\r\n const issues = [];\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return issues;\r\n }\r\n for (const i of stru.findAllStructuresRecursive(Structures.If)) {\r\n const conds = [];\r\n const ifStatement = i.findDirectStatement(Statements.If);\r\n if (ifStatement === undefined) {\r\n continue;\r\n }\r\n if (ifStatement.concatTokens().match(/ (abap_true|abap_false)\\s*\\./i)) {\r\n continue;\r\n }\r\n conds.push(ifStatement === null || ifStatement === void 0 ? void 0 : ifStatement.findDirectExpression(Expressions.Cond));\r\n for (const ei of i.findDirectStructures(Structures.ElseIf)) {\r\n conds.push((_a = ei.findDirectStatement(Statements.ElseIf)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Cond));\r\n }\r\n if (conds.length === 1) {\r\n continue;\r\n }\r\n const issue = this.analyze(conds);\r\n if (issue === true) {\r\n const message = \"Change IF to CASE\";\r\n issues.push(issue_1.Issue.atStatement(file, ifStatement, message, this.getMetadata().key, this.getConfig().severity));\r\n }\r\n }\r\n return issues;\r\n }\r\n analyze(conds) {\r\n var _a, _b, _c, _d, _e;\r\n const tuples = [];\r\n for (const c of conds) {\r\n if (c === undefined) {\r\n continue;\r\n }\r\n if (c.findFirstExpression(Expressions.CondSub)) {\r\n return false;\r\n }\r\n else if (c.findDirectTokenByText(\"AND\") || c.findDirectTokenByText(\"EQUIV\")) {\r\n return false;\r\n }\r\n for (const compare of c.findAllExpressions(Expressions.Compare)) {\r\n const op = (_a = compare.findDirectExpression(Expressions.CompareOperator)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();\r\n if (compare.getChildren().length !== 3) {\r\n return false;\r\n }\r\n else if (op !== \"=\" && op !== \"EQ\") {\r\n return false;\r\n }\r\n const left = (_c = (_b = compare.getChildren()[0]) === null || _b === void 0 ? void 0 : _b.concatTokens()) === null || _c === void 0 ? void 0 : _c.toUpperCase();\r\n const right = (_e = (_d = compare.getChildren()[2]) === null || _d === void 0 ? void 0 : _d.concatTokens()) === null || _e === void 0 ? void 0 : _e.toUpperCase();\r\n tuples.push({ left, right });\r\n }\r\n }\r\n if (tuples.length === 1) {\r\n return false;\r\n }\r\n let chain = \"\";\r\n if (tuples[0].left === tuples[1].left) {\r\n chain = tuples[0].left;\r\n }\r\n else if (tuples[0].left === tuples[1].right) {\r\n chain = tuples[0].left;\r\n }\r\n else if (tuples[0].right === tuples[1].right) {\r\n chain = tuples[0].right;\r\n }\r\n else if (tuples[0].right === tuples[1].left) {\r\n chain = tuples[0].right;\r\n }\r\n else {\r\n return false;\r\n }\r\n for (const skip of this.getConfig().skipNames || []) {\r\n const reg = new RegExp(skip, \"i\");\r\n if (chain.match(reg)) {\r\n return false;\r\n }\r\n }\r\n for (const t of tuples) {\r\n if (t.left !== chain && t.right !== chain) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n}\r\nexports.ChangeIfToCase = ChangeIfToCase;\r\n//# sourceMappingURL=change_if_to_case.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/change_if_to_case.js?");
|
|
11921
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ChangeIfToCase = exports.ChangeIfToCaseConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\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 _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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass ChangeIfToCaseConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** skip specific names, case insensitive regular expression\r\n * @uniqueItems true\r\n */\r\n this.skipNames = [];\r\n }\r\n}\r\nexports.ChangeIfToCaseConf = ChangeIfToCaseConf;\r\nclass ChangeIfToCase extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ChangeIfToCaseConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"change_if_to_case\",\r\n title: \"Change IF to CASE\",\r\n shortDescription: `Finds IF constructs that can be changed to CASE`,\r\n // eslint-disable-next-line max-len\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-case-to-else-if-for-multiple-alternative-conditions\r\n\r\nIf the first comparison is a boolean compare, no issue is reported.`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide],\r\n badExample: `IF l_fcat-fieldname EQ 'FOO'.\r\nELSEIF l_fcat-fieldname = 'BAR'\r\n OR l_fcat-fieldname = 'MOO'.\r\nENDIF.`,\r\n goodExample: `CASE l_fcat-fieldname.\r\n WHEN 'FOO'.\r\n WHEN 'BAR' OR 'MOO'.\r\nENDCASE.`,\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;\r\n const issues = [];\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return issues;\r\n }\r\n for (const i of stru.findAllStructuresRecursive(Structures.If)) {\r\n const conds = [];\r\n const ifStatement = i.findDirectStatement(Statements.If);\r\n if (ifStatement === undefined) {\r\n continue;\r\n }\r\n if (ifStatement.concatTokens().match(/ (abap_true|abap_false)\\s*\\./i)) {\r\n continue;\r\n }\r\n conds.push(ifStatement === null || ifStatement === void 0 ? void 0 : ifStatement.findDirectExpression(Expressions.Cond));\r\n for (const ei of i.findDirectStructures(Structures.ElseIf)) {\r\n conds.push((_a = ei.findDirectStatement(Statements.ElseIf)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Cond));\r\n }\r\n if (conds.length === 1) {\r\n continue;\r\n }\r\n const issue = this.analyze(conds);\r\n if (issue === true) {\r\n const message = \"Change IF to CASE\";\r\n issues.push(issue_1.Issue.atStatement(file, ifStatement, message, this.getMetadata().key, this.getConfig().severity));\r\n }\r\n }\r\n return issues;\r\n }\r\n analyze(conds) {\r\n var _a, _b, _c, _d, _e;\r\n const tuples = [];\r\n for (const c of conds) {\r\n if (c === undefined) {\r\n continue;\r\n }\r\n if (c.findFirstExpression(Expressions.CondSub)) {\r\n return false;\r\n }\r\n else if (c.findDirectTokenByText(\"AND\") || c.findDirectTokenByText(\"EQUIV\")) {\r\n return false;\r\n }\r\n for (const compare of c.findAllExpressions(Expressions.Compare)) {\r\n const op = (_a = compare.findDirectExpression(Expressions.CompareOperator)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();\r\n if (compare.getChildren().length !== 3) {\r\n return false;\r\n }\r\n else if (op !== \"=\" && op !== \"EQ\") {\r\n return false;\r\n }\r\n const left = (_c = (_b = compare.getChildren()[0]) === null || _b === void 0 ? void 0 : _b.concatTokens()) === null || _c === void 0 ? void 0 : _c.toUpperCase();\r\n const right = (_e = (_d = compare.getChildren()[2]) === null || _d === void 0 ? void 0 : _d.concatTokens()) === null || _e === void 0 ? void 0 : _e.toUpperCase();\r\n tuples.push({ left, right });\r\n }\r\n }\r\n if (tuples.length === 1) {\r\n return false;\r\n }\r\n let chain = \"\";\r\n if (tuples[0].left === tuples[1].left) {\r\n chain = tuples[0].left;\r\n }\r\n else if (tuples[0].left === tuples[1].right) {\r\n chain = tuples[0].left;\r\n }\r\n else if (tuples[0].right === tuples[1].right) {\r\n chain = tuples[0].right;\r\n }\r\n else if (tuples[0].right === tuples[1].left) {\r\n chain = tuples[0].right;\r\n }\r\n else {\r\n return false;\r\n }\r\n for (const skip of this.getConfig().skipNames || []) {\r\n const reg = new RegExp(skip, \"i\");\r\n if (chain.match(reg)) {\r\n return false;\r\n }\r\n }\r\n for (const t of tuples) {\r\n if (t.left !== chain && t.right !== chain) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n}\r\nexports.ChangeIfToCase = ChangeIfToCase;\r\n//# sourceMappingURL=change_if_to_case.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/change_if_to_case.js?");
|
|
11922
11922
|
|
|
11923
11923
|
/***/ }),
|
|
11924
11924
|
|
|
@@ -11929,7 +11929,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11929
11929
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11930
11930
|
|
|
11931
11931
|
"use strict";
|
|
11932
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CheckAbstract = exports.CheckAbstractConf = void 0;\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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass CheckAbstractConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.CheckAbstractConf = CheckAbstractConf;\r\nvar IssueType;\r\n(function (IssueType) {\r\n /** Abstract method defined in non-abstract class */\r\n IssueType[IssueType[\"NotAbstractClass\"] = 0] = \"NotAbstractClass\";\r\n IssueType[IssueType[\"AbstractAndFinal\"] = 1] = \"AbstractAndFinal\";\r\n})(IssueType || (IssueType = {}));\r\nclass CheckAbstract extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new CheckAbstractConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"check_abstract\",\r\n title: \"Check abstract methods and classes\",\r\n shortDescription: `Checks abstract methods and classes:\n- class defined as abstract and final,\n- non-abstract class contains abstract methods`,\r\n extendedInformation: `If a class defines only constants, use an interface instead`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getDescription(issueType, name) {\r\n switch (issueType) {\r\n case IssueType.AbstractAndFinal:\r\n return \"Classes should not be ABSTRACT and FINAL: \" + name;\r\n case IssueType.NotAbstractClass:\r\n return \"Abstract methods require abstract classes: \" + name;\r\n default:\r\n return \"\";\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 const issues = [];\r\n for (const classDef of file.getInfo().listClassDefinitions()) {\r\n if (classDef.isAbstract === true) {\r\n if (classDef.isFinal === true && classDef.isForTesting === false) {\r\n issues.push(issue_1.Issue.atIdentifier(classDef.identifier, this.getDescription(IssueType.AbstractAndFinal, classDef.name), this.getMetadata().key, this.conf.severity));\r\n }\r\n continue;\r\n }\r\n for (const methodDef of classDef.methods) {\r\n if (methodDef.isAbstract === true) {\r\n issues.push(issue_1.Issue.atIdentifier(methodDef.identifier, this.getDescription(IssueType.NotAbstractClass, methodDef.name), this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.CheckAbstract = CheckAbstract;\r\n//# sourceMappingURL=check_abstract.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/check_abstract.js?");
|
|
11932
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CheckAbstract = exports.CheckAbstractConf = void 0;\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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass CheckAbstractConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.CheckAbstractConf = CheckAbstractConf;\r\nvar IssueType;\r\n(function (IssueType) {\r\n /** Abstract method defined in non-abstract class */\r\n IssueType[IssueType[\"NotAbstractClass\"] = 0] = \"NotAbstractClass\";\r\n IssueType[IssueType[\"AbstractAndFinal\"] = 1] = \"AbstractAndFinal\";\r\n})(IssueType || (IssueType = {}));\r\nclass CheckAbstract extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new CheckAbstractConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"check_abstract\",\r\n title: \"Check abstract methods and classes\",\r\n shortDescription: `Checks abstract methods and classes:\r\n- class defined as abstract and final,\r\n- non-abstract class contains abstract methods`,\r\n extendedInformation: `If a class defines only constants, use an interface instead`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getDescription(issueType, name) {\r\n switch (issueType) {\r\n case IssueType.AbstractAndFinal:\r\n return \"Classes should not be ABSTRACT and FINAL: \" + name;\r\n case IssueType.NotAbstractClass:\r\n return \"Abstract methods require abstract classes: \" + name;\r\n default:\r\n return \"\";\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 const issues = [];\r\n for (const classDef of file.getInfo().listClassDefinitions()) {\r\n if (classDef.isAbstract === true) {\r\n if (classDef.isFinal === true && classDef.isForTesting === false) {\r\n issues.push(issue_1.Issue.atIdentifier(classDef.identifier, this.getDescription(IssueType.AbstractAndFinal, classDef.name), this.getMetadata().key, this.conf.severity));\r\n }\r\n continue;\r\n }\r\n for (const methodDef of classDef.methods) {\r\n if (methodDef.isAbstract === true) {\r\n issues.push(issue_1.Issue.atIdentifier(methodDef.identifier, this.getDescription(IssueType.NotAbstractClass, methodDef.name), this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.CheckAbstract = CheckAbstract;\r\n//# sourceMappingURL=check_abstract.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/check_abstract.js?");
|
|
11933
11933
|
|
|
11934
11934
|
/***/ }),
|
|
11935
11935
|
|
|
@@ -11940,7 +11940,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11940
11940
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11941
11941
|
|
|
11942
11942
|
"use strict";
|
|
11943
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CheckComments = exports.CheckCommentsConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.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 _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass CheckCommentsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Allows the use of end-of-line comments. */\r\n this.allowEndOfLine = false;\r\n }\r\n}\r\nexports.CheckCommentsConf = CheckCommentsConf;\r\nvar IssueType;\r\n(function (IssueType) {\r\n IssueType[IssueType[\"EndOfLine\"] = 0] = \"EndOfLine\";\r\n})(IssueType || (IssueType = {}));\r\nclass CheckComments extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new CheckCommentsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"check_comments\",\r\n title: \"Check Comments\",\r\n shortDescription: `\nVarious checks for comment usage.`,\r\n extendedInformation: `\n* End of line comments. Comments starting with \"#EC\" or \"##\" are ignored\n\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#put-comments-before-the-statement-they-relate-to`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getDescription(issueType) {\r\n switch (issueType) {\r\n case IssueType.EndOfLine: return `Do not use end of line comments - move comment to previous row instead`;\r\n default: return \"\";\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 const issues = [];\r\n const rows = file.getRawRows();\r\n if (this.conf.allowEndOfLine === true) {\r\n return [];\r\n }\r\n const commentRows = [];\r\n for (let i = 0; i < rows.length; i++) {\r\n const row = rows[i];\r\n if (row.trim().startsWith(\"*\") || row.trim().startsWith(`\"`)) {\r\n commentRows.push(i);\r\n }\r\n }\r\n const statements = file.getStatements();\r\n for (let i = statements.length - 1; i >= 0; i--) {\r\n const statement = statements[i];\r\n if (statement.get() instanceof _statement_1.Comment && !commentRows.includes(statement.getStart().getRow() - 1)) {\r\n if (statement.getFirstToken().getStr().startsWith(`\"#EC`)\r\n || statement.getFirstToken().getStr().startsWith(`\"##`)) {\r\n continue;\r\n }\r\n issues.push(issue_1.Issue.atStatement(file, statement, this.getDescription(IssueType.EndOfLine), this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.CheckComments = CheckComments;\r\n//# sourceMappingURL=check_comments.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/check_comments.js?");
|
|
11943
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CheckComments = exports.CheckCommentsConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.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 _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass CheckCommentsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Allows the use of end-of-line comments. */\r\n this.allowEndOfLine = false;\r\n }\r\n}\r\nexports.CheckCommentsConf = CheckCommentsConf;\r\nvar IssueType;\r\n(function (IssueType) {\r\n IssueType[IssueType[\"EndOfLine\"] = 0] = \"EndOfLine\";\r\n})(IssueType || (IssueType = {}));\r\nclass CheckComments extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new CheckCommentsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"check_comments\",\r\n title: \"Check Comments\",\r\n shortDescription: `\r\nVarious checks for comment usage.`,\r\n extendedInformation: `\r\n* End of line comments. Comments starting with \"#EC\" or \"##\" are ignored\r\n\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#put-comments-before-the-statement-they-relate-to`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getDescription(issueType) {\r\n switch (issueType) {\r\n case IssueType.EndOfLine: return `Do not use end of line comments - move comment to previous row instead`;\r\n default: return \"\";\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 const issues = [];\r\n const rows = file.getRawRows();\r\n if (this.conf.allowEndOfLine === true) {\r\n return [];\r\n }\r\n const commentRows = [];\r\n for (let i = 0; i < rows.length; i++) {\r\n const row = rows[i];\r\n if (row.trim().startsWith(\"*\") || row.trim().startsWith(`\"`)) {\r\n commentRows.push(i);\r\n }\r\n }\r\n const statements = file.getStatements();\r\n for (let i = statements.length - 1; i >= 0; i--) {\r\n const statement = statements[i];\r\n if (statement.get() instanceof _statement_1.Comment && !commentRows.includes(statement.getStart().getRow() - 1)) {\r\n if (statement.getFirstToken().getStr().startsWith(`\"#EC`)\r\n || statement.getFirstToken().getStr().startsWith(`\"##`)) {\r\n continue;\r\n }\r\n issues.push(issue_1.Issue.atStatement(file, statement, this.getDescription(IssueType.EndOfLine), this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.CheckComments = CheckComments;\r\n//# sourceMappingURL=check_comments.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/check_comments.js?");
|
|
11944
11944
|
|
|
11945
11945
|
/***/ }),
|
|
11946
11946
|
|
|
@@ -11962,7 +11962,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11962
11962
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11963
11963
|
|
|
11964
11964
|
"use strict";
|
|
11965
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CheckInclude = exports.CheckIncludeConf = void 0;\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst include_graph_1 = __webpack_require__(/*! ../utils/include_graph */ \"./node_modules/@abaplint/core/build/src/utils/include_graph.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass CheckIncludeConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.CheckIncludeConf = CheckIncludeConf;\r\nclass CheckInclude {\r\n constructor() {\r\n this.conf = new CheckIncludeConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"check_include\",\r\n title: \"Check INCLUDEs\",\r\n shortDescription: `Checks INCLUDE statements`,\r\n extendedInformation: `\n* Reports unused includes\n* Errors if the includes are not found\n* Error if including a main program`,\r\n tags: [_irule_1.RuleTag.Syntax],\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 initialize(reg) {\r\n this.reg = reg;\r\n this.graph = new include_graph_1.IncludeGraph(this.reg);\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof _abap_object_1.ABAPObject)) {\r\n return [];\r\n }\r\n let ret = [];\r\n for (const file of obj.getABAPFiles()) {\r\n ret = ret.concat(this.graph.getIssuesFile(file));\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.CheckInclude = CheckInclude;\r\n//# sourceMappingURL=check_include.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/check_include.js?");
|
|
11965
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CheckInclude = exports.CheckIncludeConf = void 0;\r\nconst _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst include_graph_1 = __webpack_require__(/*! ../utils/include_graph */ \"./node_modules/@abaplint/core/build/src/utils/include_graph.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass CheckIncludeConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.CheckIncludeConf = CheckIncludeConf;\r\nclass CheckInclude {\r\n constructor() {\r\n this.conf = new CheckIncludeConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"check_include\",\r\n title: \"Check INCLUDEs\",\r\n shortDescription: `Checks INCLUDE statements`,\r\n extendedInformation: `\r\n* Reports unused includes\r\n* Errors if the includes are not found\r\n* Error if including a main program`,\r\n tags: [_irule_1.RuleTag.Syntax],\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 initialize(reg) {\r\n this.reg = reg;\r\n this.graph = new include_graph_1.IncludeGraph(this.reg);\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof _abap_object_1.ABAPObject)) {\r\n return [];\r\n }\r\n let ret = [];\r\n for (const file of obj.getABAPFiles()) {\r\n ret = ret.concat(this.graph.getIssuesFile(file));\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.CheckInclude = CheckInclude;\r\n//# sourceMappingURL=check_include.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/check_include.js?");
|
|
11966
11966
|
|
|
11967
11967
|
/***/ }),
|
|
11968
11968
|
|
|
@@ -11973,7 +11973,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
11973
11973
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
11974
11974
|
|
|
11975
11975
|
"use strict";
|
|
11976
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CheckSubrc = exports.CheckSubrcConf = 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 _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nclass CheckSubrcConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n this.openDataset = true;\r\n this.authorityCheck = true;\r\n this.selectSingle = true;\r\n this.selectTable = true;\r\n this.updateDatabase = true;\r\n this.insertDatabase = true;\r\n this.modifyDatabase = true;\r\n this.readTable = true;\r\n this.assign = true;\r\n this.find = true;\r\n }\r\n}\r\nexports.CheckSubrcConf = CheckSubrcConf;\r\nclass CheckSubrc extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new CheckSubrcConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"check_subrc\",\r\n title: \"Check sy-subrc\",\r\n shortDescription: `Check sy-subrc`,\r\n extendedInformation: `Pseudo comment \"#EC CI_SUBRC can be added to suppress findings\n\nIf sy-dbcnt is checked after database statements, it is considered okay.\n\n\"SELECT SINGLE @abap_true FROM \" is considered as an existence check\n\nIf IS ASSIGNED is checked after assigning, it is considered okay.\n\nFIND statement with MATCH COUNT is considered okay if subrc is not checked`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n pseudoComment: \"EC CI_SUBRC\",\r\n pragma: \"##SUBRC_OK\",\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 const issues = [];\r\n const statements = file.getStatements();\r\n const message = \"Check sy-subrc\";\r\n const config = this.getConfig();\r\n for (let i = 0; i < statements.length; i++) {\r\n const statement = statements[i];\r\n // todo: CALL FUNCTION\r\n if (statement.getPragmas().some(t => t.getStr() === this.getMetadata().pragma)) {\r\n continue;\r\n }\r\n if (config.openDataset === true\r\n && statement.get() instanceof Statements.OpenDataset\r\n && this.isChecked(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.authorityCheck === true\r\n && statement.get() instanceof Statements.AuthorityCheck\r\n && this.isChecked(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.selectSingle === true\r\n && statement.get() instanceof Statements.Select\r\n && statement.concatTokens().toUpperCase().startsWith(\"SELECT SINGLE \")\r\n && this.isChecked(i, statements) === false\r\n && this.checksDbcnt(i, statements) === false) {\r\n const concat = statement.concatTokens().toUpperCase();\r\n if (concat.startsWith(\"SELECT SINGLE @ABAP_TRUE FROM \")) {\r\n continue;\r\n }\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.selectTable === true\r\n && statement.get() instanceof Statements.Select\r\n && statement.concatTokens().toUpperCase().startsWith(\"SELECT SINGLE \") === false\r\n && this.isChecked(i, statements) === false\r\n && this.checksDbcnt(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.updateDatabase === true\r\n && statement.get() instanceof Statements.UpdateDatabase\r\n && this.isChecked(i, statements) === false\r\n && this.checksDbcnt(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.insertDatabase === true\r\n && statement.get() instanceof Statements.InsertDatabase\r\n && this.isChecked(i, statements) === false\r\n && this.checksDbcnt(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.modifyDatabase === true\r\n && statement.get() instanceof Statements.ModifyDatabase\r\n && this.isChecked(i, statements) === false\r\n && this.checksDbcnt(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.readTable === true\r\n && statement.get() instanceof Statements.ReadTable\r\n && this.isChecked(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.assign === true\r\n && statement.get() instanceof Statements.Assign\r\n && this.isChecked(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.find === true\r\n && statement.get() instanceof Statements.Find\r\n && this.isExemptedFind(statement) === false\r\n && this.isChecked(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n return issues;\r\n }\r\n ////////////////\r\n isExemptedFind(s) {\r\n // see https://github.com/abaplint/abaplint/issues/2130\r\n return s.concatTokens().toUpperCase().includes(\" MATCH COUNT \") === true;\r\n }\r\n checksDbcnt(index, statements) {\r\n for (let i = index + 1; i < statements.length; i++) {\r\n const statement = statements[i];\r\n const concat = statement.concatTokens().toUpperCase();\r\n if (statement.get() instanceof _statement_1.Comment) {\r\n continue;\r\n }\r\n else if (statement.get() instanceof Statements.EndIf) {\r\n continue;\r\n }\r\n else {\r\n return concat.includes(\"SY-DBCNT\");\r\n }\r\n }\r\n return false;\r\n }\r\n isChecked(index, statements) {\r\n var _a, _b;\r\n let assigned = undefined;\r\n let assignedn = undefined;\r\n if (statements[index].get() instanceof Statements.Assign\r\n || statements[index].get() instanceof Statements.ReadTable) {\r\n const fs = (_b = (_a = statements[index].findFirstExpression(Expressions.FSTarget)) === null || _a === void 0 ? void 0 : _a.findFirstExpression(Expressions.FieldSymbol)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr();\r\n assigned = (fs === null || fs === void 0 ? void 0 : fs.toUpperCase()) + \" IS ASSIGNED\";\r\n assignedn = (fs === null || fs === void 0 ? void 0 : fs.toUpperCase()) + \" IS NOT ASSIGNED\";\r\n }\r\n for (let i = index + 1; i < statements.length; i++) {\r\n const statement = statements[i];\r\n const concat = statement.concatTokens().toUpperCase();\r\n if (statement.get() instanceof _statement_1.Comment) {\r\n if (concat.includes(\"\" + this.getMetadata().pseudoComment)) {\r\n return true;\r\n }\r\n }\r\n else if (statement.get() instanceof Statements.EndIf) {\r\n continue;\r\n }\r\n else {\r\n if (assigned && concat.includes(assigned)) {\r\n return true;\r\n }\r\n if (assignedn && concat.includes(assignedn)) {\r\n return true;\r\n }\r\n return concat.includes(\" SY-SUBRC\")\r\n || concat.includes(\"CL_ABAP_UNIT_ASSERT=>ASSERT_SUBRC\");\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\nexports.CheckSubrc = CheckSubrc;\r\n//# sourceMappingURL=check_subrc.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/check_subrc.js?");
|
|
11976
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CheckSubrc = exports.CheckSubrcConf = 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 _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nclass CheckSubrcConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n this.openDataset = true;\r\n this.authorityCheck = true;\r\n this.selectSingle = true;\r\n this.selectTable = true;\r\n this.updateDatabase = true;\r\n this.insertDatabase = true;\r\n this.modifyDatabase = true;\r\n this.readTable = true;\r\n this.assign = true;\r\n this.find = true;\r\n }\r\n}\r\nexports.CheckSubrcConf = CheckSubrcConf;\r\nclass CheckSubrc extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new CheckSubrcConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"check_subrc\",\r\n title: \"Check sy-subrc\",\r\n shortDescription: `Check sy-subrc`,\r\n extendedInformation: `Pseudo comment \"#EC CI_SUBRC can be added to suppress findings\r\n\r\nIf sy-dbcnt is checked after database statements, it is considered okay.\r\n\r\n\"SELECT SINGLE @abap_true FROM \" is considered as an existence check\r\n\r\nIf IS ASSIGNED is checked after assigning, it is considered okay.\r\n\r\nFIND statement with MATCH COUNT is considered okay if subrc is not checked`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n pseudoComment: \"EC CI_SUBRC\",\r\n pragma: \"##SUBRC_OK\",\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 const issues = [];\r\n const statements = file.getStatements();\r\n const message = \"Check sy-subrc\";\r\n const config = this.getConfig();\r\n for (let i = 0; i < statements.length; i++) {\r\n const statement = statements[i];\r\n // todo: CALL FUNCTION\r\n if (statement.getPragmas().some(t => t.getStr() === this.getMetadata().pragma)) {\r\n continue;\r\n }\r\n if (config.openDataset === true\r\n && statement.get() instanceof Statements.OpenDataset\r\n && this.isChecked(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.authorityCheck === true\r\n && statement.get() instanceof Statements.AuthorityCheck\r\n && this.isChecked(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.selectSingle === true\r\n && statement.get() instanceof Statements.Select\r\n && statement.concatTokens().toUpperCase().startsWith(\"SELECT SINGLE \")\r\n && this.isChecked(i, statements) === false\r\n && this.checksDbcnt(i, statements) === false) {\r\n const concat = statement.concatTokens().toUpperCase();\r\n if (concat.startsWith(\"SELECT SINGLE @ABAP_TRUE FROM \")) {\r\n continue;\r\n }\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.selectTable === true\r\n && statement.get() instanceof Statements.Select\r\n && statement.concatTokens().toUpperCase().startsWith(\"SELECT SINGLE \") === false\r\n && this.isChecked(i, statements) === false\r\n && this.checksDbcnt(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.updateDatabase === true\r\n && statement.get() instanceof Statements.UpdateDatabase\r\n && this.isChecked(i, statements) === false\r\n && this.checksDbcnt(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.insertDatabase === true\r\n && statement.get() instanceof Statements.InsertDatabase\r\n && this.isChecked(i, statements) === false\r\n && this.checksDbcnt(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.modifyDatabase === true\r\n && statement.get() instanceof Statements.ModifyDatabase\r\n && this.isChecked(i, statements) === false\r\n && this.checksDbcnt(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.readTable === true\r\n && statement.get() instanceof Statements.ReadTable\r\n && this.isChecked(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.assign === true\r\n && statement.get() instanceof Statements.Assign\r\n && this.isChecked(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (config.find === true\r\n && statement.get() instanceof Statements.Find\r\n && this.isExemptedFind(statement) === false\r\n && this.isChecked(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n return issues;\r\n }\r\n ////////////////\r\n isExemptedFind(s) {\r\n // see https://github.com/abaplint/abaplint/issues/2130\r\n return s.concatTokens().toUpperCase().includes(\" MATCH COUNT \") === true;\r\n }\r\n checksDbcnt(index, statements) {\r\n for (let i = index + 1; i < statements.length; i++) {\r\n const statement = statements[i];\r\n const concat = statement.concatTokens().toUpperCase();\r\n if (statement.get() instanceof _statement_1.Comment) {\r\n continue;\r\n }\r\n else if (statement.get() instanceof Statements.EndIf) {\r\n continue;\r\n }\r\n else {\r\n return concat.includes(\"SY-DBCNT\");\r\n }\r\n }\r\n return false;\r\n }\r\n isChecked(index, statements) {\r\n var _a, _b;\r\n let assigned = undefined;\r\n let assignedn = undefined;\r\n if (statements[index].get() instanceof Statements.Assign\r\n || statements[index].get() instanceof Statements.ReadTable) {\r\n const fs = (_b = (_a = statements[index].findFirstExpression(Expressions.FSTarget)) === null || _a === void 0 ? void 0 : _a.findFirstExpression(Expressions.FieldSymbol)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr();\r\n assigned = (fs === null || fs === void 0 ? void 0 : fs.toUpperCase()) + \" IS ASSIGNED\";\r\n assignedn = (fs === null || fs === void 0 ? void 0 : fs.toUpperCase()) + \" IS NOT ASSIGNED\";\r\n }\r\n for (let i = index + 1; i < statements.length; i++) {\r\n const statement = statements[i];\r\n const concat = statement.concatTokens().toUpperCase();\r\n if (statement.get() instanceof _statement_1.Comment) {\r\n if (concat.includes(\"\" + this.getMetadata().pseudoComment)) {\r\n return true;\r\n }\r\n }\r\n else if (statement.get() instanceof Statements.EndIf) {\r\n continue;\r\n }\r\n else {\r\n if (assigned && concat.includes(assigned)) {\r\n return true;\r\n }\r\n if (assignedn && concat.includes(assignedn)) {\r\n return true;\r\n }\r\n return concat.includes(\" SY-SUBRC\")\r\n || concat.includes(\"CL_ABAP_UNIT_ASSERT=>ASSERT_SUBRC\");\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\nexports.CheckSubrc = CheckSubrc;\r\n//# sourceMappingURL=check_subrc.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/check_subrc.js?");
|
|
11977
11977
|
|
|
11978
11978
|
/***/ }),
|
|
11979
11979
|
|
|
@@ -12028,7 +12028,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12028
12028
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12029
12029
|
|
|
12030
12030
|
"use strict";
|
|
12031
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ClassicExceptionsOverlap = exports.ClassicExceptionsOverlapConf = void 0;\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 Expressions = __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 ClassicExceptionsOverlapConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.ClassicExceptionsOverlapConf = ClassicExceptionsOverlapConf;\r\nclass ClassicExceptionsOverlap extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ClassicExceptionsOverlapConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"classic_exceptions_overlap\",\r\n title: \"Classic exceptions overlap when catching\",\r\n shortDescription: `Find overlapping classic exceptions`,\r\n extendedInformation: `When debugging its typically good to know exactly which exception is caught`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: ` EXCEPTIONS\n system_failure = 1 MESSAGE lv_message\n communication_failure = 1 MESSAGE lv_message\n resource_failure = 1\n OTHERS = 1.`,\r\n goodExample: ` EXCEPTIONS\n system_failure = 1 MESSAGE lv_message\n communication_failure = 2 MESSAGE lv_message\n resource_failure = 3\n OTHERS = 4.`,\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;\r\n const output = [];\r\n const struc = file.getStructure();\r\n if (struc === undefined) {\r\n return []; // syntax error\r\n }\r\n for (const p of struc.findAllExpressions(Expressions.ParameterListExceptions)) {\r\n const set = new Set();\r\n for (const e of p.findAllExpressions(Expressions.ParameterException)) {\r\n const text = (_a = e.findDirectExpression(Expressions.SimpleName)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();\r\n if (text === undefined) {\r\n continue;\r\n }\r\n if (set.has(text)) {\r\n const message = \"Exception overlap, \" + text;\r\n const issue = issue_1.Issue.atToken(file, e.getFirstToken(), message, this.getMetadata().key, this.getConfig().severity);\r\n output.push(issue);\r\n break;\r\n }\r\n set.add(text);\r\n }\r\n }\r\n return output;\r\n }\r\n}\r\nexports.ClassicExceptionsOverlap = ClassicExceptionsOverlap;\r\n//# sourceMappingURL=classic_exceptions_overlap.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/classic_exceptions_overlap.js?");
|
|
12031
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ClassicExceptionsOverlap = exports.ClassicExceptionsOverlapConf = void 0;\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 Expressions = __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 ClassicExceptionsOverlapConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.ClassicExceptionsOverlapConf = ClassicExceptionsOverlapConf;\r\nclass ClassicExceptionsOverlap extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ClassicExceptionsOverlapConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"classic_exceptions_overlap\",\r\n title: \"Classic exceptions overlap when catching\",\r\n shortDescription: `Find overlapping classic exceptions`,\r\n extendedInformation: `When debugging its typically good to know exactly which exception is caught`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: ` EXCEPTIONS\r\n system_failure = 1 MESSAGE lv_message\r\n communication_failure = 1 MESSAGE lv_message\r\n resource_failure = 1\r\n OTHERS = 1.`,\r\n goodExample: ` EXCEPTIONS\r\n system_failure = 1 MESSAGE lv_message\r\n communication_failure = 2 MESSAGE lv_message\r\n resource_failure = 3\r\n OTHERS = 4.`,\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;\r\n const output = [];\r\n const struc = file.getStructure();\r\n if (struc === undefined) {\r\n return []; // syntax error\r\n }\r\n for (const p of struc.findAllExpressions(Expressions.ParameterListExceptions)) {\r\n const set = new Set();\r\n for (const e of p.findAllExpressions(Expressions.ParameterException)) {\r\n const text = (_a = e.findDirectExpression(Expressions.SimpleName)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();\r\n if (text === undefined) {\r\n continue;\r\n }\r\n if (set.has(text)) {\r\n const message = \"Exception overlap, \" + text;\r\n const issue = issue_1.Issue.atToken(file, e.getFirstToken(), message, this.getMetadata().key, this.getConfig().severity);\r\n output.push(issue);\r\n break;\r\n }\r\n set.add(text);\r\n }\r\n }\r\n return output;\r\n }\r\n}\r\nexports.ClassicExceptionsOverlap = ClassicExceptionsOverlap;\r\n//# sourceMappingURL=classic_exceptions_overlap.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/classic_exceptions_overlap.js?");
|
|
12032
12032
|
|
|
12033
12033
|
/***/ }),
|
|
12034
12034
|
|
|
@@ -12061,7 +12061,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12061
12061
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12062
12062
|
|
|
12063
12063
|
"use strict";
|
|
12064
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CommentedCode = exports.CommentedCodeConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.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 _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.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 abap_parser_1 = __webpack_require__(/*! ../abap/abap_parser */ \"./node_modules/@abaplint/core/build/src/abap/abap_parser.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst memory_file_1 = __webpack_require__(/*! ../files/memory_file */ \"./node_modules/@abaplint/core/build/src/files/memory_file.js\");\r\nclass CommentedCodeConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Allow INCLUDEs in function groups */\r\n this.allowIncludeInFugr = true;\r\n }\r\n}\r\nexports.CommentedCodeConf = CommentedCodeConf;\r\nclass CommentedCode extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new CommentedCodeConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"commented_code\",\r\n title: \"Find commented code\",\r\n shortDescription: `Detects usage of commented out code.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#delete-code-instead-of-commenting-it\nhttps://docs.abapopenchecks.org/checks/14/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getMessage() {\r\n return \"Commented code\";\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, obj) {\r\n let issues = [];\r\n const rows = file.getRawRows();\r\n let code = \"\";\r\n let posEnd = undefined;\r\n let posStart = undefined;\r\n for (let i = 0; i < rows.length; i++) {\r\n if (this.isCommentLine(rows[i])) {\r\n if (code === \"\") {\r\n posStart = new position_1.Position(i + 1, 1);\r\n }\r\n code = code + rows[i].trim().substr(1) + \"\\n\";\r\n posEnd = new position_1.Position(i + 1, rows[i].length + 1);\r\n }\r\n else if (code !== \"\" && posStart && posEnd) {\r\n issues = issues.concat(this.check(code.trim(), file, posStart, posEnd, obj));\r\n code = \"\";\r\n }\r\n }\r\n if (posStart && posEnd) {\r\n issues = issues.concat(this.check(code.trim(), file, posStart, posEnd, obj));\r\n }\r\n return issues;\r\n }\r\n check(code, file, posStart, posEnd, obj) {\r\n // assumption: code must end with \".\" in order to be valid ABAP\r\n if (code === \"\" || code.charAt(code.length - 1) !== \".\") {\r\n return [];\r\n }\r\n const commented = new memory_file_1.MemoryFile(\"_foobar.prog.abap\", code);\r\n const abapFile = new abap_parser_1.ABAPParser().parse([commented]).output[0];\r\n const statementNodes = abapFile.getStatements();\r\n if (statementNodes.length === 0) {\r\n return [];\r\n }\r\n let containsStatement = false;\r\n for (const statementNode of statementNodes) {\r\n const statement = statementNode.get();\r\n if (this.getConfig().allowIncludeInFugr === true\r\n && obj instanceof objects_1.FunctionGroup\r\n && statement instanceof statements_1.Include) {\r\n continue;\r\n }\r\n if (!(statement instanceof _statement_1.Unknown\r\n || statement instanceof _statement_1.Empty\r\n || statement instanceof _statement_1.Comment)) {\r\n containsStatement = true;\r\n break;\r\n }\r\n }\r\n if (!containsStatement) {\r\n return [];\r\n }\r\n const fix = edit_helper_1.EditHelper.deleteRange(file, posStart, posEnd);\r\n const issue = issue_1.Issue.atRange(file, posStart, posEnd, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n return [issue];\r\n }\r\n isCommentLine(text) {\r\n return (text.substr(0, 1) === \"*\")\r\n || (text.trim().substr(0, 1) === \"\\\"\" && text.trim().substr(1, 1) !== \"!\");\r\n }\r\n}\r\nexports.CommentedCode = CommentedCode;\r\n//# sourceMappingURL=commented_code.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/commented_code.js?");
|
|
12064
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CommentedCode = exports.CommentedCodeConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.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 _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.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 abap_parser_1 = __webpack_require__(/*! ../abap/abap_parser */ \"./node_modules/@abaplint/core/build/src/abap/abap_parser.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst memory_file_1 = __webpack_require__(/*! ../files/memory_file */ \"./node_modules/@abaplint/core/build/src/files/memory_file.js\");\r\nclass CommentedCodeConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Allow INCLUDEs in function groups */\r\n this.allowIncludeInFugr = true;\r\n }\r\n}\r\nexports.CommentedCodeConf = CommentedCodeConf;\r\nclass CommentedCode extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new CommentedCodeConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"commented_code\",\r\n title: \"Find commented code\",\r\n shortDescription: `Detects usage of commented out code.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#delete-code-instead-of-commenting-it\r\nhttps://docs.abapopenchecks.org/checks/14/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getMessage() {\r\n return \"Commented code\";\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, obj) {\r\n let issues = [];\r\n const rows = file.getRawRows();\r\n let code = \"\";\r\n let posEnd = undefined;\r\n let posStart = undefined;\r\n for (let i = 0; i < rows.length; i++) {\r\n if (this.isCommentLine(rows[i])) {\r\n if (code === \"\") {\r\n posStart = new position_1.Position(i + 1, 1);\r\n }\r\n code = code + rows[i].trim().substr(1) + \"\\n\";\r\n posEnd = new position_1.Position(i + 1, rows[i].length + 1);\r\n }\r\n else if (code !== \"\" && posStart && posEnd) {\r\n issues = issues.concat(this.check(code.trim(), file, posStart, posEnd, obj));\r\n code = \"\";\r\n }\r\n }\r\n if (posStart && posEnd) {\r\n issues = issues.concat(this.check(code.trim(), file, posStart, posEnd, obj));\r\n }\r\n return issues;\r\n }\r\n check(code, file, posStart, posEnd, obj) {\r\n // assumption: code must end with \".\" in order to be valid ABAP\r\n if (code === \"\" || code.charAt(code.length - 1) !== \".\") {\r\n return [];\r\n }\r\n const commented = new memory_file_1.MemoryFile(\"_foobar.prog.abap\", code);\r\n const abapFile = new abap_parser_1.ABAPParser().parse([commented]).output[0];\r\n const statementNodes = abapFile.getStatements();\r\n if (statementNodes.length === 0) {\r\n return [];\r\n }\r\n let containsStatement = false;\r\n for (const statementNode of statementNodes) {\r\n const statement = statementNode.get();\r\n if (this.getConfig().allowIncludeInFugr === true\r\n && obj instanceof objects_1.FunctionGroup\r\n && statement instanceof statements_1.Include) {\r\n continue;\r\n }\r\n if (!(statement instanceof _statement_1.Unknown\r\n || statement instanceof _statement_1.Empty\r\n || statement instanceof _statement_1.Comment)) {\r\n containsStatement = true;\r\n break;\r\n }\r\n }\r\n if (!containsStatement) {\r\n return [];\r\n }\r\n const fix = edit_helper_1.EditHelper.deleteRange(file, posStart, posEnd);\r\n const issue = issue_1.Issue.atRange(file, posStart, posEnd, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n return [issue];\r\n }\r\n isCommentLine(text) {\r\n return (text.substr(0, 1) === \"*\")\r\n || (text.trim().substr(0, 1) === \"\\\"\" && text.trim().substr(1, 1) !== \"!\");\r\n }\r\n}\r\nexports.CommentedCode = CommentedCode;\r\n//# sourceMappingURL=commented_code.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/commented_code.js?");
|
|
12065
12065
|
|
|
12066
12066
|
/***/ }),
|
|
12067
12067
|
|
|
@@ -12083,7 +12083,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12083
12083
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12084
12084
|
|
|
12085
12085
|
"use strict";
|
|
12086
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ConstructorVisibilityPublic = exports.ConstructorVisibilityPublicConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst visibility_1 = __webpack_require__(/*! ../abap/4_file_information/visibility */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js\");\r\nclass ConstructorVisibilityPublicConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.ConstructorVisibilityPublicConf = ConstructorVisibilityPublicConf;\r\nclass ConstructorVisibilityPublic {\r\n constructor() {\r\n this.conf = new ConstructorVisibilityPublicConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"constructor_visibility_public\",\r\n title: \"Check constructor visibility is public\",\r\n shortDescription: `Constructor must be placed in the public section, even if the class is not CREATE PUBLIC.`,\r\n extendedInformation: `\nThis only applies to global classes.\n\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#if-your-global-class-is-create-private-leave-the-constructor-public\nhttps://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abeninstance_constructor_guidl.htm`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getMessage() {\r\n return \"Constructor visibility should be public\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n initialize(_reg) {\r\n return this;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n run(obj) {\r\n const issues = [];\r\n if (!(obj instanceof objects_1.Class)) {\r\n return [];\r\n }\r\n const def = obj.getClassDefinition();\r\n if (def === undefined) {\r\n return [];\r\n }\r\n for (const method of def.methods) {\r\n if (method.name.toUpperCase() === \"CONSTRUCTOR\"\r\n && method.visibility !== visibility_1.Visibility.Public) {\r\n const issue = issue_1.Issue.atIdentifier(method.identifier, this.getMessage(), this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.ConstructorVisibilityPublic = ConstructorVisibilityPublic;\r\n//# sourceMappingURL=constructor_visibility_public.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/constructor_visibility_public.js?");
|
|
12086
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ConstructorVisibilityPublic = exports.ConstructorVisibilityPublicConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst visibility_1 = __webpack_require__(/*! ../abap/4_file_information/visibility */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js\");\r\nclass ConstructorVisibilityPublicConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.ConstructorVisibilityPublicConf = ConstructorVisibilityPublicConf;\r\nclass ConstructorVisibilityPublic {\r\n constructor() {\r\n this.conf = new ConstructorVisibilityPublicConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"constructor_visibility_public\",\r\n title: \"Check constructor visibility is public\",\r\n shortDescription: `Constructor must be placed in the public section, even if the class is not CREATE PUBLIC.`,\r\n extendedInformation: `\r\nThis only applies to global classes.\r\n\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#if-your-global-class-is-create-private-leave-the-constructor-public\r\nhttps://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abeninstance_constructor_guidl.htm`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getMessage() {\r\n return \"Constructor visibility should be public\";\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n initialize(_reg) {\r\n return this;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n run(obj) {\r\n const issues = [];\r\n if (!(obj instanceof objects_1.Class)) {\r\n return [];\r\n }\r\n const def = obj.getClassDefinition();\r\n if (def === undefined) {\r\n return [];\r\n }\r\n for (const method of def.methods) {\r\n if (method.name.toUpperCase() === \"CONSTRUCTOR\"\r\n && method.visibility !== visibility_1.Visibility.Public) {\r\n const issue = issue_1.Issue.atIdentifier(method.identifier, this.getMessage(), this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.ConstructorVisibilityPublic = ConstructorVisibilityPublic;\r\n//# sourceMappingURL=constructor_visibility_public.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/constructor_visibility_public.js?");
|
|
12087
12087
|
|
|
12088
12088
|
/***/ }),
|
|
12089
12089
|
|
|
@@ -12094,7 +12094,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12094
12094
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12095
12095
|
|
|
12096
12096
|
"use strict";
|
|
12097
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ContainsTab = exports.ContainsTabConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass ContainsTabConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** quick fix replace with number of spaces */\r\n this.spaces = 1;\r\n }\r\n}\r\nexports.ContainsTabConf = ContainsTabConf;\r\nclass ContainsTab extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ContainsTabConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"contains_tab\",\r\n title: \"Code contains tab\",\r\n shortDescription: `Checks for usage of tabs (enable to enforce spaces)`,\r\n extendedInformation: `\nhttps://docs.abapopenchecks.org/checks/09/\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#indent-and-snap-to-tab`,\r\n tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getMessage() {\r\n return \"Code should not contain tabs\";\r\n }\r\n getConfig() {\r\n if (this.conf.spaces === undefined) {\r\n this.conf.spaces = 1;\r\n }\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 const lines = file.getRaw().split(\"\\n\");\r\n lines.forEach((_, i) => {\r\n const tabCol = lines[i].indexOf(\"\\t\");\r\n if (tabCol >= 0) {\r\n let tabAmount = 1;\r\n while (lines[i].indexOf(\"\\t\", tabCol + tabAmount - 1) >= 0) {\r\n tabAmount++;\r\n }\r\n issues.push(this.createIssue(i, tabCol, tabAmount, file));\r\n }\r\n });\r\n return issues;\r\n }\r\n createIssue(line, tabCol, tabAmount, file) {\r\n const tabStartPos = new position_1.Position(line + 1, tabCol + 1);\r\n const tabEndPos = new position_1.Position(line + 1, tabCol + tabAmount);\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, tabStartPos, tabEndPos, \" \".repeat(this.getConfig().spaces));\r\n return issue_1.Issue.atRange(file, tabStartPos, tabEndPos, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n}\r\nexports.ContainsTab = ContainsTab;\r\n//# sourceMappingURL=contains_tab.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/contains_tab.js?");
|
|
12097
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ContainsTab = exports.ContainsTabConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass ContainsTabConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** quick fix replace with number of spaces */\r\n this.spaces = 1;\r\n }\r\n}\r\nexports.ContainsTabConf = ContainsTabConf;\r\nclass ContainsTab extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ContainsTabConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"contains_tab\",\r\n title: \"Code contains tab\",\r\n shortDescription: `Checks for usage of tabs (enable to enforce spaces)`,\r\n extendedInformation: `\r\nhttps://docs.abapopenchecks.org/checks/09/\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#indent-and-snap-to-tab`,\r\n tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getMessage() {\r\n return \"Code should not contain tabs\";\r\n }\r\n getConfig() {\r\n if (this.conf.spaces === undefined) {\r\n this.conf.spaces = 1;\r\n }\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 const lines = file.getRaw().split(\"\\n\");\r\n lines.forEach((_, i) => {\r\n const tabCol = lines[i].indexOf(\"\\t\");\r\n if (tabCol >= 0) {\r\n let tabAmount = 1;\r\n while (lines[i].indexOf(\"\\t\", tabCol + tabAmount - 1) >= 0) {\r\n tabAmount++;\r\n }\r\n issues.push(this.createIssue(i, tabCol, tabAmount, file));\r\n }\r\n });\r\n return issues;\r\n }\r\n createIssue(line, tabCol, tabAmount, file) {\r\n const tabStartPos = new position_1.Position(line + 1, tabCol + 1);\r\n const tabEndPos = new position_1.Position(line + 1, tabCol + tabAmount);\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, tabStartPos, tabEndPos, \" \".repeat(this.getConfig().spaces));\r\n return issue_1.Issue.atRange(file, tabStartPos, tabEndPos, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n}\r\nexports.ContainsTab = ContainsTab;\r\n//# sourceMappingURL=contains_tab.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/contains_tab.js?");
|
|
12098
12098
|
|
|
12099
12099
|
/***/ }),
|
|
12100
12100
|
|
|
@@ -12105,7 +12105,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12105
12105
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12106
12106
|
|
|
12107
12107
|
"use strict";
|
|
12108
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CyclicOO = exports.CyclicOOConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst _builtin_1 = __webpack_require__(/*! ../abap/5_syntax/_builtin */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nclass CyclicOOConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** List of object names to skip, must be full upper case name\r\n * @uniqueItems true\r\n */\r\n this.skip = [];\r\n /** Skips shared memory enabled classes*/\r\n this.skipSharedMemory = true;\r\n }\r\n}\r\nexports.CyclicOOConf = CyclicOOConf;\r\nclass CyclicOO {\r\n constructor() {\r\n this.conf = new CyclicOOConf();\r\n this.edges = {};\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"cyclic_oo\",\r\n title: \"Cyclic OO\",\r\n shortDescription: `Finds cyclic OO references`,\r\n extendedInformation: `Runs for global INTF + CLAS objects\n\nObjects must be without syntax errors for this rule to take effect`,\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 if (this.conf.skip === undefined) {\r\n this.conf.skip = [];\r\n }\r\n }\r\n initialize(reg) {\r\n var _a;\r\n this.reg = reg;\r\n this.edges = {};\r\n for (const obj of this.reg.getObjectsByType(\"CLAS\")) {\r\n if (this.reg.isDependency(obj)) {\r\n continue;\r\n }\r\n const name = obj.getName().toUpperCase();\r\n if (!(obj instanceof objects_1.Class)) {\r\n continue;\r\n }\r\n else if (this.conf.skip.indexOf(name) >= 0) {\r\n continue;\r\n }\r\n else if (this.conf.skipSharedMemory === true && ((_a = obj.getClassDefinition()) === null || _a === void 0 ? void 0 : _a.isSharedMemory) === true) {\r\n continue;\r\n }\r\n const run = new syntax_1.SyntaxLogic(this.reg, obj).run();\r\n if (run.issues.length > 0) {\r\n continue;\r\n }\r\n this.buildEdges(name, run.spaghetti.getTop());\r\n }\r\n for (const obj of this.reg.getObjectsByType(\"INTF\")) {\r\n if (this.reg.isDependency(obj)) {\r\n continue;\r\n }\r\n const name = obj.getName().toUpperCase();\r\n if (!(obj instanceof _abap_object_1.ABAPObject)) {\r\n continue;\r\n }\r\n else if (this.conf.skip.indexOf(name) >= 0) {\r\n continue;\r\n }\r\n const run = new syntax_1.SyntaxLogic(this.reg, obj).run();\r\n if (run.issues.length > 0) {\r\n continue;\r\n }\r\n this.buildEdges(name, run.spaghetti.getTop());\r\n }\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof objects_1.Interface) && !(obj instanceof objects_1.Class)) {\r\n return [];\r\n }\r\n const id = obj.getIdentifier();\r\n if (id === undefined) {\r\n return [];\r\n }\r\n const previous = {};\r\n previous[obj.getName()] = true;\r\n const path = this.findCycle(obj.getName(), obj.getName(), previous);\r\n if (path) {\r\n const message = \"Cyclic definition/usage: \" + path;\r\n return [issue_1.Issue.atIdentifier(id, message, this.getMetadata().key, this.conf.severity)];\r\n }\r\n return [];\r\n }\r\n /////////////////////////////\r\n findCycle(source, current, previous) {\r\n if (this.edges[current] === undefined) {\r\n return undefined;\r\n }\r\n for (const e of this.edges[current]) {\r\n if (e === source) {\r\n return Object.keys(previous).join(\" -> \") + \" -> \" + source;\r\n }\r\n if (previous[e] === undefined) { // dont revisit vertices\r\n previous[e] = true;\r\n const found = this.findCycle(source, e, previous);\r\n if (found) {\r\n return found;\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n buildEdges(from, node) {\r\n var _a;\r\n for (const r of node.getData().references) {\r\n if (r.resolved === undefined\r\n || node.getIdentifier().filename === r.resolved.getFilename()\r\n || r.resolved.getFilename() === _builtin_1.BuiltIn.filename) {\r\n continue;\r\n }\r\n if (r.referenceType === _reference_1.ReferenceType.ObjectOrientedReference\r\n && ((_a = r.extra) === null || _a === void 0 ? void 0 : _a.ooName)) {\r\n if (this.edges[from] === undefined) {\r\n this.edges[from] = [];\r\n }\r\n const name = r.extra.ooName.toUpperCase();\r\n if (name !== from && this.edges[from].indexOf(name) < 0) {\r\n this.edges[from].push(name);\r\n }\r\n }\r\n }\r\n for (const c of node.getChildren()) {\r\n this.buildEdges(from, c);\r\n }\r\n }\r\n}\r\nexports.CyclicOO = CyclicOO;\r\n//# sourceMappingURL=cyclic_oo.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/cyclic_oo.js?");
|
|
12108
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.CyclicOO = exports.CyclicOOConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst _builtin_1 = __webpack_require__(/*! ../abap/5_syntax/_builtin */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nclass CyclicOOConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** List of object names to skip, must be full upper case name\r\n * @uniqueItems true\r\n */\r\n this.skip = [];\r\n /** Skips shared memory enabled classes */\r\n this.skipSharedMemory = true;\r\n /** Skip testclass inclues */\r\n this.skipTestclasses = true;\r\n }\r\n}\r\nexports.CyclicOOConf = CyclicOOConf;\r\nclass CyclicOO {\r\n constructor() {\r\n this.conf = new CyclicOOConf();\r\n this.edges = {};\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"cyclic_oo\",\r\n title: \"Cyclic OO\",\r\n shortDescription: `Finds cyclic OO references`,\r\n extendedInformation: `Runs for global INTF + CLAS objects\r\n\r\nObjects must be without syntax errors for this rule to take effect`,\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 if (this.conf.skip === undefined) {\r\n this.conf.skip = [];\r\n }\r\n }\r\n initialize(reg) {\r\n var _a;\r\n this.reg = reg;\r\n this.edges = {};\r\n for (const obj of this.reg.getObjectsByType(\"CLAS\")) {\r\n if (this.reg.isDependency(obj)) {\r\n continue;\r\n }\r\n const name = obj.getName().toUpperCase();\r\n if (!(obj instanceof objects_1.Class)) {\r\n continue;\r\n }\r\n else if (this.conf.skip.indexOf(name) >= 0) {\r\n continue;\r\n }\r\n else if (this.conf.skipSharedMemory === true && ((_a = obj.getClassDefinition()) === null || _a === void 0 ? void 0 : _a.isSharedMemory) === true) {\r\n continue;\r\n }\r\n const run = new syntax_1.SyntaxLogic(this.reg, obj).run();\r\n if (run.issues.length > 0) {\r\n continue;\r\n }\r\n this.buildEdges(name, run.spaghetti.getTop());\r\n }\r\n for (const obj of this.reg.getObjectsByType(\"INTF\")) {\r\n if (this.reg.isDependency(obj)) {\r\n continue;\r\n }\r\n const name = obj.getName().toUpperCase();\r\n if (!(obj instanceof _abap_object_1.ABAPObject)) {\r\n continue;\r\n }\r\n else if (this.conf.skip.indexOf(name) >= 0) {\r\n continue;\r\n }\r\n const run = new syntax_1.SyntaxLogic(this.reg, obj).run();\r\n if (run.issues.length > 0) {\r\n continue;\r\n }\r\n this.buildEdges(name, run.spaghetti.getTop());\r\n }\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof objects_1.Interface) && !(obj instanceof objects_1.Class)) {\r\n return [];\r\n }\r\n const id = obj.getIdentifier();\r\n if (id === undefined) {\r\n return [];\r\n }\r\n const previous = {};\r\n previous[obj.getName()] = true;\r\n const path = this.findCycle(obj.getName(), obj.getName(), previous);\r\n if (path) {\r\n const message = \"Cyclic definition/usage: \" + path;\r\n return [issue_1.Issue.atIdentifier(id, message, this.getMetadata().key, this.conf.severity)];\r\n }\r\n return [];\r\n }\r\n /////////////////////////////\r\n findCycle(source, current, previous) {\r\n if (this.edges[current] === undefined) {\r\n return undefined;\r\n }\r\n for (const e of this.edges[current]) {\r\n if (e === source) {\r\n return Object.keys(previous).join(\" -> \") + \" -> \" + source;\r\n }\r\n if (previous[e] === undefined) { // dont revisit vertices\r\n previous[e] = true;\r\n const found = this.findCycle(source, e, previous);\r\n if (found) {\r\n return found;\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n buildEdges(from, node) {\r\n var _a;\r\n for (const r of node.getData().references) {\r\n if (r.resolved === undefined\r\n || node.getIdentifier().filename === r.resolved.getFilename()\r\n || r.resolved.getFilename() === _builtin_1.BuiltIn.filename) {\r\n continue;\r\n }\r\n if (this.conf.skipTestclasses === true\r\n && r.position.getFilename().includes(\".testclasses.abap\")) {\r\n continue;\r\n }\r\n if (r.referenceType === _reference_1.ReferenceType.ObjectOrientedReference\r\n && ((_a = r.extra) === null || _a === void 0 ? void 0 : _a.ooName)) {\r\n if (this.edges[from] === undefined) {\r\n this.edges[from] = [];\r\n }\r\n const name = r.extra.ooName.toUpperCase();\r\n if (name !== from && this.edges[from].indexOf(name) < 0) {\r\n const obj = this.reg.getObject(\"INTF\", name) || this.reg.getObject(\"CLAS\", name);\r\n if (obj && this.reg.isDependency(obj)) {\r\n continue;\r\n }\r\n this.edges[from].push(name);\r\n }\r\n }\r\n }\r\n for (const c of node.getChildren()) {\r\n this.buildEdges(from, c);\r\n }\r\n }\r\n}\r\nexports.CyclicOO = CyclicOO;\r\n//# sourceMappingURL=cyclic_oo.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/cyclic_oo.js?");
|
|
12109
12109
|
|
|
12110
12110
|
/***/ }),
|
|
12111
12111
|
|
|
@@ -12127,7 +12127,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12127
12127
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12128
12128
|
|
|
12129
12129
|
"use strict";
|
|
12130
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DangerousStatement = exports.DangerousStatementConf = 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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass DangerousStatementConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Detects execSQL (dynamic SQL) */\r\n this.execSQL = true;\r\n /** Detects kernel calls */\r\n this.kernelCall = true;\r\n /** Detects SYSTEM-CALL */\r\n this.systemCall = true;\r\n /** Detects INSERT REPORT */\r\n this.insertReport = true;\r\n this.generateDynpro = true;\r\n this.generateReport = true;\r\n this.generateSubroutine = true;\r\n this.deleteReport = true;\r\n this.deleteTextpool = true;\r\n this.deleteDynpro = true;\r\n this.exportDynpro = true;\r\n /** Finds instances of dynamic SQL: SELECT, UPDATE, DELETE, INSERT, MODIFY */\r\n this.dynamicSQL = true;\r\n }\r\n}\r\nexports.DangerousStatementConf = DangerousStatementConf;\r\nclass DangerousStatement extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new DangerousStatementConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"dangerous_statement\",\r\n title: \"Dangerous statement\",\r\n shortDescription: `Detects potentially dangerous statements`,\r\n extendedInformation: `Dynamic SQL: Typically ABAP logic does not need dynamic SQL,\ndynamic SQL can potentially create SQL injection problems`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Security],\r\n };\r\n }\r\n getDescription(statement) {\r\n return \"Potential dangerous statement \" + statement;\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 for (const statementNode of file.getStatements()) {\r\n const statement = statementNode.get();\r\n let message = undefined;\r\n if (this.conf.execSQL && statement instanceof Statements.ExecSQL) {\r\n message = \"EXEC SQL\";\r\n }\r\n else if (this.conf.kernelCall && statement instanceof Statements.CallKernel) {\r\n message = \"KERNEL CALL\";\r\n }\r\n else if (this.conf.systemCall && statement instanceof Statements.SystemCall) {\r\n message = \"SYSTEM-CALL\";\r\n }\r\n else if (this.conf.insertReport && statement instanceof Statements.InsertReport) {\r\n message = \"INSERT REPORT\";\r\n }\r\n else if (this.conf.generateDynpro && statement instanceof Statements.GenerateDynpro) {\r\n message = \"GENERATE DYNPRO\";\r\n }\r\n else if (this.conf.generateReport && statement instanceof Statements.GenerateReport) {\r\n message = \"GENERATE REPORT\";\r\n }\r\n else if (this.conf.generateSubroutine && statement instanceof Statements.GenerateSubroutine) {\r\n message = \"GENERATE SUBROUTINE\";\r\n }\r\n else if (this.conf.deleteReport && statement instanceof Statements.DeleteReport) {\r\n message = \"DELETE REPORT\";\r\n }\r\n else if (this.conf.deleteTextpool && statement instanceof Statements.DeleteTextpool) {\r\n message = \"DELETE TEXTPOOL\";\r\n }\r\n else if (this.conf.deleteDynpro && statement instanceof Statements.DeleteDynpro) {\r\n message = \"DELETE DYNPRO\";\r\n }\r\n else if (this.conf.exportDynpro && statement instanceof Statements.ExportDynpro) {\r\n message = \"EXPORT DYNPRO\";\r\n }\r\n if (message) {\r\n issues.push(issue_1.Issue.atStatement(file, statementNode, this.getDescription(message), this.getMetadata().key, this.conf.severity));\r\n }\r\n if (this.conf.dynamicSQL) {\r\n message = this.findDynamicSQL(statementNode);\r\n if (message) {\r\n issues.push(issue_1.Issue.atStatement(file, statementNode, this.getDescription(message), this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n findDynamicSQL(statementNode) {\r\n const statement = statementNode.get();\r\n if (statement instanceof Statements.UpdateDatabase\r\n || statement instanceof Statements.Select\r\n || statement instanceof Statements.SelectLoop\r\n || statement instanceof Statements.InsertDatabase\r\n || statement instanceof Statements.ModifyDatabase\r\n || statement instanceof Statements.DeleteDatabase) {\r\n const dyn = statementNode.findFirstExpression(Expressions.Dynamic);\r\n if (dyn && dyn.findDirectExpression(Expressions.Constant) === undefined) {\r\n return \"Dynamic SQL\";\r\n }\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.DangerousStatement = DangerousStatement;\r\n//# sourceMappingURL=dangerous_statement.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/dangerous_statement.js?");
|
|
12130
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DangerousStatement = exports.DangerousStatementConf = 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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass DangerousStatementConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Detects execSQL (dynamic SQL) */\r\n this.execSQL = true;\r\n /** Detects kernel calls */\r\n this.kernelCall = true;\r\n /** Detects SYSTEM-CALL */\r\n this.systemCall = true;\r\n /** Detects INSERT REPORT */\r\n this.insertReport = true;\r\n this.generateDynpro = true;\r\n this.generateReport = true;\r\n this.generateSubroutine = true;\r\n this.deleteReport = true;\r\n this.deleteTextpool = true;\r\n this.deleteDynpro = true;\r\n this.exportDynpro = true;\r\n /** Finds instances of dynamic SQL: SELECT, UPDATE, DELETE, INSERT, MODIFY */\r\n this.dynamicSQL = true;\r\n }\r\n}\r\nexports.DangerousStatementConf = DangerousStatementConf;\r\nclass DangerousStatement extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new DangerousStatementConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"dangerous_statement\",\r\n title: \"Dangerous statement\",\r\n shortDescription: `Detects potentially dangerous statements`,\r\n extendedInformation: `Dynamic SQL: Typically ABAP logic does not need dynamic SQL,\r\ndynamic SQL can potentially create SQL injection problems`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Security],\r\n };\r\n }\r\n getDescription(statement) {\r\n return \"Potential dangerous statement \" + statement;\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 for (const statementNode of file.getStatements()) {\r\n const statement = statementNode.get();\r\n let message = undefined;\r\n if (this.conf.execSQL && statement instanceof Statements.ExecSQL) {\r\n message = \"EXEC SQL\";\r\n }\r\n else if (this.conf.kernelCall && statement instanceof Statements.CallKernel) {\r\n message = \"KERNEL CALL\";\r\n }\r\n else if (this.conf.systemCall && statement instanceof Statements.SystemCall) {\r\n message = \"SYSTEM-CALL\";\r\n }\r\n else if (this.conf.insertReport && statement instanceof Statements.InsertReport) {\r\n message = \"INSERT REPORT\";\r\n }\r\n else if (this.conf.generateDynpro && statement instanceof Statements.GenerateDynpro) {\r\n message = \"GENERATE DYNPRO\";\r\n }\r\n else if (this.conf.generateReport && statement instanceof Statements.GenerateReport) {\r\n message = \"GENERATE REPORT\";\r\n }\r\n else if (this.conf.generateSubroutine && statement instanceof Statements.GenerateSubroutine) {\r\n message = \"GENERATE SUBROUTINE\";\r\n }\r\n else if (this.conf.deleteReport && statement instanceof Statements.DeleteReport) {\r\n message = \"DELETE REPORT\";\r\n }\r\n else if (this.conf.deleteTextpool && statement instanceof Statements.DeleteTextpool) {\r\n message = \"DELETE TEXTPOOL\";\r\n }\r\n else if (this.conf.deleteDynpro && statement instanceof Statements.DeleteDynpro) {\r\n message = \"DELETE DYNPRO\";\r\n }\r\n else if (this.conf.exportDynpro && statement instanceof Statements.ExportDynpro) {\r\n message = \"EXPORT DYNPRO\";\r\n }\r\n if (message) {\r\n issues.push(issue_1.Issue.atStatement(file, statementNode, this.getDescription(message), this.getMetadata().key, this.conf.severity));\r\n }\r\n if (this.conf.dynamicSQL) {\r\n message = this.findDynamicSQL(statementNode);\r\n if (message) {\r\n issues.push(issue_1.Issue.atStatement(file, statementNode, this.getDescription(message), this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n findDynamicSQL(statementNode) {\r\n const statement = statementNode.get();\r\n if (statement instanceof Statements.UpdateDatabase\r\n || statement instanceof Statements.Select\r\n || statement instanceof Statements.SelectLoop\r\n || statement instanceof Statements.InsertDatabase\r\n || statement instanceof Statements.ModifyDatabase\r\n || statement instanceof Statements.DeleteDatabase) {\r\n const dyn = statementNode.findFirstExpression(Expressions.Dynamic);\r\n if (dyn && dyn.findDirectExpression(Expressions.Constant) === undefined) {\r\n return \"Dynamic SQL\";\r\n }\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.DangerousStatement = DangerousStatement;\r\n//# sourceMappingURL=dangerous_statement.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/dangerous_statement.js?");
|
|
12131
12131
|
|
|
12132
12132
|
/***/ }),
|
|
12133
12133
|
|
|
@@ -12149,7 +12149,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12149
12149
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12150
12150
|
|
|
12151
12151
|
"use strict";
|
|
12152
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DefinitionsTop = exports.DefinitionsTopConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\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 Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.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 version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nclass DefinitionsTopConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.DefinitionsTopConf = DefinitionsTopConf;\r\n// todo, use enum instead?\r\n// const ANY = 1;\r\nconst DEFINITION = 2;\r\nconst AFTER = 3;\r\nconst IGNORE = 4;\r\nclass DefinitionsTop extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new DefinitionsTopConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"definitions_top\",\r\n title: \"Place definitions in top of routine\",\r\n shortDescription: `Checks that definitions are placed at the beginning of METHODs and FORMs.`,\r\n extendedInformation: `If the routine has inline definitions then no issues are reported\n\nhttps://docs.abapopenchecks.org/checks/17/`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],\r\n };\r\n }\r\n getMessage() {\r\n return \"Reorder definitions to top of routine\";\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;\r\n const issues = [];\r\n const structure = file.getStructure();\r\n if (structure === undefined) {\r\n return [];\r\n }\r\n const containsUnknown = file.getStatements().some(s => s.get() instanceof _statement_1.Unknown);\r\n if (containsUnknown === true) {\r\n return [];\r\n }\r\n const routines = structure.findAllStructuresMulti([Structures.Form, Structures.Method]);\r\n for (const r of routines) {\r\n // one fix per routine\r\n this.fixed = false;\r\n this.mode = DEFINITION;\r\n this.moveTo = (_a = r.getFirstStatement()) === null || _a === void 0 ? void 0 : _a.getLastToken().getEnd();\r\n if (this.reg.getConfig().getVersion() !== version_1.Version.v702\r\n && r.findFirstExpression(Expressions.InlineData)) {\r\n continue;\r\n }\r\n const found = this.walk(r, file);\r\n if (found) {\r\n issues.push(found);\r\n }\r\n }\r\n return issues;\r\n }\r\n //////////////////\r\n walk(r, file) {\r\n var _a, _b, _c, _d, _e, _f;\r\n let previous = undefined;\r\n for (const c of r.getChildren()) {\r\n const get = c.get();\r\n if (c instanceof nodes_1.StatementNode) {\r\n if (get instanceof _statement_1.Comment) {\r\n continue;\r\n }\r\n else if (get instanceof Statements.Form) {\r\n continue;\r\n }\r\n else if (get instanceof Statements.MethodImplementation) {\r\n continue;\r\n }\r\n }\r\n if (c instanceof nodes_1.StructureNode\r\n && (get instanceof Structures.Data\r\n || get instanceof Structures.Types\r\n || get instanceof Structures.Constants\r\n || get instanceof Structures.Statics)) {\r\n if (this.mode === AFTER) {\r\n // These are chained structured statements\r\n let fix = undefined;\r\n if (((_b = (_a = c.getLastChild()) === null || _a === void 0 ? void 0 : _a.getLastChild()) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr()) === \".\"\r\n && !(previous instanceof nodes_1.StructureNode)\r\n && this.moveTo) {\r\n // this is not perfect, but will work for now\r\n const start = (_d = (_c = c.getFirstChild()) === null || _c === void 0 ? void 0 : _c.getFirstChild()) === null || _d === void 0 ? void 0 : _d.getFirstToken().getStart();\r\n const end = (_f = (_e = c.getLastChild()) === null || _e === void 0 ? void 0 : _e.getLastChild()) === null || _f === void 0 ? void 0 : _f.getLastToken().getEnd();\r\n if (start && end) {\r\n let concat = c.concatTokens();\r\n concat = concat.replace(/,/g, \".\\n\");\r\n const fix1 = edit_helper_1.EditHelper.deleteRange(file, start, end);\r\n const fix2 = edit_helper_1.EditHelper.insertAt(file, this.moveTo, \"\\n\" + concat);\r\n fix = edit_helper_1.EditHelper.merge(fix1, fix2);\r\n }\r\n }\r\n // no quick fixes for these, its difficult?\r\n return issue_1.Issue.atStatement(file, c.getFirstStatement(), this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n else {\r\n this.moveTo = c.getLastToken().getEnd();\r\n }\r\n }\r\n else if (c instanceof nodes_1.StatementNode\r\n && (get instanceof Statements.Data\r\n || get instanceof Statements.Type\r\n || get instanceof Statements.Constant\r\n || get instanceof Statements.Static\r\n || get instanceof Statements.FieldSymbol)) {\r\n if (this.mode === AFTER) {\r\n // only one fix per routine, as it reorders a lot\r\n let fix = undefined;\r\n if (this.fixed === false && this.moveTo) {\r\n fix = this.buildFix(file, c, this.moveTo);\r\n this.fixed = true;\r\n }\r\n return issue_1.Issue.atStatement(file, c, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n else {\r\n this.moveTo = c.getLastToken().getEnd();\r\n }\r\n }\r\n else if (c instanceof nodes_1.StructureNode && get instanceof Structures.Define) {\r\n this.mode = IGNORE;\r\n return undefined;\r\n }\r\n else if (c instanceof nodes_1.StatementNode && get instanceof _statement_1.Unknown) {\r\n this.mode = IGNORE;\r\n return undefined;\r\n }\r\n else if (c instanceof nodes_1.StatementNode && this.mode === DEFINITION) {\r\n this.mode = AFTER;\r\n }\r\n else if (c instanceof nodes_1.StructureNode) {\r\n const found = this.walk(c, file);\r\n if (found) {\r\n return found;\r\n }\r\n }\r\n previous = c;\r\n }\r\n return undefined;\r\n }\r\n buildFix(file, statement, at) {\r\n let concat = statement.concatTokens();\r\n concat = concat.replace(/,$/, \".\");\r\n const fix1 = edit_helper_1.EditHelper.deleteStatement(file, statement);\r\n const indentation = \" \".repeat(statement.getFirstToken().getCol() - 1);\r\n const fix2 = edit_helper_1.EditHelper.insertAt(file, at, \"\\n\" + indentation + concat);\r\n return edit_helper_1.EditHelper.merge(fix1, fix2);\r\n }\r\n}\r\nexports.DefinitionsTop = DefinitionsTop;\r\n//# sourceMappingURL=definitions_top.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/definitions_top.js?");
|
|
12152
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.DefinitionsTop = exports.DefinitionsTopConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\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 Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.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 version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nclass DefinitionsTopConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.DefinitionsTopConf = DefinitionsTopConf;\r\n// todo, use enum instead?\r\n// const ANY = 1;\r\nconst DEFINITION = 2;\r\nconst AFTER = 3;\r\nconst IGNORE = 4;\r\nclass DefinitionsTop extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new DefinitionsTopConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"definitions_top\",\r\n title: \"Place definitions in top of routine\",\r\n shortDescription: `Checks that definitions are placed at the beginning of METHODs and FORMs.`,\r\n extendedInformation: `If the routine has inline definitions then no issues are reported\r\n\r\nhttps://docs.abapopenchecks.org/checks/17/`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],\r\n };\r\n }\r\n getMessage() {\r\n return \"Reorder definitions to top of routine\";\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;\r\n const issues = [];\r\n const structure = file.getStructure();\r\n if (structure === undefined) {\r\n return [];\r\n }\r\n const containsUnknown = file.getStatements().some(s => s.get() instanceof _statement_1.Unknown);\r\n if (containsUnknown === true) {\r\n return [];\r\n }\r\n const routines = structure.findAllStructuresMulti([Structures.Form, Structures.Method]);\r\n for (const r of routines) {\r\n // one fix per routine\r\n this.fixed = false;\r\n this.mode = DEFINITION;\r\n this.moveTo = (_a = r.getFirstStatement()) === null || _a === void 0 ? void 0 : _a.getLastToken().getEnd();\r\n if (this.reg.getConfig().getVersion() !== version_1.Version.v702\r\n && r.findFirstExpression(Expressions.InlineData)) {\r\n continue;\r\n }\r\n const found = this.walk(r, file);\r\n if (found) {\r\n issues.push(found);\r\n }\r\n }\r\n return issues;\r\n }\r\n //////////////////\r\n walk(r, file) {\r\n var _a, _b, _c, _d, _e, _f;\r\n let previous = undefined;\r\n for (const c of r.getChildren()) {\r\n const get = c.get();\r\n if (c instanceof nodes_1.StatementNode) {\r\n if (get instanceof _statement_1.Comment) {\r\n continue;\r\n }\r\n else if (get instanceof Statements.Form) {\r\n continue;\r\n }\r\n else if (get instanceof Statements.MethodImplementation) {\r\n continue;\r\n }\r\n }\r\n if (c instanceof nodes_1.StructureNode\r\n && (get instanceof Structures.Data\r\n || get instanceof Structures.Types\r\n || get instanceof Structures.Constants\r\n || get instanceof Structures.Statics)) {\r\n if (this.mode === AFTER) {\r\n // These are chained structured statements\r\n let fix = undefined;\r\n if (((_b = (_a = c.getLastChild()) === null || _a === void 0 ? void 0 : _a.getLastChild()) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr()) === \".\"\r\n && !(previous instanceof nodes_1.StructureNode)\r\n && this.moveTo) {\r\n // this is not perfect, but will work for now\r\n const start = (_d = (_c = c.getFirstChild()) === null || _c === void 0 ? void 0 : _c.getFirstChild()) === null || _d === void 0 ? void 0 : _d.getFirstToken().getStart();\r\n const end = (_f = (_e = c.getLastChild()) === null || _e === void 0 ? void 0 : _e.getLastChild()) === null || _f === void 0 ? void 0 : _f.getLastToken().getEnd();\r\n if (start && end) {\r\n let concat = c.concatTokens();\r\n concat = concat.replace(/,/g, \".\\n\");\r\n const fix1 = edit_helper_1.EditHelper.deleteRange(file, start, end);\r\n const fix2 = edit_helper_1.EditHelper.insertAt(file, this.moveTo, \"\\n\" + concat);\r\n fix = edit_helper_1.EditHelper.merge(fix1, fix2);\r\n }\r\n }\r\n // no quick fixes for these, its difficult?\r\n return issue_1.Issue.atStatement(file, c.getFirstStatement(), this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n else {\r\n this.moveTo = c.getLastToken().getEnd();\r\n }\r\n }\r\n else if (c instanceof nodes_1.StatementNode\r\n && (get instanceof Statements.Data\r\n || get instanceof Statements.Type\r\n || get instanceof Statements.Constant\r\n || get instanceof Statements.Static\r\n || get instanceof Statements.FieldSymbol)) {\r\n if (this.mode === AFTER) {\r\n // only one fix per routine, as it reorders a lot\r\n let fix = undefined;\r\n if (this.fixed === false && this.moveTo) {\r\n fix = this.buildFix(file, c, this.moveTo);\r\n this.fixed = true;\r\n }\r\n return issue_1.Issue.atStatement(file, c, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n else {\r\n this.moveTo = c.getLastToken().getEnd();\r\n }\r\n }\r\n else if (c instanceof nodes_1.StructureNode && get instanceof Structures.Define) {\r\n this.mode = IGNORE;\r\n return undefined;\r\n }\r\n else if (c instanceof nodes_1.StatementNode && get instanceof _statement_1.Unknown) {\r\n this.mode = IGNORE;\r\n return undefined;\r\n }\r\n else if (c instanceof nodes_1.StatementNode && this.mode === DEFINITION) {\r\n this.mode = AFTER;\r\n }\r\n else if (c instanceof nodes_1.StructureNode) {\r\n const found = this.walk(c, file);\r\n if (found) {\r\n return found;\r\n }\r\n }\r\n previous = c;\r\n }\r\n return undefined;\r\n }\r\n buildFix(file, statement, at) {\r\n let concat = statement.concatTokens();\r\n concat = concat.replace(/,$/, \".\");\r\n const fix1 = edit_helper_1.EditHelper.deleteStatement(file, statement);\r\n const indentation = \" \".repeat(statement.getFirstToken().getCol() - 1);\r\n const fix2 = edit_helper_1.EditHelper.insertAt(file, at, \"\\n\" + indentation + concat);\r\n return edit_helper_1.EditHelper.merge(fix1, fix2);\r\n }\r\n}\r\nexports.DefinitionsTop = DefinitionsTop;\r\n//# sourceMappingURL=definitions_top.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/definitions_top.js?");
|
|
12153
12153
|
|
|
12154
12154
|
/***/ }),
|
|
12155
12155
|
|
|
@@ -12182,7 +12182,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12182
12182
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12183
12183
|
|
|
12184
12184
|
"use strict";
|
|
12185
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Downport = exports.DownportConf = void 0;\r\n/* eslint-disable max-len */\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 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 _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst registry_1 = __webpack_require__(/*! ../registry */ \"./node_modules/@abaplint/core/build/src/registry.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\r\nconst basic_1 = __webpack_require__(/*! ../abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst config_1 = __webpack_require__(/*! ../config */ \"./node_modules/@abaplint/core/build/src/config.js\");\r\nconst tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nconst include_graph_1 = __webpack_require__(/*! ../utils/include_graph */ \"./node_modules/@abaplint/core/build/src/utils/include_graph.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst _builtin_1 = __webpack_require__(/*! ../abap/5_syntax/_builtin */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin.js\");\r\nconst _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\r\n// todo: refactor each sub-rule to new classes?\r\n// todo: add configuration\r\nclass DownportConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.DownportConf = DownportConf;\r\nclass SkipToNextFile extends Error {\r\n constructor(issue) {\r\n super();\r\n this.issue = issue;\r\n }\r\n}\r\nclass SpagHelper {\r\n constructor(spag) {\r\n this.spag = spag;\r\n }\r\n renameVariable(oldName, pos, lowFile, newName) {\r\n let fix = undefined;\r\n const references = this.findReferences(oldName, pos);\r\n references.sort((a, b) => {\r\n if (a.start.equals(b.start)) {\r\n return 0;\r\n }\r\n return a.start.isAfter(b.start) ? 1 : -1;\r\n });\r\n for (const r of references) {\r\n const replace = edit_helper_1.EditHelper.replaceRange(lowFile, r.start, r.end, newName);\r\n if (fix === undefined) {\r\n fix = replace;\r\n }\r\n else {\r\n fix = edit_helper_1.EditHelper.merge(replace, fix);\r\n }\r\n }\r\n return fix;\r\n }\r\n findReferences(name, pos) {\r\n var _a, _b;\r\n const positions = [];\r\n function has(element) {\r\n return positions.some(a => a.start.equals(element.start));\r\n }\r\n for (const r of this.spag.getData().references) {\r\n if (((_a = r.resolved) === null || _a === void 0 ? void 0 : _a.getName()) === name && ((_b = r.resolved) === null || _b === void 0 ? void 0 : _b.getStart().equals(pos))) {\r\n const sub = {\r\n start: r.position.getStart(),\r\n end: r.position.getEnd(),\r\n };\r\n if (has(sub) === false) {\r\n positions.push(sub);\r\n }\r\n }\r\n }\r\n for (const child of this.spag.getChildren()) {\r\n const subPositions = new SpagHelper(child).findReferences(name, pos);\r\n for (const sub of subPositions) {\r\n if (has(sub) === false) {\r\n positions.push(sub);\r\n }\r\n }\r\n }\r\n return positions;\r\n }\r\n findRecursiveDuplicate(name, skip) {\r\n var _a;\r\n const found = this.spag.findVariable(name);\r\n if ((found === null || found === void 0 ? void 0 : found.getStart().equals(skip)) === false) {\r\n return found;\r\n }\r\n for (const child of ((_a = this.spag) === null || _a === void 0 ? void 0 : _a.getChildren()) || []) {\r\n const sub = new SpagHelper(child).findRecursiveDuplicate(name, skip);\r\n if (sub) {\r\n return sub;\r\n }\r\n }\r\n return undefined;\r\n }\r\n isDuplicateName(name, pos) {\r\n let parent = this.spag.getParent();\r\n while ((parent === null || parent === void 0 ? void 0 : parent.getIdentifier().stype) === _scope_type_1.ScopeType.Let\r\n || (parent === null || parent === void 0 ? void 0 : parent.getIdentifier().stype) === _scope_type_1.ScopeType.For) {\r\n parent = parent.getParent();\r\n }\r\n if (parent === undefined) {\r\n return undefined;\r\n }\r\n return new SpagHelper(parent).findRecursiveDuplicate(name, pos) !== undefined;\r\n }\r\n}\r\nclass Downport {\r\n constructor() {\r\n this.conf = new DownportConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"downport\",\r\n title: \"Downport statement\",\r\n shortDescription: `Experimental downport functionality`,\r\n extendedInformation: `Much like the 'commented_code' rule this rule loops through unknown statements and tries parsing with\na higher level language version. If successful, various rules are applied to downport the statement.\nTarget downport version is always v702, thus rule is only enabled if target version is v702.\n\nCurrent rules:\n* NEW transformed to CREATE OBJECT, opposite of https://rules.abaplint.org/use_new/\n* DATA() definitions are outlined, opposite of https://rules.abaplint.org/prefer_inline/\n* FIELD-SYMBOL() definitions are outlined\n* CONV is outlined\n* COND is outlined\n* REDUCE is outlined\n* SWITCH is outlined\n* FILTER is outlined\n* APPEND expression is outlined\n* INSERT expression is outlined\n* EMPTY KEY is changed to DEFAULT KEY, opposite of DEFAULT KEY in https://rules.abaplint.org/avoid_use/\n* CAST changed to ?=\n* LOOP AT method_call( ) is outlined\n* VALUE # with structure fields\n* VALUE # with internal table lines\n* Table Expressions are outlined\n* SELECT INTO @DATA definitions are outlined\n* Some occurrences of string template formatting option ALPHA changed to function module call\n* SELECT/INSERT/MODIFY/DELETE/UPDATE \",\" in field list removed, \"@\" in source/targets removed\n* PARTIALLY IMPLEMENTED removed, it can be quick fixed via rule implement_methods\n* RAISE EXCEPTION ... MESSAGE\n* Moving with +=, -=, /=, *=, &&= is expanded\n* line_exists and line_index is downported to READ TABLE\n* ENUMs, but does not nessesarily give the correct type and value\n* MESSAGE with non simple source\n\nOnly one transformation is applied to a statement at a time, so multiple steps might be required to do the full downport.`,\r\n tags: [_irule_1.RuleTag.Experimental, _irule_1.RuleTag.Downport, _irule_1.RuleTag.Quickfix],\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 initialize(reg) {\r\n this.lowReg = reg;\r\n const version = this.lowReg.getConfig().getVersion();\r\n if (version === version_1.Version.v702 || version === version_1.Version.OpenABAP) {\r\n this.initHighReg();\r\n }\r\n return this;\r\n }\r\n listMainForInclude(filename) {\r\n if (filename === undefined) {\r\n return [];\r\n }\r\n // only initialize this.graph if needed\r\n if (this.graph === undefined) {\r\n this.graph = new include_graph_1.IncludeGraph(this.lowReg);\r\n }\r\n return this.graph.listMainForInclude(filename);\r\n }\r\n run(lowObj) {\r\n var _a;\r\n const ret = [];\r\n this.counter = 1;\r\n const version = this.lowReg.getConfig().getVersion();\r\n if (version !== version_1.Version.v702 && version !== version_1.Version.OpenABAP) {\r\n return ret;\r\n }\r\n else if (!(lowObj instanceof _abap_object_1.ABAPObject)) {\r\n return ret;\r\n }\r\n const highObj = this.highReg.getObject(lowObj.getType(), lowObj.getName());\r\n if (highObj === undefined || !(highObj instanceof _abap_object_1.ABAPObject)) {\r\n return ret;\r\n }\r\n let highSyntaxObj = highObj;\r\n // for includes do the syntax check via a main program\r\n if (lowObj instanceof objects_1.Program && lowObj.isInclude()) {\r\n const mains = this.listMainForInclude((_a = lowObj.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getFilename());\r\n if (mains.length <= 0) {\r\n return [];\r\n }\r\n const f = this.highReg.getFileByName(mains[0]);\r\n if (f === undefined) {\r\n return [];\r\n }\r\n highSyntaxObj = this.highReg.findObjectForFile(f);\r\n }\r\n for (const lowFile of lowObj.getABAPFiles()) {\r\n let highSyntax = undefined;\r\n const highFile = highObj.getABAPFileByName(lowFile.getFilename());\r\n if (highFile === undefined) {\r\n continue;\r\n }\r\n const lowStatements = lowFile.getStatements();\r\n const highStatements = highFile.getStatements();\r\n if (lowStatements.length !== highStatements.length) {\r\n // after applying a fix, there might be more statements in lowFile\r\n // should highReg be initialized again?\r\n /*\r\n const message = \"Internal Error: Statement lengths does not match\";\r\n ret.push(Issue.atStatement(lowFile, lowStatements[0], message, this.getMetadata().key));\r\n */\r\n // hmm, add some way to disable lazyUnknown() in statement_parser.ts\r\n // alternatively explicit enable it in vscode, its only relevant when a user is\r\n // actively editing the files\r\n continue;\r\n }\r\n for (let i = 0; i < lowStatements.length; i++) {\r\n const low = lowStatements[i];\r\n const high = highStatements[i];\r\n if ((low.get() instanceof _statement_1.Unknown && !(high.get() instanceof _statement_1.Unknown))\r\n || high.findFirstExpression(Expressions.InlineData)) {\r\n if (highSyntax === undefined) {\r\n highSyntax = new syntax_1.SyntaxLogic(this.highReg, highSyntaxObj).run();\r\n }\r\n try {\r\n const issue = this.checkStatement(low, high, lowFile, highSyntax, highFile);\r\n if (issue) {\r\n ret.push(issue);\r\n }\r\n }\r\n catch (e) {\r\n if (e instanceof SkipToNextFile) {\r\n ret.push(e.issue);\r\n break;\r\n }\r\n else {\r\n throw e;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return ret;\r\n }\r\n ////////////////////\r\n /** clones the orginal repository into highReg, and parses it with higher language version */\r\n initHighReg() {\r\n // use default configuration, ie. default target version\r\n const highConfig = config_1.Config.getDefault().get();\r\n const lowConfig = this.lowReg.getConfig().get();\r\n highConfig.syntax.errorNamespace = lowConfig.syntax.errorNamespace;\r\n highConfig.syntax.globalConstants = lowConfig.syntax.globalConstants;\r\n highConfig.syntax.globalMacros = lowConfig.syntax.globalMacros;\r\n this.highReg = new registry_1.Registry();\r\n for (const o of this.lowReg.getObjects()) {\r\n for (const f of o.getFiles()) {\r\n if (this.lowReg.isDependency(o) === true) {\r\n this.highReg.addDependency(f);\r\n }\r\n else {\r\n this.highReg.addFile(f);\r\n }\r\n }\r\n }\r\n this.highReg.parse();\r\n }\r\n /** applies one rule at a time, multiple iterations are required to transform complex statements */\r\n checkStatement(low, high, lowFile, highSyntax, highFile) {\r\n if (low.getFirstToken().getStart() instanceof position_1.VirtualPosition) {\r\n return undefined;\r\n }\r\n let found = this.downportEnum(low, high, lowFile, highSyntax, highFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.partiallyImplemented(high, lowFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.raiseException(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.emptyKey(low, high, lowFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.stringTemplateAlpha(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.moveWithOperator(low, high, lowFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.moveWithSimpleValue(low, high, lowFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.assignWithTable(low, high, lowFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.downportRefSimple(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.downportCorrespondingSimple(high, lowFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.downportRef(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.downportLoopGroup(high, lowFile, highSyntax, highFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.callFunctionParameterSimple(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.moveWithTableTarget(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.downportSelectInline(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.downportSQLExtras(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineLoopInput(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineLoopTarget(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n let skipValue = false;\r\n let skipReduce = false;\r\n const valueBody = high.findFirstExpression(Expressions.ValueBody);\r\n const reduceBody = high.findFirstExpression(Expressions.ReduceBody);\r\n if (valueBody && reduceBody) {\r\n const valueToken = valueBody.getFirstToken();\r\n const reduceToken = reduceBody.getFirstToken();\r\n if (valueToken.getStart().isBefore(reduceToken.getStart())) {\r\n skipReduce = true;\r\n }\r\n else {\r\n skipValue = true;\r\n }\r\n }\r\n if (skipValue !== true) {\r\n found = this.outlineValue(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n }\r\n if (skipReduce !== true) {\r\n found = this.outlineReduce(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n }\r\n found = this.outlineSwitch(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineFilter(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineCast(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineConv(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineCond(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineCatchSimple(high, lowFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineDataSimple(high, lowFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineData(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineFS(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.newToCreateObject(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.replaceXsdBool(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.replaceLineFunctions(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.getReference(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.replaceContains(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.replaceMethodConditional(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.replaceTableExpression(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.replaceAppendExpression(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.replaceInsertExpression(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.downportMessage(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n return undefined;\r\n }\r\n //////////////////////////////////////////\r\n downportSQLExtras(low, high, lowFile, _highSyntax) {\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n if (!(high.get() instanceof Statements.Select)\r\n && !(high.get() instanceof Statements.SelectLoop)\r\n && !(high.get() instanceof Statements.UpdateDatabase)\r\n && !(high.get() instanceof Statements.ModifyDatabase)\r\n && !(high.get() instanceof Statements.DeleteDatabase)\r\n && !(high.get() instanceof Statements.InsertDatabase)) {\r\n return undefined;\r\n }\r\n let fix = undefined;\r\n const addFix = (token) => {\r\n const add = edit_helper_1.EditHelper.deleteToken(lowFile, token);\r\n if (fix === undefined) {\r\n fix = add;\r\n }\r\n else {\r\n fix = edit_helper_1.EditHelper.merge(fix, add);\r\n }\r\n };\r\n const candidates = [high.findAllExpressionsRecursive(Expressions.SQLTarget),\r\n high.findAllExpressionsRecursive(Expressions.SQLSource),\r\n high.findAllExpressionsRecursive(Expressions.SQLSourceSimple)].flat();\r\n for (const c of candidates.reverse()) {\r\n if (c.getFirstToken() instanceof tokens_1.WAt\r\n || c.getFirstToken() instanceof tokens_1.At) {\r\n addFix(c.getFirstToken());\r\n }\r\n }\r\n for (const fieldList of high.findAllExpressionsMulti([Expressions.SQLFieldList, Expressions.SQLFieldListLoop], true)) {\r\n for (const token of fieldList.getDirectTokens()) {\r\n if (token.getStr() === \",\") {\r\n addFix(token);\r\n }\r\n }\r\n }\r\n if (fix !== undefined) {\r\n return issue_1.Issue.atToken(lowFile, low.getFirstToken(), \"SQL, remove @ and ,\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n for (const c of high.findAllExpressionsRecursive(Expressions.SQLIn)) {\r\n const children = c.getChildren();\r\n const first = children[1];\r\n if (!(first.get() instanceof tokens_1.WParenLeftW)) {\r\n continue;\r\n }\r\n const last = children[children.length - 1];\r\n if (last.get() instanceof tokens_1.WParenRightW || last.get() instanceof tokens_1.WParenRight) {\r\n const firstEnd = first.getFirstToken().getEnd();\r\n const endDelete = new position_1.Position(firstEnd.getRow(), firstEnd.getCol() + 1);\r\n const fix1 = edit_helper_1.EditHelper.deleteRange(lowFile, firstEnd, endDelete);\r\n const lastStart = last.getFirstToken().getStart();\r\n const startDelete = new position_1.Position(lastStart.getRow(), lastStart.getCol() - 1);\r\n const fix2 = edit_helper_1.EditHelper.deleteRange(lowFile, startDelete, lastStart);\r\n fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, low.getFirstToken(), \"SQL, remove spaces\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n }\r\n return undefined;\r\n }\r\n downportSelectInline(low, high, lowFile, highSyntax) {\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n else if (!(high.get() instanceof Statements.Select) && !(high.get() instanceof Statements.SelectLoop)) {\r\n return undefined;\r\n }\r\n // as first step outline the @DATA, note that void types are okay, as long the field names are specified\r\n let found = this.downportSelectSingleInline(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.downportSelectTableInline(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n return undefined;\r\n }\r\n downportSelectSingleInline(low, high, lowFile, _highSyntax) {\r\n var _a, _b, _c, _d;\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n const targets = ((_a = high.findFirstExpression(Expressions.SQLIntoStructure)) === null || _a === void 0 ? void 0 : _a.findDirectExpressions(Expressions.SQLTarget)) || [];\r\n if (targets.length !== 1) {\r\n return undefined;\r\n }\r\n const inlineData = targets[0].findFirstExpression(Expressions.InlineData);\r\n if (inlineData === undefined) {\r\n return undefined;\r\n }\r\n const sqlFrom = high.findAllExpressions(Expressions.SQLFromSource);\r\n if (sqlFrom.length !== 1) {\r\n return undefined;\r\n }\r\n const tableName = (_b = sqlFrom[0].findDirectExpression(Expressions.DatabaseTable)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n if (tableName === undefined) {\r\n return undefined;\r\n }\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n let fieldList = high.findFirstExpression(Expressions.SQLFieldList);\r\n if (fieldList === undefined) {\r\n fieldList = high.findFirstExpression(Expressions.SQLFieldListLoop);\r\n }\r\n if (fieldList === undefined) {\r\n return undefined;\r\n }\r\n let fieldDefinition = \"\";\r\n const fields = fieldList.findAllExpressions(Expressions.SQLFieldName);\r\n const name = ((_c = inlineData.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || \"error\";\r\n if (fields.length === 1) {\r\n fieldDefinition = `DATA ${name} TYPE ${tableName}-${fields[0].concatTokens()}.`;\r\n }\r\n else if (fieldList.concatTokens() === \"*\") {\r\n fieldDefinition = `DATA ${name} TYPE ${tableName}.`;\r\n }\r\n else if (fieldList.concatTokens().toUpperCase() === \"COUNT( * )\") {\r\n fieldDefinition = `DATA ${name} TYPE i.`;\r\n }\r\n else if (fieldList.getChildren().length === 1 && fieldList.getChildren()[0].get() instanceof Expressions.SQLAggregation) {\r\n const c = fieldList.getChildren()[0];\r\n if (c instanceof nodes_1.ExpressionNode) {\r\n const concat = (_d = c.findFirstExpression(Expressions.SQLArithmetics)) === null || _d === void 0 ? void 0 : _d.concatTokens();\r\n fieldDefinition = `DATA ${name} TYPE ${tableName}-${concat}.`;\r\n }\r\n }\r\n else {\r\n for (const f of fields) {\r\n const fieldName = f.concatTokens();\r\n fieldDefinition += indentation + \" \" + fieldName + \" TYPE \" + tableName + \"-\" + fieldName + \",\\n\";\r\n }\r\n fieldDefinition = `DATA: BEGIN OF ${name},\n${fieldDefinition}${indentation} END OF ${name}.`;\r\n }\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `${fieldDefinition}\n${indentation}`);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inlineData.getFirstToken().getStart(), inlineData.getLastToken().getEnd(), name);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, inlineData.getFirstToken(), \"Outline SELECT @DATA\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n downportSelectTableInline(low, high, lowFile, highSyntax) {\r\n var _a, _b, _c;\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n const targets = ((_a = high.findFirstExpression(Expressions.SQLIntoTable)) === null || _a === void 0 ? void 0 : _a.findDirectExpressions(Expressions.SQLTarget)) || [];\r\n if (targets.length !== 1) {\r\n return undefined;\r\n }\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const inlineData = targets[0].findFirstExpression(Expressions.InlineData);\r\n if (inlineData === undefined) {\r\n return undefined;\r\n }\r\n const sqlFrom = high.findAllExpressions(Expressions.SQLFromSource);\r\n if (sqlFrom.length === 0) {\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Error outlining, sqlFrom not found\", this.getMetadata().key, this.conf.severity);\r\n }\r\n let tableName = (_b = sqlFrom[0].findDirectExpression(Expressions.DatabaseTable)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n if (tableName === undefined) {\r\n return undefined;\r\n }\r\n const fieldList = high.findFirstExpression(Expressions.SQLFieldList);\r\n if (fieldList === undefined) {\r\n return undefined;\r\n }\r\n let fieldDefinitions = \"\";\r\n for (const f of fieldList.findAllExpressions(Expressions.SQLFieldName)) {\r\n let fieldName = f.concatTokens();\r\n if (fieldName.includes(\"~\")) {\r\n const split = fieldName.split(\"~\");\r\n tableName = split[0];\r\n fieldName = split[1];\r\n }\r\n fieldDefinitions += indentation + \" \" + fieldName + \" TYPE \" + tableName + \"-\" + fieldName + \",\\n\";\r\n }\r\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const name = ((_c = inlineData.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || \"error\";\r\n let fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `TYPES: BEGIN OF ${uniqueName},\n${fieldDefinitions}${indentation} END OF ${uniqueName}.\n${indentation}DATA ${name} TYPE STANDARD TABLE OF ${uniqueName} WITH DEFAULT KEY.\n${indentation}`);\r\n if (fieldDefinitions === \"\") {\r\n fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `DATA ${name} TYPE STANDARD TABLE OF ${tableName} WITH DEFAULT KEY.\n${indentation}`);\r\n }\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inlineData.getFirstToken().getStart(), inlineData.getLastToken().getEnd(), name);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, inlineData.getFirstToken(), \"Outline SELECT @DATA\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n downportMessage(high, lowFile, highSyntax) {\r\n var _a, _b;\r\n if (!(high.get() instanceof Statements.Message)) {\r\n return undefined;\r\n }\r\n const foundWith = high.findExpressionAfterToken(\"WITH\");\r\n if (foundWith === undefined) {\r\n return undefined;\r\n }\r\n const likeSource = high.findExpressionAfterToken(\"LIKE\");\r\n for (const s of high.findAllExpressions(Expressions.Source)) {\r\n if (s === likeSource) {\r\n continue;\r\n }\r\n else if (s.getChildren().length === 1 && ((_a = s.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.Constant) {\r\n continue;\r\n }\r\n else if (s.getChildren().length === 1 && ((_b = s.getFirstChild()) === null || _b === void 0 ? void 0 : _b.get()) instanceof Expressions.FieldChain) {\r\n continue;\r\n }\r\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const firstToken = high.getFirstToken();\r\n const code = `DATA(${uniqueName}) = ${s.concatTokens()}.\\n${indentation}`;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, s.getFirstToken().getStart(), s.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Refactor MESSAGE WITH source\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n replaceAppendExpression(high, lowFile, highSyntax) {\r\n if (!(high.get() instanceof Statements.Append)) {\r\n return undefined;\r\n }\r\n const children = high.getChildren();\r\n if (children[1].get() instanceof Expressions.Source) {\r\n const source = children[1];\r\n const target = high.findDirectExpression(Expressions.Target);\r\n if (target === undefined) {\r\n return undefined;\r\n }\r\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const firstToken = high.getFirstToken();\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${target === null || target === void 0 ? void 0 : target.concatTokens()}.\n${indentation}${uniqueName} = ${source.concatTokens()}.\\n${indentation}`);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Outline APPEND source expression\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n replaceInsertExpression(high, lowFile, highSyntax) {\r\n if (!(high.get() instanceof Statements.InsertInternal)) {\r\n return undefined;\r\n }\r\n const children = high.getChildren();\r\n if (children[1].get() instanceof Expressions.Source) {\r\n const source = children[1];\r\n const target = high.findDirectExpression(Expressions.Target);\r\n if (target === undefined) {\r\n return undefined;\r\n }\r\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const firstToken = high.getFirstToken();\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${target === null || target === void 0 ? void 0 : target.concatTokens()}.\n${indentation}${uniqueName} = ${source.concatTokens()}.\\n${indentation}`);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Outline INSERT source expression\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n replaceTableExpression(low, high, lowFile, highSyntax) {\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n for (const fieldChain of high.findAllExpressionsRecursive(Expressions.FieldChain)) {\r\n const tableExpression = fieldChain.findDirectExpression(Expressions.TableExpression);\r\n if (tableExpression === undefined) {\r\n continue;\r\n }\r\n const concat = high.concatTokens().toUpperCase();\r\n if (concat.includes(\" LINE_EXISTS( \") || concat.includes(\" LINE_INDEX( \")) {\r\n // note: line_exists() must be replaced before handling table expressions\r\n continue;\r\n }\r\n let pre = \"\";\r\n let startToken = undefined;\r\n for (const child of fieldChain.getChildren()) {\r\n if (startToken === undefined) {\r\n startToken = child.getFirstToken();\r\n }\r\n else if (child === tableExpression) {\r\n break;\r\n }\r\n pre += child.concatTokens();\r\n }\r\n if (startToken === undefined) {\r\n continue;\r\n }\r\n const condition = this.tableCondition(tableExpression);\r\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const tabixBackup = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const firstToken = high.getFirstToken();\r\n // note that the tabix restore should be done before throwing the exception\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${pre}.\n${indentation}DATA ${tabixBackup} LIKE sy-tabix.\n${indentation}${tabixBackup} = sy-tabix.\n${indentation}READ TABLE ${pre} ${condition}INTO ${uniqueName}.\n${indentation}sy-tabix = ${tabixBackup}.\n${indentation}IF sy-subrc <> 0.\n${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.\n${indentation}ENDIF.\n${indentation}`);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, startToken.getStart(), tableExpression.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Outline table expression\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n tableCondition(tableExpression) {\r\n let condition = \"\";\r\n let keyName = \"\";\r\n for (const c of tableExpression.getChildren() || []) {\r\n if (c.getFirstToken().getStr() === \"[\" || c.getFirstToken().getStr() === \"]\") {\r\n continue;\r\n }\r\n else if (c.get() instanceof Expressions.ComponentChainSimple && condition === \"\") {\r\n if (keyName === \"\") {\r\n condition = \"WITH KEY \";\r\n }\r\n else {\r\n condition = \"WITH TABLE KEY \" + keyName + \" COMPONENTS \";\r\n }\r\n }\r\n else if (c.get() instanceof Expressions.Source && condition === \"\") {\r\n condition = \"INDEX \";\r\n }\r\n else if (c instanceof nodes_1.TokenNode && c.getFirstToken().getStr().toUpperCase() === \"KEY\") {\r\n continue;\r\n }\r\n else if (c.get() instanceof Expressions.SimpleName) {\r\n keyName = c.concatTokens();\r\n continue;\r\n }\r\n condition += c.concatTokens() + \" \";\r\n }\r\n return condition;\r\n }\r\n outlineCatchSimple(node, lowFile) {\r\n // outlines \"CATCH cx_bcs INTO DATA(lx_bcs_excep).\", note that this does not need to look at types\r\n var _a, _b;\r\n if (!(node.get() instanceof Statements.Catch)) {\r\n return undefined;\r\n }\r\n const target = node.findFirstExpression(Expressions.Target);\r\n if (!(((_a = target === null || target === void 0 ? void 0 : target.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.InlineData)) {\r\n return undefined;\r\n }\r\n const classNames = node.findDirectExpressions(Expressions.ClassName);\r\n if (classNames.length !== 1) {\r\n return undefined;\r\n }\r\n const className = classNames[0].concatTokens();\r\n const targetName = (_b = target.findFirstExpression(Expressions.TargetField)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const code = ` DATA ${targetName} TYPE REF TO ${className}.\n${indentation}CATCH ${className} INTO ${targetName}.`;\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getStart(), node.getEnd(), code);\r\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline DATA\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n outlineDataSimple(node, lowFile) {\r\n // outlines \"DATA(ls_msg) = temp1.\", note that this does not need to look at types\r\n var _a, _b, _c;\r\n if (!(node.get() instanceof Statements.Move)) {\r\n return undefined;\r\n }\r\n const target = node.findFirstExpression(Expressions.Target);\r\n if (!(((_a = target === null || target === void 0 ? void 0 : target.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.InlineData)) {\r\n return undefined;\r\n }\r\n let type = \"\";\r\n const source = node.findFirstExpression(Expressions.Source);\r\n if (source === undefined) {\r\n return undefined;\r\n }\r\n else if (source.getChildren().length !== 1) {\r\n return undefined;\r\n }\r\n else if (!(((_b = source.getFirstChild()) === null || _b === void 0 ? void 0 : _b.get()) instanceof Expressions.FieldChain)) {\r\n return undefined;\r\n }\r\n else if (source.findFirstExpression(Expressions.FieldOffset)) {\r\n return undefined;\r\n }\r\n else if (source.findFirstExpression(Expressions.FieldLength)) {\r\n return undefined;\r\n }\r\n else if (source.findFirstExpression(Expressions.TableExpression)) {\r\n const chain = source.findDirectExpression(Expressions.FieldChain);\r\n if (chain !== undefined\r\n && chain.getChildren().length === 2\r\n && chain.getChildren()[0].get() instanceof Expressions.SourceField\r\n && chain.getChildren()[1].get() instanceof Expressions.TableExpression) {\r\n type = \"LINE OF \" + chain.getChildren()[0].concatTokens();\r\n }\r\n else {\r\n return undefined;\r\n }\r\n }\r\n else {\r\n type = source.concatTokens();\r\n }\r\n const targetName = (_c = target.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens();\r\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const firstToken = node.getFirstToken();\r\n const lastToken = node.getLastToken();\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${targetName} LIKE ${type}.\\n${indentation}`);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), lastToken.getEnd(), `${targetName} = ${source.concatTokens()}.`);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline DATA\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n partiallyImplemented(node, lowFile) {\r\n if (node.get() instanceof Statements.InterfaceDef) {\r\n const partially = node.findDirectTokenByText(\"PARTIALLY\");\r\n if (partially === undefined) {\r\n return undefined;\r\n }\r\n const implemented = node.findDirectTokenByText(\"IMPLEMENTED\");\r\n if (implemented === undefined) {\r\n return undefined;\r\n }\r\n const fix = edit_helper_1.EditHelper.deleteRange(lowFile, partially.getStart(), implemented.getEnd());\r\n return issue_1.Issue.atToken(lowFile, partially, \"Downport PARTIALLY IMPLEMENTED\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n raiseException(node, lowFile, highSyntax) {\r\n /*\r\n Note: IF_T100_DYN_MSG does not exist in 702, so this rule is mostly relevant for the transpiler\r\n \r\n DATA foo LIKE if_t100_message=>t100key.\r\n foo-msgid = 'ZHVAM'.\r\n foo-msgno = '001'.\r\n foo-attr1 = 'IF_T100_DYN_MSG~MSGV1'.\r\n foo-attr2 = 'IF_T100_DYN_MSG~MSGV2'.\r\n foo-attr3 = 'IF_T100_DYN_MSG~MSGV3'.\r\n foo-attr4 = 'IF_T100_DYN_MSG~MSGV4'.\r\n DATA bar TYPE REF TO zcl_hvam_exception.\r\n CREATE OBJECT bar EXPORTING textid = foo.\r\n bar->if_t100_dyn_msg~msgty = 'E'.\r\n bar->if_t100_dyn_msg~msgv1 = 'abc'.\r\n bar->if_t100_dyn_msg~msgv2 = 'abc'.\r\n bar->if_t100_dyn_msg~msgv3 = 'abc'.\r\n bar->if_t100_dyn_msg~msgv4 = 'abc'.\r\n RAISE EXCEPTION bar.\r\n */\r\n var _a, _b, _c;\r\n if (!(node.get() instanceof Statements.Raise)) {\r\n return undefined;\r\n }\r\n let id = undefined;\r\n let number = undefined;\r\n let startToken = node.findDirectTokenByText(\"ID\");\r\n if (startToken) {\r\n const sources = node.findDirectExpressions(Expressions.Source);\r\n id = sources[0].concatTokens();\r\n const numberExpression = node.findExpressionAfterToken(\"NUMBER\");\r\n if (numberExpression === undefined) {\r\n throw \"downport raiseException, could not find number\";\r\n }\r\n number = numberExpression.concatTokens();\r\n if (numberExpression.get() instanceof Expressions.MessageNumber) {\r\n number = \"'\" + number + \"'\";\r\n }\r\n }\r\n else {\r\n const s = node.findDirectExpression(Expressions.MessageSource);\r\n if (s === undefined) {\r\n return undefined;\r\n }\r\n id = \"'\" + ((_a = s.findDirectExpression(Expressions.MessageClass)) === null || _a === void 0 ? void 0 : _a.concatTokens()) + \"'\";\r\n number = \"'\" + ((_b = s.findDirectExpression(Expressions.MessageTypeAndNumber)) === null || _b === void 0 ? void 0 : _b.concatTokens().substring(1)) + \"'\";\r\n startToken = node.getFirstToken();\r\n }\r\n const className = ((_c = node.findDirectExpression(Expressions.ClassName)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || \"ERROR\";\r\n const uniqueName1 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const uniqueName2 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const abap = `DATA ${uniqueName1} LIKE if_t100_message=>t100key.\n${indentation}${uniqueName1}-msgid = ${id === null || id === void 0 ? void 0 : id.toUpperCase()}.\n${indentation}${uniqueName1}-msgno = ${number}.\n${indentation}DATA ${uniqueName2} TYPE REF TO ${className}.\n${indentation}CREATE OBJECT ${uniqueName2} EXPORTING textid = ${uniqueName1}.\n${indentation}RAISE EXCEPTION ${uniqueName2}.`;\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getStart(), node.getEnd(), abap);\r\n return issue_1.Issue.atToken(lowFile, startToken, \"Downport RAISE MESSAGE\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n emptyKey(low, node, lowFile) {\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n for (let i of node.findAllExpressions(Expressions.TypeTable)) {\r\n const key = i.findDirectExpression(Expressions.TypeTableKey);\r\n if (key === undefined) {\r\n continue;\r\n }\r\n i = key;\r\n const concat = i.concatTokens();\r\n if (concat.toUpperCase().includes(\"WITH EMPTY KEY\") === false) {\r\n continue;\r\n }\r\n const token = i.findDirectTokenByText(\"EMPTY\");\r\n if (token === undefined) {\r\n continue;\r\n }\r\n const fix = edit_helper_1.EditHelper.replaceToken(lowFile, token, \"DEFAULT\");\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Downport EMPTY KEY\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n callFunctionParameterSimple(high, lowFile, highSyntax) {\r\n if (!(high.get() instanceof Statements.CallFunction)) {\r\n return undefined;\r\n }\r\n let found = undefined;\r\n for (const p of high.findAllExpressions(Expressions.FunctionExportingParameter)) {\r\n found = p.findDirectExpression(Expressions.Source);\r\n if (found && (found.findDirectExpression(Expressions.FieldChain)\r\n || found.findDirectExpression(Expressions.Constant)\r\n || found.findDirectExpression(Expressions.TextElement))) {\r\n // its actually simple, ok\r\n found = undefined;\r\n }\r\n else if (found !== undefined) {\r\n break;\r\n }\r\n }\r\n if (found === undefined) {\r\n return undefined;\r\n }\r\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const code = `DATA(${uniqueName}) = ${found.concatTokens()}.\\n`;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, found.getFirstToken().getStart(), found.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, call function parameter\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n downportCorrespondingSimple(high, lowFile) {\r\n var _a;\r\n if (!(high.get() instanceof Statements.Move)\r\n || high.getChildren().length !== 4\r\n || high.getChildren()[2].getFirstToken().getStr().toUpperCase() !== \"CORRESPONDING\") {\r\n return undefined;\r\n }\r\n const target = high.findDirectExpression(Expressions.Target);\r\n if (target === undefined) {\r\n return undefined;\r\n }\r\n const sourceRef = (_a = high.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.findFirstExpression(Expressions.CorrespondingBody);\r\n if (sourceRef === undefined || sourceRef.getChildren().length !== 1) {\r\n return;\r\n }\r\n const code = `MOVE-CORRESPONDING ${sourceRef.concatTokens()} TO ${target.concatTokens()}`;\r\n const start = high.getFirstToken().getStart();\r\n const end = high.getLastToken().getStart();\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, simple CORRESPONDING move\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n downportRefSimple(high, lowFile, highSyntax) {\r\n var _a;\r\n if (!(high.get() instanceof Statements.Move)\r\n || high.getChildren().length !== 4\r\n || high.getChildren()[2].getFirstToken().getStr().toUpperCase() !== \"REF\") {\r\n return undefined;\r\n }\r\n const target = high.findDirectExpression(Expressions.Target);\r\n if (target === undefined) {\r\n return undefined;\r\n }\r\n const sourceRef = (_a = high.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Source);\r\n if (sourceRef === undefined\r\n || sourceRef.getChildren().length !== 1) {\r\n return undefined;\r\n }\r\n let code = \"\";\r\n if (sourceRef.findFirstExpression(Expressions.TableExpression)) {\r\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n code = `ASSIGN ${sourceRef.concatTokens()} TO FIELD-SYMBOL(<${uniqueName}>).\nIF sy-subrc <> 0.\n RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.\nENDIF.\nGET REFERENCE OF <${uniqueName}> INTO ${target.concatTokens()}`;\r\n }\r\n else {\r\n code = `GET REFERENCE OF ${sourceRef.concatTokens()} INTO ${target.concatTokens()}`;\r\n }\r\n const start = high.getFirstToken().getStart();\r\n const end = high.getLastToken().getStart();\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, simple REF move\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n downportLoopGroup(high, lowFile, highSyntax, highFile) {\r\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;\r\n if (!(high.get() instanceof Statements.Loop)) {\r\n return undefined;\r\n }\r\n const group = high.findDirectExpression(Expressions.LoopGroupBy);\r\n if (group === undefined) {\r\n return undefined;\r\n }\r\n const groupTargetName = ((_a = group.findFirstExpression(Expressions.TargetField)) === null || _a === void 0 ? void 0 : _a.concatTokens())\r\n || ((_b = group.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _b === void 0 ? void 0 : _b.concatTokens().replace(\"<\", \"_\").replace(\">\", \"_\"))\r\n || \"nameNotFound\";\r\n const loopSourceName = ((_c = high.findFirstExpression(Expressions.SimpleSource2)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || \"nameNotFound\";\r\n const loopTargetName = ((_d = high.findFirstExpression(Expressions.TargetField)) === null || _d === void 0 ? void 0 : _d.concatTokens())\r\n || ((_e = high.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _e === void 0 ? void 0 : _e.concatTokens())\r\n || \"nameNotFound\";\r\n const groupTarget = ((_f = group.findDirectExpression(Expressions.LoopGroupByTarget)) === null || _f === void 0 ? void 0 : _f.concatTokens()) || \"\";\r\n const isReference = (_g = high.findFirstExpression(Expressions.LoopTarget)) === null || _g === void 0 ? void 0 : _g.concatTokens().toUpperCase().startsWith(\"REFERENCE INTO \");\r\n let loopSourceRowType = \"typeNotFound\";\r\n const spag = highSyntax.spaghetti.lookupPosition(high.getFirstToken().getStart(), lowFile.getFilename());\r\n if (spag !== undefined) {\r\n const found = spag.findVariable(loopSourceName);\r\n const tt = found === null || found === void 0 ? void 0 : found.getType();\r\n if (tt instanceof basic_1.TableType) {\r\n loopSourceRowType = tt.getRowType().getQualifiedName() || \"typeNotFound\";\r\n }\r\n }\r\n let code = `TYPES: BEGIN OF ${groupTargetName}type,\\n`;\r\n let condition = \"\";\r\n let groupCountName = undefined;\r\n let groupIndexName = undefined;\r\n for (const c of group.findAllExpressions(Expressions.LoopGroupByComponent)) {\r\n const name = c.findFirstExpression(Expressions.ComponentName);\r\n let type = ((_h = c.findFirstExpression(Expressions.Source)) === null || _h === void 0 ? void 0 : _h.concatTokens()) || \"todo\";\r\n if ((_j = c.concatTokens()) === null || _j === void 0 ? void 0 : _j.toUpperCase().endsWith(\" = GROUP SIZE\")) {\r\n type = \"i\";\r\n groupCountName = name === null || name === void 0 ? void 0 : name.concatTokens();\r\n }\r\n else if ((_k = c.concatTokens()) === null || _k === void 0 ? void 0 : _k.toUpperCase().endsWith(\" = GROUP INDEX\")) {\r\n type = \"i\";\r\n groupIndexName = name === null || name === void 0 ? void 0 : name.concatTokens();\r\n }\r\n else {\r\n if (condition !== \"\") {\r\n condition += \" \";\r\n }\r\n condition += c.concatTokens();\r\n type = type.replace(loopTargetName, loopSourceRowType);\r\n type = type.replace(\"->\", \"-\");\r\n }\r\n code += ` ${name === null || name === void 0 ? void 0 : name.concatTokens()} TYPE ${type},\\n`;\r\n }\r\n const s = group.findDirectExpression(Expressions.Source);\r\n let singleName = \"\";\r\n if (s) {\r\n let type = s.concatTokens();\r\n type = type.replace(loopTargetName, loopSourceRowType);\r\n type = type.replace(\"->\", \"-\");\r\n singleName = s.concatTokens().split(\"-\")[1];\r\n code += ` ${singleName} TYPE ${type},\\n`;\r\n condition = singleName + \" = \" + s.concatTokens();\r\n }\r\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const uniqueFS = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const uniqueNameIndex = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n code += ` items LIKE ${loopSourceName},\n END OF ${groupTargetName}type.\nDATA ${groupTargetName}tab TYPE STANDARD TABLE OF ${groupTargetName}type WITH DEFAULT KEY.\nDATA ${uniqueName} LIKE LINE OF ${groupTargetName}tab.\nLOOP AT ${loopSourceName} ${(_l = high.findFirstExpression(Expressions.LoopTarget)) === null || _l === void 0 ? void 0 : _l.concatTokens()}.\\n`;\r\n if (groupIndexName !== undefined) {\r\n code += `DATA(${uniqueNameIndex}) = sy-tabix.\\n`;\r\n }\r\n code += `READ TABLE ${groupTargetName}tab ASSIGNING FIELD-SYMBOL(<${uniqueFS}>) WITH KEY ${condition}.\nIF sy-subrc = 0.\\n`;\r\n if (groupCountName !== undefined) {\r\n code += ` <${uniqueFS}>-${groupCountName} = <${uniqueFS}>-${groupCountName} + 1.\\n`;\r\n }\r\n code += ` INSERT ${loopTargetName}${isReference ? \"->*\" : \"\"} INTO TABLE <${uniqueFS}>-items.\nELSE.\\n`;\r\n code += ` CLEAR ${uniqueName}.\\n`;\r\n for (const c of group.findAllExpressions(Expressions.LoopGroupByComponent)) {\r\n const concat = c.concatTokens();\r\n // console.dir(concat);\r\n if (concat.endsWith(\" GROUP INDEX\")) {\r\n code += ` ${uniqueName}-${groupIndexName} = ${uniqueNameIndex}.\\n`;\r\n }\r\n else if (concat.endsWith(\" GROUP SIZE\")) {\r\n code += ` ${uniqueName}-${groupCountName} = 1.\\n`;\r\n }\r\n else {\r\n code += ` ${uniqueName}-${concat}.\\n`;\r\n }\r\n }\r\n if (singleName !== \"\") {\r\n code += ` ${uniqueName}-${singleName} = ${loopTargetName}-${singleName}.\\n`;\r\n }\r\n code += ` INSERT ${loopTargetName}${isReference ? \"->*\" : \"\"} INTO TABLE ${uniqueName}-items.\\n`;\r\n code += ` INSERT ${uniqueName} INTO TABLE ${groupTargetName}tab.\\n`;\r\n code += `ENDIF.\nENDLOOP.\nLOOP AT ${groupTargetName}tab ${groupTarget}.`;\r\n let fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);\r\n for (const l of ((_m = highFile.getStructure()) === null || _m === void 0 ? void 0 : _m.findAllStructures(Structures.Loop)) || []) {\r\n // make sure to find the correct/current loop statement\r\n if (l.findDirectStatement(Statements.Loop) !== high) {\r\n continue;\r\n }\r\n for (const loop of l.findAllStatements(Statements.Loop)) {\r\n if ((_o = loop.concatTokens()) === null || _o === void 0 ? void 0 : _o.toUpperCase().startsWith(\"LOOP AT GROUP \")) {\r\n const subLoopSource = loop.findFirstExpression(Expressions.SimpleSource2);\r\n if (subLoopSource === undefined) {\r\n continue;\r\n }\r\n const subLoopSourceName = (subLoopSource === null || subLoopSource === void 0 ? void 0 : subLoopSource.concatTokens()) || \"nameNotFound\";\r\n const subCode = `LOOP AT ${subLoopSourceName}${isReference ? \"->\" : \"-\"}items`;\r\n const subFix = edit_helper_1.EditHelper.replaceRange(lowFile, loop.getFirstToken().getStart(), subLoopSource.getLastToken().getEnd(), subCode);\r\n fix = edit_helper_1.EditHelper.merge(subFix, fix);\r\n }\r\n }\r\n }\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, LOOP GROUP\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n downportRef(low, high, lowFile, highSyntax) {\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n let found = undefined;\r\n for (const s of high.findAllExpressionsRecursive(Expressions.Source)) {\r\n if (s.getFirstToken().getStr().toUpperCase() === \"REF\"\r\n && s.findDirectExpression(Expressions.TypeNameOrInfer)) {\r\n found = s;\r\n }\r\n }\r\n if (found === undefined) {\r\n return undefined;\r\n }\r\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const code = `DATA(${uniqueName}) = ${found.concatTokens()}.\\n`;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, found.getFirstToken().getStart(), found.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, REF\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n assignWithTable(low, high, lowFile) {\r\n var _a, _b;\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n if (!(high.get() instanceof Statements.Assign)) {\r\n return undefined;\r\n }\r\n else if (high.getChildren().length !== 5) {\r\n return undefined;\r\n }\r\n const fieldChain = (_b = (_a = high.findDirectExpression(Expressions.AssignSource)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.FieldChain);\r\n const tableExpression = fieldChain === null || fieldChain === void 0 ? void 0 : fieldChain.getLastChild();\r\n if (tableExpression === undefined\r\n || !(tableExpression.get() instanceof Expressions.TableExpression)\r\n || !(tableExpression instanceof nodes_1.ExpressionNode)) {\r\n return undefined;\r\n }\r\n let condition = \"\";\r\n if (tableExpression.getChildren().length === 3) {\r\n const index = tableExpression.findDirectExpression(Expressions.Source);\r\n if (index === undefined) {\r\n return undefined;\r\n }\r\n condition = `INDEX ${index.concatTokens()}`;\r\n }\r\n else {\r\n let concat = tableExpression.concatTokens();\r\n concat = concat.substring(2);\r\n concat = concat.substring(0, concat.length - 2);\r\n condition = `WITH KEY ${concat}`;\r\n }\r\n let pre = \"\";\r\n for (const c of fieldChain.getChildren()) {\r\n if (c === tableExpression) {\r\n break;\r\n }\r\n pre += c.concatTokens();\r\n }\r\n const fsTarget = high.findDirectExpression(Expressions.FSTarget);\r\n const code = `READ TABLE ${pre} ${condition} ASSIGNING ${fsTarget === null || fsTarget === void 0 ? void 0 : fsTarget.concatTokens()}.`;\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, ASSIGN table expr\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n moveWithSimpleValue(low, high, lowFile) {\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n if (!(high.get() instanceof Statements.Move)\r\n || high.getChildren().length !== 4) {\r\n return undefined;\r\n }\r\n const target = high.findDirectExpression(Expressions.Target);\r\n if (target === undefined) {\r\n return undefined;\r\n }\r\n const source = high.findDirectExpression(Expressions.Source);\r\n if (source === undefined) {\r\n return undefined;\r\n }\r\n const field = target.findDirectExpression(Expressions.TargetField);\r\n if (field === undefined) {\r\n return;\r\n }\r\n const valueBody = source.findDirectExpression(Expressions.ValueBody);\r\n if (valueBody === undefined) {\r\n return;\r\n }\r\n const fieldAssignments = valueBody.findDirectExpressions(Expressions.FieldAssignment);\r\n if (fieldAssignments.length === 0) {\r\n return;\r\n }\r\n else if (fieldAssignments.length !== valueBody.getChildren().length) {\r\n return;\r\n }\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n let code = `CLEAR ${target.concatTokens()}.\\n`;\r\n for (const fieldAssignment of fieldAssignments) {\r\n code += indentation + target.concatTokens() + \"-\" + fieldAssignment.concatTokens() + `.\\n`;\r\n }\r\n code = code.trimEnd();\r\n const start = high.getFirstToken().getStart();\r\n const end = high.getLastToken().getEnd();\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, simple move\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n // note, downporting ENUM does not give the correct types, but it will work in most cases?\r\n downportEnum(_low, high, lowFile, _highSyntax, highFile) {\r\n var _a, _b, _c, _d, _e;\r\n if (!(high.get() instanceof Statements.TypeEnumBegin)) {\r\n return undefined;\r\n }\r\n const enumStructure = (_a = highFile.getStructure()) === null || _a === void 0 ? void 0 : _a.findFirstStructure(Structures.TypeEnum);\r\n if (enumStructure === undefined) {\r\n return undefined;\r\n }\r\n if (enumStructure.getFirstStatement() !== high) {\r\n return undefined;\r\n }\r\n const enumName = (_b = high.findExpressionAfterToken(\"ENUM\")) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n const structureName = (_c = high.findExpressionAfterToken(\"STRUCTURE\")) === null || _c === void 0 ? void 0 : _c.concatTokens();\r\n // all ENUMS are char like?\r\n let code = `TYPES ${enumName} TYPE string.\nCONSTANTS: BEGIN OF ${structureName},\\n`;\r\n let count = 1;\r\n for (const e of enumStructure.findDirectStatements(Statements.TypeEnum).concat(enumStructure.findDirectStatements(Statements.Type))) {\r\n const name = (_d = e.findFirstExpression(Expressions.NamespaceSimpleName)) === null || _d === void 0 ? void 0 : _d.concatTokens();\r\n let value = (_e = e.findFirstExpression(Expressions.Value)) === null || _e === void 0 ? void 0 : _e.concatTokens();\r\n if (value === undefined) {\r\n value = \"VALUE '\" + count++ + \"'\";\r\n }\r\n code += ` ${name} TYPE ${enumName} ${value},\\n`;\r\n }\r\n code += ` END OF ${structureName}.`;\r\n const start = enumStructure.getFirstToken().getStart();\r\n const end = enumStructure.getLastToken().getEnd();\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport ENUM\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n moveWithTableTarget(low, high, lowFile, highSyntax) {\r\n var _a;\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n if (!(high.get() instanceof Statements.Move)) {\r\n return undefined;\r\n }\r\n const target = high.findDirectExpression(Expressions.Target);\r\n if (target === undefined) {\r\n return undefined;\r\n }\r\n const tableExpression = target.findDirectExpression(Expressions.TableExpression);\r\n if (tableExpression === undefined) {\r\n return undefined;\r\n }\r\n const index = tableExpression.findDirectExpression(Expressions.Source);\r\n if (index === undefined) {\r\n return undefined;\r\n }\r\n let uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n uniqueName = `<${uniqueName}>`;\r\n const tName = target.concatTokens().split(\"[\")[0];\r\n const condition = this.tableCondition(tableExpression);\r\n const tabixBackup = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n // restore tabix before exeption\r\n const code = `FIELD-SYMBOLS ${uniqueName} LIKE LINE OF ${tName}.\n${indentation}DATA ${tabixBackup} LIKE sy-tabix.\n${indentation}${tabixBackup} = sy-tabix.\n${indentation}READ TABLE ${tName} ${condition}ASSIGNING ${uniqueName}.\n${indentation}sy-tabix = ${tabixBackup}.\n${indentation}IF sy-subrc <> 0.\n${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.\n${indentation}ENDIF.\n${indentation}${uniqueName}`;\r\n const start = target.getFirstToken().getStart();\r\n const end = (_a = tableExpression.findDirectTokenByText(\"]\")) === null || _a === void 0 ? void 0 : _a.getEnd();\r\n if (end === undefined) {\r\n return undefined;\r\n }\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, move with table target\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n moveWithOperator(low, high, lowFile) {\r\n var _a, _b, _c;\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n else if (!(high.get() instanceof Statements.Move)) {\r\n return undefined;\r\n }\r\n const children = high.getChildren();\r\n const secondChild = children[1];\r\n if (secondChild === undefined) {\r\n return undefined;\r\n }\r\n const op = secondChild.getFirstToken();\r\n let operator = \"\";\r\n switch (op.getStr()) {\r\n case \"+\":\r\n operator = \" + \";\r\n break;\r\n case \"-\":\r\n operator = \" - \";\r\n break;\r\n case \"/=\":\r\n operator = \" / \";\r\n break;\r\n case \"*=\":\r\n operator = \" * \";\r\n break;\r\n case \"&&=\":\r\n operator = \" && \";\r\n break;\r\n default:\r\n return undefined;\r\n }\r\n const target = (_a = high.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n if (target === undefined) {\r\n return;\r\n }\r\n const sourceStart = (_c = (_b = high.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.getFirstChild()) === null || _c === void 0 ? void 0 : _c.getFirstToken().getStart();\r\n if (sourceStart === undefined) {\r\n return;\r\n }\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, op.getStart(), sourceStart, \"= \" + target + operator);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Expand operator\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n // must be very simple string templates, like \"|{ ls_line-no ALPHA = IN }|\"\r\n stringTemplateAlpha(low, high, lowFile, highSyntax) {\r\n var _a, _b, _c;\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n else if (!(high.get() instanceof Statements.Move)) {\r\n return undefined;\r\n }\r\n const topSource = high.findDirectExpression(Expressions.Source);\r\n if (topSource === undefined || topSource.getChildren().length !== 1) {\r\n return undefined;\r\n }\r\n let top = true;\r\n let child = topSource.getFirstChild();\r\n if (!(child.get() instanceof Expressions.StringTemplate)) {\r\n child = child.findFirstExpression(Expressions.StringTemplate);\r\n top = false;\r\n }\r\n if (child === undefined || !(child.get() instanceof Expressions.StringTemplate)) {\r\n return undefined;\r\n }\r\n const templateTokens = child.getChildren();\r\n if (templateTokens.length !== 3\r\n || templateTokens[0].getFirstToken().getStr() !== \"|{\"\r\n || templateTokens[2].getFirstToken().getStr() !== \"}|\") {\r\n return undefined;\r\n }\r\n const templateSource = child.findDirectExpression(Expressions.StringTemplateSource);\r\n const formatting = (_a = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.StringTemplateFormatting)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n let functionName = \"\";\r\n switch (formatting) {\r\n case \"ALPHA = IN\":\r\n functionName = \"CONVERSION_EXIT_ALPHA_INPUT\";\r\n break;\r\n case \"ALPHA = OUT\":\r\n functionName = \"CONVERSION_EXIT_ALPHA_OUTPUT\";\r\n break;\r\n default:\r\n return undefined;\r\n }\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const source = (_b = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n const topTarget = (_c = high.findDirectExpression(Expressions.Target)) === null || _c === void 0 ? void 0 : _c.concatTokens();\r\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n if (top === false) {\r\n const code = `DATA ${uniqueName} TYPE string.\n${indentation}CALL FUNCTION '${functionName}'\n${indentation} EXPORTING\n${indentation} input = ${source}\n${indentation} IMPORTING\n${indentation} output = ${uniqueName}.\\n`;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, child.getFirstToken().getStart(), child.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport ALPHA\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n else {\r\n const code = `CALL FUNCTION '${functionName}'\n${indentation} EXPORTING\n${indentation} input = ${source}\n${indentation} IMPORTING\n${indentation} output = ${topTarget}.`;\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport ALPHA\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n }\r\n outlineLoopInput(low, high, lowFile, highSyntax) {\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n else if (!(high.get() instanceof Statements.Loop)) {\r\n return undefined;\r\n }\r\n else if (high.findDirectExpression(Expressions.SimpleSource2)) {\r\n return undefined;\r\n }\r\n // the first Source must be outlined\r\n const s = high.findDirectExpression(Expressions.Source);\r\n if (s === undefined) {\r\n return undefined;\r\n }\r\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const code = `DATA(${uniqueName}) = ${s.concatTokens()}.\\n` +\r\n \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, s.getFirstToken().getStart(), s.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Outline LOOP input\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n outlineLoopTarget(node, lowFile, _highSyntax) {\r\n var _a, _b, _c, _d, _e, _f, _g;\r\n // also allows outlining of voided types\r\n if (!(node.get() instanceof Statements.Loop)) {\r\n return undefined;\r\n }\r\n const sourceName = (_a = node.findDirectExpression(Expressions.SimpleSource2)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n if (sourceName === undefined) {\r\n return undefined;\r\n }\r\n const concat = node.concatTokens().toUpperCase();\r\n if (concat.includes(\" REFERENCE INTO \")\r\n || concat.includes(\" GROUP BY \")\r\n || concat.startsWith(\"LOOP AT GROUP \")) {\r\n return undefined;\r\n }\r\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const dataTarget = (_c = (_b = node.findDirectExpression(Expressions.LoopTarget)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.Target)) === null || _c === void 0 ? void 0 : _c.findDirectExpression(Expressions.InlineData);\r\n if (dataTarget) {\r\n const targetName = ((_d = dataTarget.findDirectExpression(Expressions.TargetField)) === null || _d === void 0 ? void 0 : _d.concatTokens()) || \"DOWNPORT_ERROR\";\r\n const code = `DATA ${targetName} LIKE LINE OF ${sourceName}.\\n${indentation}`;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, dataTarget.getFirstToken().getStart(), dataTarget.getLastToken().getEnd(), targetName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline LOOP data target\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n const fsTarget = (_f = (_e = node.findDirectExpression(Expressions.LoopTarget)) === null || _e === void 0 ? void 0 : _e.findDirectExpression(Expressions.FSTarget)) === null || _f === void 0 ? void 0 : _f.findDirectExpression(Expressions.InlineFS);\r\n if (fsTarget) {\r\n const targetName = ((_g = fsTarget.findDirectExpression(Expressions.TargetFieldSymbol)) === null || _g === void 0 ? void 0 : _g.concatTokens()) || \"DOWNPORT_ERROR\";\r\n const code = `FIELD-SYMBOLS ${targetName} LIKE LINE OF ${sourceName}.\\n${indentation}`;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, fsTarget.getFirstToken().getStart(), fsTarget.getLastToken().getEnd(), targetName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline LOOP fs target\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n outlineFor(forLoop, indentation, lowFile, highSyntax) {\r\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\r\n let body = \"\";\r\n let end = \"\";\r\n const loopSource = (_a = forLoop.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n let loopTargetFieldExpression = forLoop.findFirstExpression(Expressions.TargetField);\r\n let loopTargetFieldName = loopTargetFieldExpression === null || loopTargetFieldExpression === void 0 ? void 0 : loopTargetFieldExpression.concatTokens();\r\n const of = forLoop.findExpressionAfterToken(\"OF\");\r\n if (of !== undefined) {\r\n loopTargetFieldExpression = of;\r\n loopTargetFieldName = of === null || of === void 0 ? void 0 : of.concatTokens();\r\n }\r\n if (((_c = (_b = forLoop.findDirectExpression(Expressions.InlineLoopDefinition)) === null || _b === void 0 ? void 0 : _b.getFirstChild()) === null || _c === void 0 ? void 0 : _c.get()) instanceof Expressions.TargetFieldSymbol) {\r\n loopTargetFieldExpression = undefined;\r\n loopTargetFieldName = undefined;\r\n }\r\n if (loopTargetFieldExpression) {\r\n const start = loopTargetFieldExpression.getFirstToken().getStart();\r\n const spag = highSyntax.spaghetti.lookupPosition(start, lowFile.getFilename());\r\n if (loopTargetFieldName && spag) {\r\n if (new SpagHelper(spag).isDuplicateName(loopTargetFieldName, start)) {\r\n this.renameVariable(spag, loopTargetFieldName, start, lowFile, highSyntax);\r\n }\r\n }\r\n }\r\n let cond = ((_d = forLoop.findDirectExpression(Expressions.ComponentCond)) === null || _d === void 0 ? void 0 : _d.concatTokens()) || \"\";\r\n if (cond !== \"\") {\r\n cond = \" WHERE \" + cond;\r\n }\r\n const loop = forLoop.findDirectExpression(Expressions.InlineLoopDefinition);\r\n const indexInto = (_e = loop === null || loop === void 0 ? void 0 : loop.findExpressionAfterToken(\"INTO\")) === null || _e === void 0 ? void 0 : _e.concatTokens();\r\n if (forLoop.findDirectTokenByText(\"UNTIL\")\r\n || forLoop.findDirectTokenByText(\"WHILE\")) {\r\n const fieldDef = forLoop.findDirectExpression(Expressions.InlineFieldDefinition);\r\n const field = (_f = fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.findFirstExpression(Expressions.Field)) === null || _f === void 0 ? void 0 : _f.concatTokens();\r\n const indexBackup = this.uniqueName(forLoop.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n body += indentation + \"DATA \" + field + \" TYPE i.\\n\";\r\n const second = fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.getChildren()[2];\r\n if ((second === null || second === void 0 ? void 0 : second.get()) instanceof Expressions.Source) {\r\n body += indentation + field + \" = \" + second.concatTokens() + \".\\n\";\r\n }\r\n const not = forLoop.findDirectTokenByText(\"UNTIL\") ? \" NOT\" : \"\";\r\n const cond = forLoop.findFirstExpression(Expressions.Cond);\r\n body += indentation + `DATA ${indexBackup} LIKE sy-index.\\n`;\r\n body += indentation + `${indexBackup} = sy-index.\\n`;\r\n body += indentation + `WHILE${not} ${cond === null || cond === void 0 ? void 0 : cond.concatTokens()}.\\n`;\r\n body += indentation + ` sy-index = ${indexBackup}.\\n`;\r\n const then = forLoop.findExpressionAfterToken(\"THEN\");\r\n if (then) {\r\n end += ` ${field} = ${then.concatTokens()}.\\n`;\r\n }\r\n else {\r\n end += ` ${field} = ${field} + 1.\\n`;\r\n }\r\n end += indentation + \"ENDWHILE\";\r\n }\r\n else if (loopTargetFieldName !== undefined) {\r\n let from = (_g = forLoop.findExpressionAfterToken(\"FROM\")) === null || _g === void 0 ? void 0 : _g.concatTokens();\r\n from = from ? \" FROM \" + from : \"\";\r\n let to = (_h = forLoop.findExpressionAfterToken(\"TO\")) === null || _h === void 0 ? void 0 : _h.concatTokens();\r\n to = to ? \" TO \" + to : \"\";\r\n let gby = \"\";\r\n for (const lg of forLoop.findDirectExpressions(Expressions.LoopGroupByComponent)) {\r\n if (gby !== \"\") {\r\n gby += \" \";\r\n }\r\n gby += lg.concatTokens();\r\n }\r\n if (gby !== \"\") {\r\n gby = \" GROUP BY ( \" + gby + \" )\";\r\n }\r\n const fc = forLoop.findDirectExpression(Expressions.FieldChain);\r\n if (fc) {\r\n gby = \" GROUP BY \" + fc.concatTokens();\r\n }\r\n if (forLoop.findDirectTokenByText(\"ASCENDING\")) {\r\n gby += \" ASCENDING\";\r\n }\r\n if (forLoop.findDirectTokenByText(\"DESCENDING\")) {\r\n gby += \" DESCENDING\";\r\n }\r\n const groups = forLoop.findExpressionAfterToken(\"GROUPS\");\r\n if (groups) {\r\n const concat = groups.concatTokens();\r\n if (concat.startsWith(\"<\")) {\r\n gby += \" ASSIGNING FIELD-SYMBOL(\" + concat + \")\";\r\n }\r\n else {\r\n gby += \" INTO DATA(\" + concat + \")\";\r\n }\r\n }\r\n let inGroup = \"\";\r\n if (forLoop.concatTokens().toUpperCase().includes(\" IN GROUP \")) {\r\n inGroup = \"-items\";\r\n }\r\n let into = \"INTO DATA\";\r\n if (loopTargetFieldName.startsWith(\"<\")) {\r\n into = \"ASSIGNING FIELD-SYMBOL\";\r\n }\r\n // todo, also backup sy-index / sy-tabix here?\r\n body += indentation + `LOOP AT ${loopSource}${inGroup} ${into}(${loopTargetFieldName})${from}${to}${cond}${gby}.\\n`;\r\n if (indexInto) {\r\n body += indentation + \" DATA(\" + indexInto + \") = sy-tabix.\\n\";\r\n }\r\n end = \"ENDLOOP\";\r\n }\r\n else if (loopTargetFieldName === undefined) {\r\n // todo, also backup sy-index / sy-tabix here?\r\n const loopTargetFieldSymbol = (_j = forLoop.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _j === void 0 ? void 0 : _j.concatTokens();\r\n body += indentation + `LOOP AT ${loopSource} ASSIGNING FIELD-SYMBOL(${loopTargetFieldSymbol})${cond}.\\n`;\r\n if (indexInto) {\r\n body += indentation + \" DATA(\" + indexInto + \") = sy-tabix.\\n\";\r\n }\r\n end = \"ENDLOOP\";\r\n }\r\n const l = forLoop.findDirectExpression(Expressions.Let);\r\n if (l) {\r\n body += this.outlineLet(l, indentation, highSyntax, lowFile);\r\n }\r\n return { body, end };\r\n }\r\n outlineFilter(low, high, lowFile, highSyntax) {\r\n var _a;\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n for (const i of high.findAllExpressionsRecursive(Expressions.Source)) {\r\n const firstToken = i.getFirstToken();\r\n if (firstToken.getStr().toUpperCase() !== \"FILTER\") {\r\n continue;\r\n }\r\n const filterBody = i.findDirectExpression(Expressions.FilterBody);\r\n if (filterBody === undefined) {\r\n continue;\r\n }\r\n const sourceName = (_a = filterBody.findDirectExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n if (sourceName === undefined) {\r\n continue;\r\n }\r\n let type = this.findType(i, lowFile, highSyntax);\r\n if (type === undefined) {\r\n type = \"LIKE \" + sourceName;\r\n }\r\n else {\r\n type = \"TYPE \" + type;\r\n }\r\n const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\r\n const loopName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n let body = \"\";\r\n body += `DATA ${uniqueName} ${type}.\\n`;\r\n body += `${indentation}LOOP AT ${sourceName} INTO DATA(${loopName}) ${filterBody.concatTokens().substring(sourceName.length + 1)}.\\n`;\r\n body += `${indentation} INSERT ${loopName} INTO TABLE ${uniqueName}.\\n`;\r\n body += `${indentation}ENDLOOP.\\n${indentation}`;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), body);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), i.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, firstToken, \"Downport FILTER\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n outlineSwitch(low, high, lowFile, highSyntax) {\r\n var _a, _b, _c, _d;\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n for (const i of high.findAllExpressionsRecursive(Expressions.Source)) {\r\n const firstToken = i.getFirstToken();\r\n if (firstToken.getStr().toUpperCase() !== \"SWITCH\") {\r\n continue;\r\n }\r\n let type = this.findType(i, lowFile, highSyntax);\r\n if (type === undefined) {\r\n if (high.get() instanceof Statements.Move\r\n && high.findDirectExpression(Expressions.Source) === i\r\n && ((_a = high.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.TargetField)) !== undefined) {\r\n type = \"LIKE \" + ((_b = high.findDirectExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.concatTokens());\r\n }\r\n if (type === undefined) {\r\n continue;\r\n }\r\n }\r\n else {\r\n type = \"TYPE \" + type;\r\n }\r\n const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n let body = \"\";\r\n let name = \"\";\r\n const switchBody = i.findDirectExpression(Expressions.SwitchBody);\r\n if (switchBody === undefined) {\r\n continue;\r\n }\r\n for (const l of ((_c = switchBody === null || switchBody === void 0 ? void 0 : switchBody.findDirectExpression(Expressions.Let)) === null || _c === void 0 ? void 0 : _c.findDirectExpressions(Expressions.InlineFieldDefinition)) || []) {\r\n name = l.getFirstToken().getStr();\r\n body += indentation + `DATA(${name}) = ${(_d = switchBody.findFirstExpression(Expressions.Source)) === null || _d === void 0 ? void 0 : _d.concatTokens()}.\\n`;\r\n }\r\n body += `DATA ${uniqueName} ${type}.\\n`;\r\n let firstSource = false;\r\n let inWhen = false;\r\n for (const c of switchBody.getChildren()) {\r\n if (c.get() instanceof Expressions.Source && firstSource === false) {\r\n body += indentation + `CASE ${c.concatTokens()}.`;\r\n firstSource = true;\r\n }\r\n else if (c instanceof nodes_1.TokenNode && c.concatTokens().toUpperCase() === \"THEN\") {\r\n inWhen = true;\r\n body += \".\\n\";\r\n }\r\n else if (c instanceof nodes_1.TokenNode && c.concatTokens().toUpperCase() === \"WHEN\") {\r\n inWhen = false;\r\n body += `\\n${indentation} WHEN `;\r\n }\r\n else if (c instanceof nodes_1.TokenNode && c.concatTokens().toUpperCase() === \"OR\") {\r\n body += ` OR `;\r\n }\r\n else if (c instanceof nodes_1.TokenNode && c.concatTokens().toUpperCase() === \"ELSE\") {\r\n inWhen = true;\r\n body += `\\n${indentation} WHEN OTHERS.\\n`;\r\n }\r\n else if (inWhen === false) {\r\n body += c.concatTokens();\r\n }\r\n else {\r\n body += indentation + \" \" + uniqueName + \" = \" + c.concatTokens() + \".\";\r\n }\r\n }\r\n body += \"\\n\" + indentation + \"ENDCASE.\\n\" + indentation;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), body);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), i.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, firstToken, \"Downport SWITCH\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n outlineReduce(low, high, lowFile, highSyntax) {\r\n var _a, _b;\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n for (const i of high.findAllExpressionsRecursive(Expressions.Source)) {\r\n const firstToken = i.getFirstToken();\r\n if (firstToken.getStr().toUpperCase() !== \"REDUCE\") {\r\n continue;\r\n }\r\n const type = this.findType(i, lowFile, highSyntax);\r\n if (type === undefined) {\r\n continue;\r\n }\r\n const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n let body = \"\";\r\n let name = \"\";\r\n const reduceBody = i.findDirectExpression(Expressions.ReduceBody);\r\n if (reduceBody === undefined) {\r\n continue;\r\n }\r\n const letNode = reduceBody.findDirectExpression(Expressions.Let);\r\n if (letNode) {\r\n body += this.outlineLet(letNode, indentation, highSyntax, lowFile);\r\n }\r\n let firstName = \"\";\r\n for (const init of reduceBody.findDirectExpressions(Expressions.InlineFieldDefinition)) {\r\n name = init.getFirstToken().getStr();\r\n if (firstName === \"\") {\r\n firstName = name;\r\n }\r\n const spag = highSyntax.spaghetti.lookupPosition(init.getFirstToken().getStart(), lowFile.getFilename());\r\n if (spag && new SpagHelper(spag).isDuplicateName(name, init.getFirstToken().getStart())) {\r\n this.renameVariable(spag, name, init.getFirstToken().getStart(), lowFile, highSyntax);\r\n }\r\n const s = (_a = init.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n const t = (_b = init.findFirstExpression(Expressions.TypeName)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n if (s) {\r\n body += indentation + `DATA(${name}) = ${s}.\\n`;\r\n }\r\n else {\r\n body += indentation + `DATA ${name} TYPE ${t}.\\n`;\r\n }\r\n }\r\n let end = \"\";\r\n for (const forLoop of (reduceBody === null || reduceBody === void 0 ? void 0 : reduceBody.findDirectExpressions(Expressions.For)) || []) {\r\n const outlineFor = this.outlineFor(forLoop, indentation, lowFile, highSyntax);\r\n body += outlineFor.body;\r\n end = outlineFor.end + `.\\n` + end;\r\n }\r\n const next = reduceBody.findDirectExpression(Expressions.ReduceNext);\r\n if (next === undefined) {\r\n continue;\r\n }\r\n for (const n of next.getChildren()) {\r\n const concat = n.concatTokens();\r\n if (concat.toUpperCase() === \"NEXT\") {\r\n continue;\r\n }\r\n else if (n.get() instanceof Expressions.SimpleTarget) {\r\n body += indentation + \" \" + concat + \" \";\r\n }\r\n else if (n.get() instanceof Expressions.Source) {\r\n body += \" \" + concat + \".\\n\";\r\n }\r\n else {\r\n body += concat;\r\n }\r\n }\r\n body += indentation + end;\r\n body += indentation + `${uniqueName} = ${firstName}.\\n`;\r\n const abap = `DATA ${uniqueName} TYPE ${type}.\\n` +\r\n body +\r\n indentation;\r\n const reduceEnd = i.findDirectTokenByText(\")\");\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), reduceEnd.getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, firstToken, \"Downport REDUCE\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n outlineValue(low, high, lowFile, highSyntax) {\r\n var _a, _b, _c;\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n const allSources = high.findAllExpressionsRecursive(Expressions.Source);\r\n for (const s of allSources) {\r\n const firstToken = s.getFirstToken();\r\n if (firstToken.getStr().toUpperCase() !== \"VALUE\") {\r\n continue;\r\n }\r\n let type = this.findType(s, lowFile, highSyntax);\r\n if (type === undefined) {\r\n if (high.get() instanceof Statements.Move && high.findDirectExpression(Expressions.Source) === s) {\r\n type = \"LIKE \" + ((_a = high.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.concatTokens());\r\n }\r\n if (type === undefined) {\r\n continue;\r\n }\r\n }\r\n else {\r\n type = \"TYPE \" + type;\r\n }\r\n const valueBody = s.findDirectExpression(Expressions.ValueBody);\r\n const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\r\n let indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n let body = \"\";\r\n const base = valueBody === null || valueBody === void 0 ? void 0 : valueBody.findExpressionAfterToken(\"BASE\");\r\n if (base) {\r\n body += indentation + uniqueName + \" = \" + base.concatTokens() + \".\\n\";\r\n }\r\n let end = \"\";\r\n let structureName = uniqueName;\r\n let added = false;\r\n let data = \"\";\r\n let previous = undefined;\r\n for (const a of (valueBody === null || valueBody === void 0 ? void 0 : valueBody.getChildren()) || []) {\r\n if (a.get() instanceof Expressions.FieldAssignment) {\r\n if (added === false) {\r\n body += data;\r\n added = true;\r\n }\r\n body += indentation + structureName + \"-\" + a.concatTokens() + \".\\n\";\r\n }\r\n else if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.For) {\r\n const outlineFor = this.outlineFor(a, indentation, lowFile, highSyntax);\r\n body += outlineFor.body;\r\n end = outlineFor.end + `.\\n` + end;\r\n indentation += \" \";\r\n }\r\n else if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.Source) {\r\n // special handling for superflous value expression\r\n if ((valueBody === null || valueBody === void 0 ? void 0 : valueBody.getChildren().length) === 1) {\r\n body += indentation + uniqueName + \" = \" + a.concatTokens() + `.\\n`;\r\n }\r\n }\r\n else if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.Let) {\r\n body += this.outlineLet(a, indentation, highSyntax, lowFile);\r\n }\r\n if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.ValueBodyLine) {\r\n let skip = false;\r\n for (const b of (a === null || a === void 0 ? void 0 : a.getChildren()) || []) {\r\n if (b.concatTokens() === \"(\" && added === false) {\r\n structureName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\r\n data = indentation + `DATA ${structureName} LIKE LINE OF ${uniqueName}.\\n`;\r\n }\r\n if (b.get() instanceof Expressions.FieldAssignment) {\r\n if (added === false) {\r\n body += data;\r\n added = true;\r\n }\r\n body += indentation + structureName + \"-\" + b.concatTokens() + \".\\n\";\r\n }\r\n else if (b.get() instanceof Expressions.Source) {\r\n body += indentation + \"APPEND \" + b.concatTokens() + ` TO ${uniqueName}.\\n`;\r\n skip = true;\r\n }\r\n else if (b.get() instanceof Expressions.ValueBodyLines) {\r\n body += indentation + \"APPEND \" + b.concatTokens() + ` TO ${uniqueName}.\\n`;\r\n skip = true;\r\n }\r\n else if (b.concatTokens() === \")\") {\r\n if (added === false && (previous === null || previous === void 0 ? void 0 : previous.concatTokens()) === \"(\") {\r\n body += data;\r\n added = true;\r\n }\r\n if (skip === false) {\r\n body += indentation + `APPEND ${structureName} TO ${uniqueName}.\\n`;\r\n }\r\n }\r\n previous = b;\r\n }\r\n }\r\n }\r\n if (body === \"\" && ((_b = valueBody === null || valueBody === void 0 ? void 0 : valueBody.getLastChild()) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr().toUpperCase()) === \"OPTIONAL\") {\r\n const fieldChain = valueBody.findFirstExpression(Expressions.FieldChain);\r\n const rowName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\r\n let tableExpression = undefined;\r\n let tabName = \"\";\r\n let after = \"\";\r\n for (const c of (fieldChain === null || fieldChain === void 0 ? void 0 : fieldChain.getChildren()) || []) {\r\n if (c.get() instanceof Expressions.TableExpression && c instanceof nodes_1.ExpressionNode) {\r\n tableExpression = c;\r\n }\r\n else if (tableExpression === undefined) {\r\n tabName += c.concatTokens();\r\n }\r\n else {\r\n after += c.concatTokens();\r\n }\r\n }\r\n let condition = \"\";\r\n if ((tableExpression === null || tableExpression === void 0 ? void 0 : tableExpression.getChildren().length) === 3) {\r\n condition = \"INDEX \" + ((_c = tableExpression === null || tableExpression === void 0 ? void 0 : tableExpression.findDirectExpression(Expressions.Source)) === null || _c === void 0 ? void 0 : _c.concatTokens());\r\n }\r\n else {\r\n condition = \"WITH KEY \" + (tableExpression === null || tableExpression === void 0 ? void 0 : tableExpression.concatTokens().replace(\"[ \", \"\").replace(\" ]\", \"\"));\r\n }\r\n body +=\r\n indentation + `READ TABLE ${tabName} INTO DATA(${rowName}) ${condition}.\\n` +\r\n indentation + `IF sy-subrc = 0.\\n` +\r\n indentation + ` ${uniqueName} = ${rowName}${after}.\\n` +\r\n indentation + `ENDIF.\\n`;\r\n }\r\n if (end !== \"\") {\r\n indentation = indentation.substring(2);\r\n body += indentation + end;\r\n }\r\n const abap = `DATA ${uniqueName} ${type}.\\n` +\r\n indentation + `CLEAR ${uniqueName}.\\n` + // might be called inside a loop\r\n body +\r\n indentation;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), s.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, firstToken, \"Downport VALUE\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n outlineLet(node, indentation, highSyntax, lowFile) {\r\n var _a;\r\n let ret = \"\";\r\n for (const f of node.findDirectExpressions(Expressions.InlineFieldDefinition)) {\r\n const c = f.getFirstChild();\r\n if (c === undefined) {\r\n continue;\r\n }\r\n const name = c.concatTokens().toLowerCase();\r\n const spag = highSyntax.spaghetti.lookupPosition(c.getFirstToken().getStart(), lowFile.getFilename());\r\n if (spag === undefined) {\r\n continue;\r\n }\r\n if (new SpagHelper(spag).isDuplicateName(name, c.getFirstToken().getStart())) {\r\n this.renameVariable(spag, name, c.getFirstToken().getStart(), lowFile, highSyntax);\r\n }\r\n const found = spag.findVariable(name);\r\n if (found === undefined) {\r\n const source = f.findFirstExpression(Expressions.Source);\r\n if (source) {\r\n ret += indentation + \"DATA(\" + name + `) = ${source.concatTokens()}.\\n`;\r\n }\r\n continue;\r\n }\r\n const type = found.getType().getQualifiedName() ? (_a = found.getType().getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toLowerCase() : found.getType().toABAP();\r\n ret += indentation + \"DATA \" + name + ` TYPE ${type}.\\n`;\r\n const source = f.findFirstExpression(Expressions.Source);\r\n if (source) {\r\n ret += indentation + name + ` = ${source.concatTokens()}.\\n`;\r\n }\r\n }\r\n return ret;\r\n }\r\n renameVariable(spag, name, pos, lowFile, highSyntax) {\r\n const newName = this.uniqueName(pos, lowFile.getFilename(), highSyntax);\r\n const fix = new SpagHelper(spag).renameVariable(name, pos, lowFile, newName);\r\n const issue = issue_1.Issue.atPosition(lowFile, pos, \"Rename before outline\", this.getMetadata().key, this.conf.severity, fix);\r\n throw new SkipToNextFile(issue);\r\n }\r\n findType(i, lowFile, highSyntax, ref = false) {\r\n var _a;\r\n const expr = i.findDirectExpression(Expressions.TypeNameOrInfer);\r\n if (expr === undefined) {\r\n return undefined;\r\n }\r\n const firstToken = expr.getFirstToken();\r\n const concat = expr.concatTokens().toLowerCase();\r\n if (concat !== \"#\") {\r\n return ref ? \"REF TO \" + concat : concat;\r\n }\r\n const spag = highSyntax.spaghetti.lookupPosition(firstToken.getStart(), lowFile.getFilename());\r\n if (spag === undefined) {\r\n return undefined;\r\n }\r\n let inferred = undefined;\r\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\r\n if (r.referenceType === _reference_1.ReferenceType.InferredType\r\n && r.resolved\r\n && r.position.getStart().equals(firstToken.getStart())\r\n && r.resolved instanceof _typed_identifier_1.TypedIdentifier) {\r\n inferred = r.resolved;\r\n break;\r\n }\r\n }\r\n if (inferred === undefined) {\r\n return undefined;\r\n }\r\n if (inferred.getType() instanceof basic_1.ObjectReferenceType) {\r\n return inferred.getType().toABAP();\r\n }\r\n else {\r\n return (_a = inferred.getType().getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toLowerCase();\r\n }\r\n }\r\n outlineFS(low, high, lowFile, highSyntax) {\r\n var _a, _b;\r\n if (!(low.get() instanceof _statement_1.Unknown)\r\n || (high.get() instanceof Statements.Loop)) {\r\n return undefined;\r\n }\r\n for (const i of high.findAllExpressionsRecursive(Expressions.InlineFS)) {\r\n const nameToken = (_a = i.findDirectExpression(Expressions.TargetFieldSymbol)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\r\n if (nameToken === undefined) {\r\n continue;\r\n }\r\n const name = nameToken.getStr();\r\n let type = \"\";\r\n if (high.concatTokens().toUpperCase().startsWith(\"APPEND INITIAL LINE TO \")) {\r\n type = \"LIKE LINE OF \" + ((_b = high.findFirstExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.concatTokens());\r\n }\r\n else {\r\n const spag = highSyntax.spaghetti.lookupPosition(nameToken.getStart(), lowFile.getFilename());\r\n if (spag === undefined) {\r\n continue;\r\n }\r\n const found = spag.findVariable(name);\r\n if (found === undefined) {\r\n continue;\r\n }\r\n else if (found.getType() instanceof basic_1.VoidType) {\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Error outlining voided type\", this.getMetadata().key, this.conf.severity);\r\n }\r\n type = \"TYPE \";\r\n type += found.getType().getQualifiedName() ? found.getType().getQualifiedName().toLowerCase() : found.getType().toABAP();\r\n }\r\n const code = `FIELD-SYMBOLS ${name} ${type}.\\n` +\r\n \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), name);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Outline FIELD-SYMBOL\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n outlineData(node, lowFile, highSyntax) {\r\n // hmm, no guard here, as DATA(SDF) is valid in 702\r\n var _a, _b;\r\n for (const i of node.findAllExpressionsRecursive(Expressions.InlineData)) {\r\n const nameToken = (_a = i.findDirectExpression(Expressions.TargetField)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\r\n if (nameToken === undefined) {\r\n continue;\r\n }\r\n const name = nameToken.getStr();\r\n const spag = highSyntax.spaghetti.lookupPosition(nameToken.getStart(), lowFile.getFilename());\r\n if (spag === undefined) {\r\n continue;\r\n }\r\n const found = spag.findVariable(name);\r\n if (found === undefined) {\r\n continue;\r\n }\r\n else if (found.getType() instanceof basic_1.VoidType && found.getType().getQualifiedName() === undefined) {\r\n continue;\r\n }\r\n let type = found.getType().getQualifiedName() ? (_b = found.getType().getQualifiedName()) === null || _b === void 0 ? void 0 : _b.toLowerCase() : found.getType().toABAP();\r\n if (found.getType() instanceof basic_1.ObjectReferenceType) {\r\n type = found.getType().toABAP();\r\n }\r\n const code = `DATA ${name} TYPE ${type}.\\n` +\r\n \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), name);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Outline DATA\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n outlineCond(low, high, lowFile, highSyntax) {\r\n var _a, _b;\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n for (const i of high.findAllExpressionsRecursive(Expressions.Source)) {\r\n if (i.getFirstToken().getStr().toUpperCase() !== \"COND\") {\r\n continue;\r\n }\r\n const body = i.findDirectExpression(Expressions.CondBody);\r\n if (body === undefined) {\r\n continue;\r\n }\r\n const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n let type = this.findType(i, lowFile, highSyntax);\r\n if (type === undefined) {\r\n if (high.get() instanceof Statements.Move\r\n && high.findDirectExpression(Expressions.Source) === i\r\n && ((_a = high.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.TargetField)) !== undefined) {\r\n type = \"LIKE \" + ((_b = high.findDirectExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.concatTokens());\r\n }\r\n if (type === undefined) {\r\n continue;\r\n }\r\n }\r\n else {\r\n type = \"TYPE \" + type;\r\n }\r\n const indent = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const bodyCode = this.buildCondBody(body, uniqueName, indent, lowFile, highSyntax);\r\n const abap = `DATA ${uniqueName} ${type}.\\n` + bodyCode;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Downport COND\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n buildCondBody(body, uniqueName, indent, lowFile, highSyntax) {\r\n let code = \"\";\r\n let first = true;\r\n let addElse = true;\r\n for (const c of body.getChildren()) {\r\n if (c instanceof nodes_1.TokenNode) {\r\n switch (c.getFirstToken().getStr().toUpperCase()) {\r\n case \"WHEN\":\r\n if (first === true) {\r\n code += indent + \"IF \";\r\n first = false;\r\n }\r\n else {\r\n code += indent + \"ELSEIF \";\r\n }\r\n break;\r\n case \"THEN\":\r\n code += \".\\n\";\r\n break;\r\n case \"ELSE\":\r\n code += indent + \"ELSE.\\n\";\r\n addElse = false;\r\n break;\r\n default:\r\n throw \"buildCondBody, unexpected token\";\r\n }\r\n }\r\n else if (c.get() instanceof Expressions.Cond) {\r\n code += c.concatTokens();\r\n }\r\n else if (c.get() instanceof Expressions.Let) {\r\n code += this.outlineLet(c, indent, highSyntax, lowFile);\r\n }\r\n else if (c.get() instanceof Expressions.Source) {\r\n code += indent + \" \" + uniqueName + \" = \" + c.concatTokens() + \".\\n\";\r\n }\r\n else {\r\n throw \"buildCondBody, unexpected expression, \" + c.get().constructor.name;\r\n }\r\n }\r\n if (addElse) {\r\n // COND might be called inside a loop\r\n code += indent + \"ELSE.\\n\";\r\n code += indent + ` CLEAR ${uniqueName}.\\n`;\r\n }\r\n code += indent + \"ENDIF.\\n\";\r\n code += indent;\r\n return code;\r\n }\r\n outlineConv(low, high, lowFile, highSyntax) {\r\n var _a;\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n for (const i of high.findAllExpressionsRecursive(Expressions.Source)) {\r\n if (i.getFirstToken().getStr().toUpperCase() !== \"CONV\") {\r\n continue;\r\n }\r\n const end = i.findDirectTokenByText(\")\");\r\n if (end === undefined) {\r\n continue;\r\n }\r\n const body = (_a = i.findDirectExpression(Expressions.ConvBody)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n if (body === undefined) {\r\n continue;\r\n }\r\n const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const type = this.findType(i, lowFile, highSyntax);\r\n const indent = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const abap = `DATA ${uniqueName} TYPE ${type}.\\n` +\r\n indent + `${uniqueName} = ${body}.\\n` +\r\n indent;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), end.getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Downport CONV\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n // \"CAST\" to \"?=\"\r\n outlineCast(low, high, lowFile, highSyntax) {\r\n var _a;\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n for (const i of high.findAllExpressionsRecursive(Expressions.Cast)) {\r\n const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const type = this.findType(i, lowFile, highSyntax, true);\r\n const body = (_a = i.findDirectExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n const abap = `DATA ${uniqueName} TYPE ${type}.\\n` +\r\n \" \".repeat(high.getFirstToken().getStart().getCol() - 1) +\r\n `${uniqueName} ?= ${body}.\\n` +\r\n \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Downport CAST\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n uniqueName(position, filename, highSyntax) {\r\n const spag = highSyntax.spaghetti.lookupPosition(position, filename);\r\n if (spag === undefined) {\r\n const name = \"temprr\" + this.counter;\r\n this.counter++;\r\n return name;\r\n }\r\n while (true) {\r\n const name = \"temp\" + this.counter;\r\n const exists = this.existsRecursive(spag, name);\r\n this.counter++;\r\n if (exists === false) {\r\n return name;\r\n }\r\n }\r\n }\r\n existsRecursive(spag, name) {\r\n const existsDirect = spag.findVariable(name);\r\n if (existsDirect) {\r\n return true;\r\n }\r\n for (const child of spag.getChildren()) {\r\n if (child.findVariable(name) || this.existsRecursive(child, name)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n replaceXsdBool(node, lowFile, highSyntax) {\r\n const spag = highSyntax.spaghetti.lookupPosition(node.getFirstToken().getStart(), lowFile.getFilename());\r\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\r\n if (r.referenceType === _reference_1.ReferenceType.BuiltinMethodReference\r\n && r.position.getName().toUpperCase() === \"XSDBOOL\") {\r\n const token = r.position.getToken();\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, token.getStart(), token.getEnd(), \"boolc\");\r\n return issue_1.Issue.atToken(lowFile, token, \"Use BOOLC\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n }\r\n return undefined;\r\n }\r\n findMethodCallExpression(node, token) {\r\n var _a;\r\n for (const m of node.findAllExpressions(Expressions.MethodCall)) {\r\n if ((_a = m.findDirectExpression(Expressions.MethodName)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStart().equals(token.getStart())) {\r\n return m;\r\n }\r\n }\r\n return undefined;\r\n }\r\n replaceMethodConditional(low, high, lowFile, highSyntax) {\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n for (const c of high.findAllExpressionsRecursive(Expressions.Compare)) {\r\n const chain = c.findDirectExpression(Expressions.MethodCallChain);\r\n if (chain === undefined) {\r\n continue;\r\n }\r\n let predicate = false;\r\n const spag = highSyntax.spaghetti.lookupPosition(high.getFirstToken().getStart(), lowFile.getFilename());\r\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\r\n if (r.referenceType === _reference_1.ReferenceType.BuiltinMethodReference &&\r\n new _builtin_1.BuiltIn().isPredicate(chain.getFirstToken().getStr().toUpperCase())) {\r\n predicate = true;\r\n break;\r\n }\r\n }\r\n const end = chain.getLastToken().getEnd();\r\n let fix = edit_helper_1.EditHelper.insertAt(lowFile, end, \" IS NOT INITIAL\");\r\n if (predicate === true) {\r\n fix = edit_helper_1.EditHelper.insertAt(lowFile, end, \" ) = abap_true\");\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, chain.getFirstToken().getStart(), \"boolc( \");\r\n fix = edit_helper_1.EditHelper.merge(fix, fix1);\r\n }\r\n return issue_1.Issue.atToken(lowFile, chain.getFirstToken(), \"Downport method conditional\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n getReference(node, lowFile, _highSyntax) {\r\n var _a, _b, _c;\r\n if (!(node.get() instanceof Statements.GetReference)) {\r\n return undefined;\r\n }\r\n const inline = (_a = node.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.InlineData);\r\n if (inline === undefined) {\r\n return undefined;\r\n }\r\n const targetName = (_b = inline.findDirectExpression(Expressions.TargetField)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n const sourceName = (_c = node.findDirectExpression(Expressions.Source)) === null || _c === void 0 ? void 0 : _c.concatTokens();\r\n if (targetName === undefined || sourceName === undefined) {\r\n return undefined;\r\n }\r\n const code = `DATA ${targetName} LIKE REF TO ${sourceName}.\\n`;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inline.getFirstToken().getStart(), inline.getLastToken().getEnd(), targetName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, inline.getFirstToken(), \"Downport, outline DATA ref\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n replaceContains(node, lowFile, highSyntax) {\r\n const spag = highSyntax.spaghetti.lookupPosition(node.getFirstToken().getStart(), lowFile.getFilename());\r\n // only downport if its an single method call condition\r\n let found = false;\r\n for (const c of node.findAllExpressionsRecursive(Expressions.Compare)) {\r\n found = c.findDirectExpression(Expressions.MethodCallChain) !== undefined;\r\n if (found === true) {\r\n break;\r\n }\r\n }\r\n if (found === false) {\r\n return undefined;\r\n }\r\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\r\n if (r.referenceType !== _reference_1.ReferenceType.BuiltinMethodReference) {\r\n continue;\r\n }\r\n const func = r.position.getName().toUpperCase();\r\n if (func === \"CONTAINS\") {\r\n const token = r.position.getToken();\r\n const expression = this.findMethodCallExpression(node, token);\r\n if (expression === undefined) {\r\n continue;\r\n }\r\n const sList = expression.findAllExpressions(Expressions.Source).map(e => e.concatTokens());\r\n if (sList.length !== 2) {\r\n continue;\r\n }\r\n const code = sList[0] + \" CS \" + sList[1];\r\n const start = expression.getFirstToken().getStart();\r\n const end = expression.getLastToken().getEnd();\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);\r\n return issue_1.Issue.atToken(lowFile, token, \"Downport contains()\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n }\r\n return undefined;\r\n }\r\n replaceLineFunctions(node, lowFile, highSyntax) {\r\n var _a, _b;\r\n const spag = highSyntax.spaghetti.lookupPosition(node.getFirstToken().getStart(), lowFile.getFilename());\r\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\r\n if (r.referenceType !== _reference_1.ReferenceType.BuiltinMethodReference) {\r\n continue;\r\n }\r\n const func = r.position.getName().toUpperCase();\r\n if (func === \"LINE_EXISTS\" || func === \"LINE_INDEX\") {\r\n const token = r.position.getToken();\r\n const expression = this.findMethodCallExpression(node, token);\r\n if (expression === undefined) {\r\n continue;\r\n }\r\n let condition = \"\";\r\n for (const c of ((_a = expression === null || expression === void 0 ? void 0 : expression.findFirstExpression(Expressions.TableExpression)) === null || _a === void 0 ? void 0 : _a.getChildren()) || []) {\r\n if (c.getFirstToken().getStr() === \"[\" || c.getFirstToken().getStr() === \"]\") {\r\n continue;\r\n }\r\n else if (c.get() instanceof Expressions.ComponentChainSimple && condition === \"\") {\r\n condition = \"WITH KEY \";\r\n }\r\n else if (c.get() instanceof Expressions.Source && condition === \"\") {\r\n condition = \"INDEX \";\r\n }\r\n condition += c.concatTokens() + \" \";\r\n }\r\n const tableName = (_b = expression.findFirstExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens().split(\"[\")[0];\r\n const uniqueName = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const sy = func === \"LINE_EXISTS\" ? \"sy-subrc\" : \"sy-tabix\";\r\n const code = `DATA ${uniqueName} LIKE sy-subrc.\\n` +\r\n indentation + `READ TABLE ${tableName} ${condition}TRANSPORTING NO FIELDS.\\n` +\r\n indentation + uniqueName + ` = ${sy}.\\n` +\r\n indentation;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\r\n const start = expression.getFirstToken().getStart();\r\n const end = expression.getLastToken().getEnd();\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, uniqueName + (func === \"LINE_EXISTS\" ? \" = 0\" : \"\"));\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, token, \"Use BOOLC\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n }\r\n return undefined;\r\n }\r\n newToCreateObject(low, high, lowFile, highSyntax) {\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n const source = high.findDirectExpression(Expressions.Source);\r\n let fix = undefined;\r\n if (high.get() instanceof Statements.Move\r\n && source\r\n && source.getFirstToken().getStr().toUpperCase() === \"NEW\") {\r\n const target = high.findDirectExpression(Expressions.Target);\r\n const found = source === null || source === void 0 ? void 0 : source.findFirstExpression(Expressions.NewObject);\r\n // must be at top level of the source for quickfix to work(todo: handle more scenarios)\r\n if (target\r\n && found\r\n && source.concatTokens() === found.concatTokens()\r\n && target.findDirectExpression(Expressions.InlineData) === undefined) {\r\n const abap = this.newParameters(found, target.concatTokens(), highSyntax, lowFile);\r\n if (abap !== undefined) {\r\n fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), abap);\r\n }\r\n }\r\n }\r\n if (fix === undefined && high.findAllExpressions(Expressions.NewObject)) {\r\n const found = high.findFirstExpression(Expressions.NewObject);\r\n if (found === undefined) {\r\n return undefined;\r\n }\r\n const name = this.uniqueName(found.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const abap = this.newParameters(found, name, highSyntax, lowFile);\r\n if (abap === undefined) {\r\n return undefined;\r\n }\r\n const type = this.findType(found, lowFile, highSyntax);\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const data = `DATA ${name} TYPE REF TO ${type}.\\n` +\r\n indentation + abap + \"\\n\" +\r\n indentation;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), data);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, found.getFirstToken().getStart(), found.getLastToken().getEnd(), name);\r\n fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n }\r\n if (fix) {\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Use CREATE OBJECT instead of NEW\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n else {\r\n return undefined;\r\n }\r\n }\r\n newParameters(found, name, highSyntax, lowFile) {\r\n var _a, _b, _c;\r\n const typeToken = (_a = found.findDirectExpression(Expressions.TypeNameOrInfer)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\r\n let extra = (typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStr()) === \"#\" ? \"\" : \" TYPE \" + (typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStr());\r\n const parameters = found.findFirstExpression(Expressions.ParameterListS);\r\n if (parameters) {\r\n extra = parameters ? extra + \" EXPORTING \" + parameters.concatTokens() : extra;\r\n }\r\n else if (typeToken) {\r\n const source = (_b = found.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n if (source) {\r\n // find the default parameter name for the constructor\r\n const spag = highSyntax.spaghetti.lookupPosition(typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStart(), lowFile.getFilename());\r\n let cdef = undefined;\r\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\r\n if ((r.referenceType === _reference_1.ReferenceType.InferredType\r\n || r.referenceType === _reference_1.ReferenceType.ObjectOrientedReference)\r\n && r.resolved && r.position.getStart().equals(typeToken.getStart())) {\r\n cdef = r.resolved;\r\n }\r\n }\r\n if (cdef && cdef.getMethodDefinitions === undefined) {\r\n return undefined; // something wrong\r\n }\r\n const importing = (_c = cdef === null || cdef === void 0 ? void 0 : cdef.getMethodDefinitions().getByName(\"CONSTRUCTOR\")) === null || _c === void 0 ? void 0 : _c.getParameters().getDefaultImporting();\r\n if (importing) {\r\n extra += \" EXPORTING \" + importing + \" = \" + source;\r\n }\r\n else if (spag === undefined) {\r\n extra += \" SpagUndefined\";\r\n }\r\n else if (cdef === undefined) {\r\n extra += \" ClassDefinitionNotFound\";\r\n }\r\n else {\r\n extra += \" SomeError\";\r\n }\r\n }\r\n }\r\n const abap = `CREATE OBJECT ${name}${extra}.`;\r\n return abap;\r\n }\r\n}\r\nexports.Downport = Downport;\r\n//# sourceMappingURL=downport.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/downport.js?");
|
|
12185
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Downport = exports.DownportConf = void 0;\r\n/* eslint-disable max-len */\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 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 _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst registry_1 = __webpack_require__(/*! ../registry */ \"./node_modules/@abaplint/core/build/src/registry.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ \"./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js\");\r\nconst basic_1 = __webpack_require__(/*! ../abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst config_1 = __webpack_require__(/*! ../config */ \"./node_modules/@abaplint/core/build/src/config.js\");\r\nconst tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nconst include_graph_1 = __webpack_require__(/*! ../utils/include_graph */ \"./node_modules/@abaplint/core/build/src/utils/include_graph.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst _builtin_1 = __webpack_require__(/*! ../abap/5_syntax/_builtin */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin.js\");\r\nconst _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\r\n// todo: refactor each sub-rule to new classes?\r\n// todo: add configuration\r\nclass DownportConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.DownportConf = DownportConf;\r\nclass SkipToNextFile extends Error {\r\n constructor(issue) {\r\n super();\r\n this.issue = issue;\r\n }\r\n}\r\nclass SpagHelper {\r\n constructor(spag) {\r\n this.spag = spag;\r\n }\r\n renameVariable(oldName, pos, lowFile, newName) {\r\n let fix = undefined;\r\n const references = this.findReferences(oldName, pos);\r\n references.sort((a, b) => {\r\n if (a.start.equals(b.start)) {\r\n return 0;\r\n }\r\n return a.start.isAfter(b.start) ? 1 : -1;\r\n });\r\n for (const r of references) {\r\n const replace = edit_helper_1.EditHelper.replaceRange(lowFile, r.start, r.end, newName);\r\n if (fix === undefined) {\r\n fix = replace;\r\n }\r\n else {\r\n fix = edit_helper_1.EditHelper.merge(replace, fix);\r\n }\r\n }\r\n return fix;\r\n }\r\n findReferences(name, pos) {\r\n var _a, _b;\r\n const positions = [];\r\n function has(element) {\r\n return positions.some(a => a.start.equals(element.start));\r\n }\r\n for (const r of this.spag.getData().references) {\r\n if (((_a = r.resolved) === null || _a === void 0 ? void 0 : _a.getName()) === name && ((_b = r.resolved) === null || _b === void 0 ? void 0 : _b.getStart().equals(pos))) {\r\n const sub = {\r\n start: r.position.getStart(),\r\n end: r.position.getEnd(),\r\n };\r\n if (has(sub) === false) {\r\n positions.push(sub);\r\n }\r\n }\r\n }\r\n for (const child of this.spag.getChildren()) {\r\n const subPositions = new SpagHelper(child).findReferences(name, pos);\r\n for (const sub of subPositions) {\r\n if (has(sub) === false) {\r\n positions.push(sub);\r\n }\r\n }\r\n }\r\n return positions;\r\n }\r\n findRecursiveDuplicate(name, skip) {\r\n var _a;\r\n const found = this.spag.findVariable(name);\r\n if ((found === null || found === void 0 ? void 0 : found.getStart().equals(skip)) === false) {\r\n return found;\r\n }\r\n for (const child of ((_a = this.spag) === null || _a === void 0 ? void 0 : _a.getChildren()) || []) {\r\n const sub = new SpagHelper(child).findRecursiveDuplicate(name, skip);\r\n if (sub) {\r\n return sub;\r\n }\r\n }\r\n return undefined;\r\n }\r\n isDuplicateName(name, pos) {\r\n let parent = this.spag.getParent();\r\n while ((parent === null || parent === void 0 ? void 0 : parent.getIdentifier().stype) === _scope_type_1.ScopeType.Let\r\n || (parent === null || parent === void 0 ? void 0 : parent.getIdentifier().stype) === _scope_type_1.ScopeType.For) {\r\n parent = parent.getParent();\r\n }\r\n if (parent === undefined) {\r\n return undefined;\r\n }\r\n return new SpagHelper(parent).findRecursiveDuplicate(name, pos) !== undefined;\r\n }\r\n}\r\nclass Downport {\r\n constructor() {\r\n this.conf = new DownportConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"downport\",\r\n title: \"Downport statement\",\r\n shortDescription: `Experimental downport functionality`,\r\n extendedInformation: `Much like the 'commented_code' rule this rule loops through unknown statements and tries parsing with\r\na higher level language version. If successful, various rules are applied to downport the statement.\r\nTarget downport version is always v702, thus rule is only enabled if target version is v702.\r\n\r\nCurrent rules:\r\n* NEW transformed to CREATE OBJECT, opposite of https://rules.abaplint.org/use_new/\r\n* DATA() definitions are outlined, opposite of https://rules.abaplint.org/prefer_inline/\r\n* FIELD-SYMBOL() definitions are outlined\r\n* CONV is outlined\r\n* COND is outlined\r\n* REDUCE is outlined\r\n* SWITCH is outlined\r\n* FILTER is outlined\r\n* APPEND expression is outlined\r\n* INSERT expression is outlined\r\n* EMPTY KEY is changed to DEFAULT KEY, opposite of DEFAULT KEY in https://rules.abaplint.org/avoid_use/\r\n* CAST changed to ?=\r\n* LOOP AT method_call( ) is outlined\r\n* VALUE # with structure fields\r\n* VALUE # with internal table lines\r\n* Table Expressions are outlined\r\n* SELECT INTO @DATA definitions are outlined\r\n* Some occurrences of string template formatting option ALPHA changed to function module call\r\n* SELECT/INSERT/MODIFY/DELETE/UPDATE \",\" in field list removed, \"@\" in source/targets removed\r\n* PARTIALLY IMPLEMENTED removed, it can be quick fixed via rule implement_methods\r\n* RAISE EXCEPTION ... MESSAGE\r\n* Moving with +=, -=, /=, *=, &&= is expanded\r\n* line_exists and line_index is downported to READ TABLE\r\n* ENUMs, but does not nessesarily give the correct type and value\r\n* MESSAGE with non simple source\r\n\r\nOnly one transformation is applied to a statement at a time, so multiple steps might be required to do the full downport.`,\r\n tags: [_irule_1.RuleTag.Experimental, _irule_1.RuleTag.Downport, _irule_1.RuleTag.Quickfix],\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 initialize(reg) {\r\n this.lowReg = reg;\r\n const version = this.lowReg.getConfig().getVersion();\r\n if (version === version_1.Version.v702 || version === version_1.Version.OpenABAP) {\r\n this.initHighReg();\r\n }\r\n return this;\r\n }\r\n listMainForInclude(filename) {\r\n if (filename === undefined) {\r\n return [];\r\n }\r\n // only initialize this.graph if needed\r\n if (this.graph === undefined) {\r\n this.graph = new include_graph_1.IncludeGraph(this.lowReg);\r\n }\r\n return this.graph.listMainForInclude(filename);\r\n }\r\n run(lowObj) {\r\n var _a;\r\n const ret = [];\r\n this.counter = 1;\r\n const version = this.lowReg.getConfig().getVersion();\r\n if (version !== version_1.Version.v702 && version !== version_1.Version.OpenABAP) {\r\n return ret;\r\n }\r\n else if (!(lowObj instanceof _abap_object_1.ABAPObject)) {\r\n return ret;\r\n }\r\n const highObj = this.highReg.getObject(lowObj.getType(), lowObj.getName());\r\n if (highObj === undefined || !(highObj instanceof _abap_object_1.ABAPObject)) {\r\n return ret;\r\n }\r\n let highSyntaxObj = highObj;\r\n // for includes do the syntax check via a main program\r\n if (lowObj instanceof objects_1.Program && lowObj.isInclude()) {\r\n const mains = this.listMainForInclude((_a = lowObj.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getFilename());\r\n if (mains.length <= 0) {\r\n return [];\r\n }\r\n const f = this.highReg.getFileByName(mains[0]);\r\n if (f === undefined) {\r\n return [];\r\n }\r\n highSyntaxObj = this.highReg.findObjectForFile(f);\r\n }\r\n for (const lowFile of lowObj.getABAPFiles()) {\r\n let highSyntax = undefined;\r\n const highFile = highObj.getABAPFileByName(lowFile.getFilename());\r\n if (highFile === undefined) {\r\n continue;\r\n }\r\n const lowStatements = lowFile.getStatements();\r\n const highStatements = highFile.getStatements();\r\n if (lowStatements.length !== highStatements.length) {\r\n // after applying a fix, there might be more statements in lowFile\r\n // should highReg be initialized again?\r\n /*\r\n const message = \"Internal Error: Statement lengths does not match\";\r\n ret.push(Issue.atStatement(lowFile, lowStatements[0], message, this.getMetadata().key));\r\n */\r\n // hmm, add some way to disable lazyUnknown() in statement_parser.ts\r\n // alternatively explicit enable it in vscode, its only relevant when a user is\r\n // actively editing the files\r\n continue;\r\n }\r\n for (let i = 0; i < lowStatements.length; i++) {\r\n const low = lowStatements[i];\r\n const high = highStatements[i];\r\n if ((low.get() instanceof _statement_1.Unknown && !(high.get() instanceof _statement_1.Unknown))\r\n || high.findFirstExpression(Expressions.InlineData)) {\r\n if (highSyntax === undefined) {\r\n highSyntax = new syntax_1.SyntaxLogic(this.highReg, highSyntaxObj).run();\r\n }\r\n try {\r\n const issue = this.checkStatement(low, high, lowFile, highSyntax, highFile);\r\n if (issue) {\r\n ret.push(issue);\r\n }\r\n }\r\n catch (e) {\r\n if (e instanceof SkipToNextFile) {\r\n ret.push(e.issue);\r\n break;\r\n }\r\n else {\r\n throw e;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return ret;\r\n }\r\n ////////////////////\r\n /** clones the orginal repository into highReg, and parses it with higher language version */\r\n initHighReg() {\r\n // use default configuration, ie. default target version\r\n const highConfig = config_1.Config.getDefault().get();\r\n const lowConfig = this.lowReg.getConfig().get();\r\n highConfig.syntax.errorNamespace = lowConfig.syntax.errorNamespace;\r\n highConfig.syntax.globalConstants = lowConfig.syntax.globalConstants;\r\n highConfig.syntax.globalMacros = lowConfig.syntax.globalMacros;\r\n this.highReg = new registry_1.Registry();\r\n for (const o of this.lowReg.getObjects()) {\r\n for (const f of o.getFiles()) {\r\n if (this.lowReg.isDependency(o) === true) {\r\n this.highReg.addDependency(f);\r\n }\r\n else {\r\n this.highReg.addFile(f);\r\n }\r\n }\r\n }\r\n this.highReg.parse();\r\n }\r\n /** applies one rule at a time, multiple iterations are required to transform complex statements */\r\n checkStatement(low, high, lowFile, highSyntax, highFile) {\r\n if (low.getFirstToken().getStart() instanceof position_1.VirtualPosition) {\r\n return undefined;\r\n }\r\n let found = this.downportEnum(low, high, lowFile, highSyntax, highFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.partiallyImplemented(high, lowFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.raiseException(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.emptyKey(low, high, lowFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.stringTemplateAlpha(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.moveWithOperator(low, high, lowFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.moveWithSimpleValue(low, high, lowFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.assignWithTable(low, high, lowFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.downportRefSimple(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.downportCorrespondingSimple(high, lowFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.downportRef(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.downportLoopGroup(high, lowFile, highSyntax, highFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.callFunctionParameterSimple(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.moveWithTableTarget(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.downportSelectInline(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.downportSQLExtras(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineLoopInput(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineLoopTarget(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n let skipValue = false;\r\n let skipReduce = false;\r\n const valueBody = high.findFirstExpression(Expressions.ValueBody);\r\n const reduceBody = high.findFirstExpression(Expressions.ReduceBody);\r\n if (valueBody && reduceBody) {\r\n const valueToken = valueBody.getFirstToken();\r\n const reduceToken = reduceBody.getFirstToken();\r\n if (valueToken.getStart().isBefore(reduceToken.getStart())) {\r\n skipReduce = true;\r\n }\r\n else {\r\n skipValue = true;\r\n }\r\n }\r\n if (skipValue !== true) {\r\n found = this.outlineValue(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n }\r\n if (skipReduce !== true) {\r\n found = this.outlineReduce(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n }\r\n found = this.outlineSwitch(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineFilter(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineCast(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineConv(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineCond(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineCatchSimple(high, lowFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineDataSimple(high, lowFile);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineData(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.outlineFS(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.newToCreateObject(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.replaceXsdBool(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.replaceLineFunctions(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.getReference(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.replaceContains(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.replaceMethodConditional(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.replaceTableExpression(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.replaceAppendExpression(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.replaceInsertExpression(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.downportMessage(high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n return undefined;\r\n }\r\n //////////////////////////////////////////\r\n downportSQLExtras(low, high, lowFile, _highSyntax) {\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n if (!(high.get() instanceof Statements.Select)\r\n && !(high.get() instanceof Statements.SelectLoop)\r\n && !(high.get() instanceof Statements.UpdateDatabase)\r\n && !(high.get() instanceof Statements.ModifyDatabase)\r\n && !(high.get() instanceof Statements.DeleteDatabase)\r\n && !(high.get() instanceof Statements.InsertDatabase)) {\r\n return undefined;\r\n }\r\n let fix = undefined;\r\n const addFix = (token) => {\r\n const add = edit_helper_1.EditHelper.deleteToken(lowFile, token);\r\n if (fix === undefined) {\r\n fix = add;\r\n }\r\n else {\r\n fix = edit_helper_1.EditHelper.merge(fix, add);\r\n }\r\n };\r\n const candidates = [high.findAllExpressionsRecursive(Expressions.SQLTarget),\r\n high.findAllExpressionsRecursive(Expressions.SQLSource),\r\n high.findAllExpressionsRecursive(Expressions.SQLSourceSimple)].flat();\r\n for (const c of candidates.reverse()) {\r\n if (c.getFirstToken() instanceof tokens_1.WAt\r\n || c.getFirstToken() instanceof tokens_1.At) {\r\n addFix(c.getFirstToken());\r\n }\r\n }\r\n for (const fieldList of high.findAllExpressionsMulti([Expressions.SQLFieldList, Expressions.SQLFieldListLoop], true)) {\r\n for (const token of fieldList.getDirectTokens()) {\r\n if (token.getStr() === \",\") {\r\n addFix(token);\r\n }\r\n }\r\n }\r\n if (fix !== undefined) {\r\n return issue_1.Issue.atToken(lowFile, low.getFirstToken(), \"SQL, remove @ and ,\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n for (const c of high.findAllExpressionsRecursive(Expressions.SQLIn)) {\r\n const children = c.getChildren();\r\n const first = children[1];\r\n if (!(first.get() instanceof tokens_1.WParenLeftW)) {\r\n continue;\r\n }\r\n const last = children[children.length - 1];\r\n if (last.get() instanceof tokens_1.WParenRightW || last.get() instanceof tokens_1.WParenRight) {\r\n const firstEnd = first.getFirstToken().getEnd();\r\n const endDelete = new position_1.Position(firstEnd.getRow(), firstEnd.getCol() + 1);\r\n const fix1 = edit_helper_1.EditHelper.deleteRange(lowFile, firstEnd, endDelete);\r\n const lastStart = last.getFirstToken().getStart();\r\n const startDelete = new position_1.Position(lastStart.getRow(), lastStart.getCol() - 1);\r\n const fix2 = edit_helper_1.EditHelper.deleteRange(lowFile, startDelete, lastStart);\r\n fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, low.getFirstToken(), \"SQL, remove spaces\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n }\r\n return undefined;\r\n }\r\n downportSelectInline(low, high, lowFile, highSyntax) {\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n else if (!(high.get() instanceof Statements.Select) && !(high.get() instanceof Statements.SelectLoop)) {\r\n return undefined;\r\n }\r\n // as first step outline the @DATA, note that void types are okay, as long the field names are specified\r\n let found = this.downportSelectSingleInline(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n found = this.downportSelectTableInline(low, high, lowFile, highSyntax);\r\n if (found) {\r\n return found;\r\n }\r\n return undefined;\r\n }\r\n downportSelectSingleInline(low, high, lowFile, _highSyntax) {\r\n var _a, _b, _c, _d;\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n const targets = ((_a = high.findFirstExpression(Expressions.SQLIntoStructure)) === null || _a === void 0 ? void 0 : _a.findDirectExpressions(Expressions.SQLTarget)) || [];\r\n if (targets.length !== 1) {\r\n return undefined;\r\n }\r\n const inlineData = targets[0].findFirstExpression(Expressions.InlineData);\r\n if (inlineData === undefined) {\r\n return undefined;\r\n }\r\n const sqlFrom = high.findAllExpressions(Expressions.SQLFromSource);\r\n if (sqlFrom.length !== 1) {\r\n return undefined;\r\n }\r\n const tableName = (_b = sqlFrom[0].findDirectExpression(Expressions.DatabaseTable)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n if (tableName === undefined) {\r\n return undefined;\r\n }\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n let fieldList = high.findFirstExpression(Expressions.SQLFieldList);\r\n if (fieldList === undefined) {\r\n fieldList = high.findFirstExpression(Expressions.SQLFieldListLoop);\r\n }\r\n if (fieldList === undefined) {\r\n return undefined;\r\n }\r\n let fieldDefinition = \"\";\r\n const fields = fieldList.findAllExpressions(Expressions.SQLFieldName);\r\n const name = ((_c = inlineData.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || \"error\";\r\n if (fields.length === 1) {\r\n fieldDefinition = `DATA ${name} TYPE ${tableName}-${fields[0].concatTokens()}.`;\r\n }\r\n else if (fieldList.concatTokens() === \"*\") {\r\n fieldDefinition = `DATA ${name} TYPE ${tableName}.`;\r\n }\r\n else if (fieldList.concatTokens().toUpperCase() === \"COUNT( * )\") {\r\n fieldDefinition = `DATA ${name} TYPE i.`;\r\n }\r\n else if (fieldList.getChildren().length === 1 && fieldList.getChildren()[0].get() instanceof Expressions.SQLAggregation) {\r\n const c = fieldList.getChildren()[0];\r\n if (c instanceof nodes_1.ExpressionNode) {\r\n const concat = (_d = c.findFirstExpression(Expressions.SQLArithmetics)) === null || _d === void 0 ? void 0 : _d.concatTokens();\r\n fieldDefinition = `DATA ${name} TYPE ${tableName}-${concat}.`;\r\n }\r\n }\r\n else {\r\n for (const f of fields) {\r\n const fieldName = f.concatTokens();\r\n fieldDefinition += indentation + \" \" + fieldName + \" TYPE \" + tableName + \"-\" + fieldName + \",\\n\";\r\n }\r\n fieldDefinition = `DATA: BEGIN OF ${name},\r\n${fieldDefinition}${indentation} END OF ${name}.`;\r\n }\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `${fieldDefinition}\r\n${indentation}`);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inlineData.getFirstToken().getStart(), inlineData.getLastToken().getEnd(), name);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, inlineData.getFirstToken(), \"Outline SELECT @DATA\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n downportSelectTableInline(low, high, lowFile, highSyntax) {\r\n var _a, _b, _c;\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n const targets = ((_a = high.findFirstExpression(Expressions.SQLIntoTable)) === null || _a === void 0 ? void 0 : _a.findDirectExpressions(Expressions.SQLTarget)) || [];\r\n if (targets.length !== 1) {\r\n return undefined;\r\n }\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const inlineData = targets[0].findFirstExpression(Expressions.InlineData);\r\n if (inlineData === undefined) {\r\n return undefined;\r\n }\r\n const sqlFrom = high.findAllExpressions(Expressions.SQLFromSource);\r\n if (sqlFrom.length === 0) {\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Error outlining, sqlFrom not found\", this.getMetadata().key, this.conf.severity);\r\n }\r\n let tableName = (_b = sqlFrom[0].findDirectExpression(Expressions.DatabaseTable)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n if (tableName === undefined) {\r\n return undefined;\r\n }\r\n const fieldList = high.findFirstExpression(Expressions.SQLFieldList);\r\n if (fieldList === undefined) {\r\n return undefined;\r\n }\r\n let fieldDefinitions = \"\";\r\n for (const f of fieldList.findAllExpressions(Expressions.SQLFieldName)) {\r\n let fieldName = f.concatTokens();\r\n if (fieldName.includes(\"~\")) {\r\n const split = fieldName.split(\"~\");\r\n tableName = split[0];\r\n fieldName = split[1];\r\n }\r\n fieldDefinitions += indentation + \" \" + fieldName + \" TYPE \" + tableName + \"-\" + fieldName + \",\\n\";\r\n }\r\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const name = ((_c = inlineData.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || \"error\";\r\n let fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `TYPES: BEGIN OF ${uniqueName},\r\n${fieldDefinitions}${indentation} END OF ${uniqueName}.\r\n${indentation}DATA ${name} TYPE STANDARD TABLE OF ${uniqueName} WITH DEFAULT KEY.\r\n${indentation}`);\r\n if (fieldDefinitions === \"\") {\r\n fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getStart(), `DATA ${name} TYPE STANDARD TABLE OF ${tableName} WITH DEFAULT KEY.\r\n${indentation}`);\r\n }\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inlineData.getFirstToken().getStart(), inlineData.getLastToken().getEnd(), name);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, inlineData.getFirstToken(), \"Outline SELECT @DATA\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n downportMessage(high, lowFile, highSyntax) {\r\n var _a, _b;\r\n if (!(high.get() instanceof Statements.Message)) {\r\n return undefined;\r\n }\r\n const foundWith = high.findExpressionAfterToken(\"WITH\");\r\n if (foundWith === undefined) {\r\n return undefined;\r\n }\r\n const likeSource = high.findExpressionAfterToken(\"LIKE\");\r\n for (const s of high.findAllExpressions(Expressions.Source)) {\r\n if (s === likeSource) {\r\n continue;\r\n }\r\n else if (s.getChildren().length === 1 && ((_a = s.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.Constant) {\r\n continue;\r\n }\r\n else if (s.getChildren().length === 1 && ((_b = s.getFirstChild()) === null || _b === void 0 ? void 0 : _b.get()) instanceof Expressions.FieldChain) {\r\n continue;\r\n }\r\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const firstToken = high.getFirstToken();\r\n const code = `DATA(${uniqueName}) = ${s.concatTokens()}.\\n${indentation}`;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, s.getFirstToken().getStart(), s.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Refactor MESSAGE WITH source\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n replaceAppendExpression(high, lowFile, highSyntax) {\r\n if (!(high.get() instanceof Statements.Append)) {\r\n return undefined;\r\n }\r\n const children = high.getChildren();\r\n if (children[1].get() instanceof Expressions.Source) {\r\n const source = children[1];\r\n const target = high.findDirectExpression(Expressions.Target);\r\n if (target === undefined) {\r\n return undefined;\r\n }\r\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const firstToken = high.getFirstToken();\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${target === null || target === void 0 ? void 0 : target.concatTokens()}.\r\n${indentation}${uniqueName} = ${source.concatTokens()}.\\n${indentation}`);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Outline APPEND source expression\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n replaceInsertExpression(high, lowFile, highSyntax) {\r\n if (!(high.get() instanceof Statements.InsertInternal)) {\r\n return undefined;\r\n }\r\n const children = high.getChildren();\r\n if (children[1].get() instanceof Expressions.Source) {\r\n const source = children[1];\r\n const target = high.findDirectExpression(Expressions.Target);\r\n if (target === undefined) {\r\n return undefined;\r\n }\r\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const firstToken = high.getFirstToken();\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${target === null || target === void 0 ? void 0 : target.concatTokens()}.\r\n${indentation}${uniqueName} = ${source.concatTokens()}.\\n${indentation}`);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, source.getFirstToken().getStart(), source.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Outline INSERT source expression\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n replaceTableExpression(low, high, lowFile, highSyntax) {\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n for (const fieldChain of high.findAllExpressionsRecursive(Expressions.FieldChain)) {\r\n const tableExpression = fieldChain.findDirectExpression(Expressions.TableExpression);\r\n if (tableExpression === undefined) {\r\n continue;\r\n }\r\n const concat = high.concatTokens().toUpperCase();\r\n if (concat.includes(\" LINE_EXISTS( \") || concat.includes(\" LINE_INDEX( \")) {\r\n // note: line_exists() must be replaced before handling table expressions\r\n continue;\r\n }\r\n let pre = \"\";\r\n let startToken = undefined;\r\n for (const child of fieldChain.getChildren()) {\r\n if (startToken === undefined) {\r\n startToken = child.getFirstToken();\r\n }\r\n else if (child === tableExpression) {\r\n break;\r\n }\r\n pre += child.concatTokens();\r\n }\r\n if (startToken === undefined) {\r\n continue;\r\n }\r\n const condition = this.tableCondition(tableExpression);\r\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const tabixBackup = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const firstToken = high.getFirstToken();\r\n // note that the tabix restore should be done before throwing the exception\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${uniqueName} LIKE LINE OF ${pre}.\r\n${indentation}DATA ${tabixBackup} LIKE sy-tabix.\r\n${indentation}${tabixBackup} = sy-tabix.\r\n${indentation}READ TABLE ${pre} ${condition}INTO ${uniqueName}.\r\n${indentation}sy-tabix = ${tabixBackup}.\r\n${indentation}IF sy-subrc <> 0.\r\n${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.\r\n${indentation}ENDIF.\r\n${indentation}`);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, startToken.getStart(), tableExpression.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Outline table expression\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n tableCondition(tableExpression) {\r\n let condition = \"\";\r\n let keyName = \"\";\r\n for (const c of tableExpression.getChildren() || []) {\r\n if (c.getFirstToken().getStr() === \"[\" || c.getFirstToken().getStr() === \"]\") {\r\n continue;\r\n }\r\n else if (c.get() instanceof Expressions.ComponentChainSimple && condition === \"\") {\r\n if (keyName === \"\") {\r\n condition = \"WITH KEY \";\r\n }\r\n else {\r\n condition = \"WITH TABLE KEY \" + keyName + \" COMPONENTS \";\r\n }\r\n }\r\n else if (c.get() instanceof Expressions.Source && condition === \"\") {\r\n condition = \"INDEX \";\r\n }\r\n else if (c instanceof nodes_1.TokenNode && c.getFirstToken().getStr().toUpperCase() === \"KEY\") {\r\n continue;\r\n }\r\n else if (c.get() instanceof Expressions.SimpleName) {\r\n keyName = c.concatTokens();\r\n continue;\r\n }\r\n condition += c.concatTokens() + \" \";\r\n }\r\n return condition;\r\n }\r\n outlineCatchSimple(node, lowFile) {\r\n // outlines \"CATCH cx_bcs INTO DATA(lx_bcs_excep).\", note that this does not need to look at types\r\n var _a, _b;\r\n if (!(node.get() instanceof Statements.Catch)) {\r\n return undefined;\r\n }\r\n const target = node.findFirstExpression(Expressions.Target);\r\n if (!(((_a = target === null || target === void 0 ? void 0 : target.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.InlineData)) {\r\n return undefined;\r\n }\r\n const classNames = node.findDirectExpressions(Expressions.ClassName);\r\n if (classNames.length !== 1) {\r\n return undefined;\r\n }\r\n const className = classNames[0].concatTokens();\r\n const targetName = (_b = target.findFirstExpression(Expressions.TargetField)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const code = ` DATA ${targetName} TYPE REF TO ${className}.\r\n${indentation}CATCH ${className} INTO ${targetName}.`;\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getStart(), node.getEnd(), code);\r\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline DATA\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n outlineDataSimple(node, lowFile) {\r\n // outlines \"DATA(ls_msg) = temp1.\", note that this does not need to look at types\r\n var _a, _b, _c;\r\n if (!(node.get() instanceof Statements.Move)) {\r\n return undefined;\r\n }\r\n const target = node.findFirstExpression(Expressions.Target);\r\n if (!(((_a = target === null || target === void 0 ? void 0 : target.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.InlineData)) {\r\n return undefined;\r\n }\r\n let type = \"\";\r\n const source = node.findFirstExpression(Expressions.Source);\r\n if (source === undefined) {\r\n return undefined;\r\n }\r\n else if (source.getChildren().length !== 1) {\r\n return undefined;\r\n }\r\n else if (!(((_b = source.getFirstChild()) === null || _b === void 0 ? void 0 : _b.get()) instanceof Expressions.FieldChain)) {\r\n return undefined;\r\n }\r\n else if (source.findFirstExpression(Expressions.FieldOffset)) {\r\n return undefined;\r\n }\r\n else if (source.findFirstExpression(Expressions.FieldLength)) {\r\n return undefined;\r\n }\r\n else if (source.findFirstExpression(Expressions.TableExpression)) {\r\n const chain = source.findDirectExpression(Expressions.FieldChain);\r\n if (chain !== undefined\r\n && chain.getChildren().length === 2\r\n && chain.getChildren()[0].get() instanceof Expressions.SourceField\r\n && chain.getChildren()[1].get() instanceof Expressions.TableExpression) {\r\n type = \"LINE OF \" + chain.getChildren()[0].concatTokens();\r\n }\r\n else {\r\n return undefined;\r\n }\r\n }\r\n else {\r\n type = source.concatTokens();\r\n }\r\n const targetName = (_c = target.findFirstExpression(Expressions.TargetField)) === null || _c === void 0 ? void 0 : _c.concatTokens();\r\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const firstToken = node.getFirstToken();\r\n const lastToken = node.getLastToken();\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, firstToken.getStart(), `DATA ${targetName} LIKE ${type}.\\n${indentation}`);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), lastToken.getEnd(), `${targetName} = ${source.concatTokens()}.`);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline DATA\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n partiallyImplemented(node, lowFile) {\r\n if (node.get() instanceof Statements.InterfaceDef) {\r\n const partially = node.findDirectTokenByText(\"PARTIALLY\");\r\n if (partially === undefined) {\r\n return undefined;\r\n }\r\n const implemented = node.findDirectTokenByText(\"IMPLEMENTED\");\r\n if (implemented === undefined) {\r\n return undefined;\r\n }\r\n const fix = edit_helper_1.EditHelper.deleteRange(lowFile, partially.getStart(), implemented.getEnd());\r\n return issue_1.Issue.atToken(lowFile, partially, \"Downport PARTIALLY IMPLEMENTED\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n raiseException(node, lowFile, highSyntax) {\r\n /*\r\n Note: IF_T100_DYN_MSG does not exist in 702, so this rule is mostly relevant for the transpiler\r\n \r\n DATA foo LIKE if_t100_message=>t100key.\r\n foo-msgid = 'ZHVAM'.\r\n foo-msgno = '001'.\r\n foo-attr1 = 'IF_T100_DYN_MSG~MSGV1'.\r\n foo-attr2 = 'IF_T100_DYN_MSG~MSGV2'.\r\n foo-attr3 = 'IF_T100_DYN_MSG~MSGV3'.\r\n foo-attr4 = 'IF_T100_DYN_MSG~MSGV4'.\r\n DATA bar TYPE REF TO zcl_hvam_exception.\r\n CREATE OBJECT bar EXPORTING textid = foo.\r\n bar->if_t100_dyn_msg~msgty = 'E'.\r\n bar->if_t100_dyn_msg~msgv1 = 'abc'.\r\n bar->if_t100_dyn_msg~msgv2 = 'abc'.\r\n bar->if_t100_dyn_msg~msgv3 = 'abc'.\r\n bar->if_t100_dyn_msg~msgv4 = 'abc'.\r\n RAISE EXCEPTION bar.\r\n */\r\n var _a, _b, _c;\r\n if (!(node.get() instanceof Statements.Raise)) {\r\n return undefined;\r\n }\r\n let id = undefined;\r\n let number = undefined;\r\n let startToken = node.findDirectTokenByText(\"ID\");\r\n if (startToken) {\r\n const sources = node.findDirectExpressions(Expressions.Source);\r\n id = sources[0].concatTokens();\r\n const numberExpression = node.findExpressionAfterToken(\"NUMBER\");\r\n if (numberExpression === undefined) {\r\n throw \"downport raiseException, could not find number\";\r\n }\r\n number = numberExpression.concatTokens();\r\n if (numberExpression.get() instanceof Expressions.MessageNumber) {\r\n number = \"'\" + number + \"'\";\r\n }\r\n }\r\n else {\r\n const s = node.findDirectExpression(Expressions.MessageSource);\r\n if (s === undefined) {\r\n return undefined;\r\n }\r\n id = \"'\" + ((_a = s.findDirectExpression(Expressions.MessageClass)) === null || _a === void 0 ? void 0 : _a.concatTokens()) + \"'\";\r\n number = \"'\" + ((_b = s.findDirectExpression(Expressions.MessageTypeAndNumber)) === null || _b === void 0 ? void 0 : _b.concatTokens().substring(1)) + \"'\";\r\n startToken = node.getFirstToken();\r\n }\r\n const className = ((_c = node.findDirectExpression(Expressions.ClassName)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || \"ERROR\";\r\n const uniqueName1 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const uniqueName2 = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const abap = `DATA ${uniqueName1} LIKE if_t100_message=>t100key.\r\n${indentation}${uniqueName1}-msgid = ${id === null || id === void 0 ? void 0 : id.toUpperCase()}.\r\n${indentation}${uniqueName1}-msgno = ${number}.\r\n${indentation}DATA ${uniqueName2} TYPE REF TO ${className}.\r\n${indentation}CREATE OBJECT ${uniqueName2} EXPORTING textid = ${uniqueName1}.\r\n${indentation}RAISE EXCEPTION ${uniqueName2}.`;\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, node.getStart(), node.getEnd(), abap);\r\n return issue_1.Issue.atToken(lowFile, startToken, \"Downport RAISE MESSAGE\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n emptyKey(low, node, lowFile) {\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n for (let i of node.findAllExpressions(Expressions.TypeTable)) {\r\n const key = i.findDirectExpression(Expressions.TypeTableKey);\r\n if (key === undefined) {\r\n continue;\r\n }\r\n i = key;\r\n const concat = i.concatTokens();\r\n if (concat.toUpperCase().includes(\"WITH EMPTY KEY\") === false) {\r\n continue;\r\n }\r\n const token = i.findDirectTokenByText(\"EMPTY\");\r\n if (token === undefined) {\r\n continue;\r\n }\r\n const fix = edit_helper_1.EditHelper.replaceToken(lowFile, token, \"DEFAULT\");\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Downport EMPTY KEY\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n callFunctionParameterSimple(high, lowFile, highSyntax) {\r\n if (!(high.get() instanceof Statements.CallFunction)) {\r\n return undefined;\r\n }\r\n let found = undefined;\r\n for (const p of high.findAllExpressions(Expressions.FunctionExportingParameter)) {\r\n found = p.findDirectExpression(Expressions.Source);\r\n if (found && (found.findDirectExpression(Expressions.FieldChain)\r\n || found.findDirectExpression(Expressions.Constant)\r\n || found.findDirectExpression(Expressions.TextElement))) {\r\n // its actually simple, ok\r\n found = undefined;\r\n }\r\n else if (found !== undefined) {\r\n break;\r\n }\r\n }\r\n if (found === undefined) {\r\n return undefined;\r\n }\r\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const code = `DATA(${uniqueName}) = ${found.concatTokens()}.\\n`;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, found.getFirstToken().getStart(), found.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, call function parameter\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n downportCorrespondingSimple(high, lowFile) {\r\n var _a;\r\n if (!(high.get() instanceof Statements.Move)\r\n || high.getChildren().length !== 4\r\n || high.getChildren()[2].getFirstToken().getStr().toUpperCase() !== \"CORRESPONDING\") {\r\n return undefined;\r\n }\r\n const target = high.findDirectExpression(Expressions.Target);\r\n if (target === undefined) {\r\n return undefined;\r\n }\r\n const sourceRef = (_a = high.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.findFirstExpression(Expressions.CorrespondingBody);\r\n if (sourceRef === undefined || sourceRef.getChildren().length !== 1) {\r\n return;\r\n }\r\n const code = `MOVE-CORRESPONDING ${sourceRef.concatTokens()} TO ${target.concatTokens()}`;\r\n const start = high.getFirstToken().getStart();\r\n const end = high.getLastToken().getStart();\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, simple CORRESPONDING move\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n downportRefSimple(high, lowFile, highSyntax) {\r\n var _a;\r\n if (!(high.get() instanceof Statements.Move)\r\n || high.getChildren().length !== 4\r\n || high.getChildren()[2].getFirstToken().getStr().toUpperCase() !== \"REF\") {\r\n return undefined;\r\n }\r\n const target = high.findDirectExpression(Expressions.Target);\r\n if (target === undefined) {\r\n return undefined;\r\n }\r\n const sourceRef = (_a = high.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Source);\r\n if (sourceRef === undefined\r\n || sourceRef.getChildren().length !== 1) {\r\n return undefined;\r\n }\r\n let code = \"\";\r\n if (sourceRef.findFirstExpression(Expressions.TableExpression)) {\r\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n code = `ASSIGN ${sourceRef.concatTokens()} TO FIELD-SYMBOL(<${uniqueName}>).\r\nIF sy-subrc <> 0.\r\n RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.\r\nENDIF.\r\nGET REFERENCE OF <${uniqueName}> INTO ${target.concatTokens()}`;\r\n }\r\n else {\r\n code = `GET REFERENCE OF ${sourceRef.concatTokens()} INTO ${target.concatTokens()}`;\r\n }\r\n const start = high.getFirstToken().getStart();\r\n const end = high.getLastToken().getStart();\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, simple REF move\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n downportLoopGroup(high, lowFile, highSyntax, highFile) {\r\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;\r\n if (!(high.get() instanceof Statements.Loop)) {\r\n return undefined;\r\n }\r\n const group = high.findDirectExpression(Expressions.LoopGroupBy);\r\n if (group === undefined) {\r\n return undefined;\r\n }\r\n const groupTargetName = ((_a = group.findFirstExpression(Expressions.TargetField)) === null || _a === void 0 ? void 0 : _a.concatTokens())\r\n || ((_b = group.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _b === void 0 ? void 0 : _b.concatTokens().replace(\"<\", \"_\").replace(\">\", \"_\"))\r\n || \"nameNotFound\";\r\n const loopSourceName = ((_c = high.findFirstExpression(Expressions.SimpleSource2)) === null || _c === void 0 ? void 0 : _c.concatTokens()) || \"nameNotFound\";\r\n const loopTargetName = ((_d = high.findFirstExpression(Expressions.TargetField)) === null || _d === void 0 ? void 0 : _d.concatTokens())\r\n || ((_e = high.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _e === void 0 ? void 0 : _e.concatTokens())\r\n || \"nameNotFound\";\r\n const groupTarget = ((_f = group.findDirectExpression(Expressions.LoopGroupByTarget)) === null || _f === void 0 ? void 0 : _f.concatTokens()) || \"\";\r\n const isReference = (_g = high.findFirstExpression(Expressions.LoopTarget)) === null || _g === void 0 ? void 0 : _g.concatTokens().toUpperCase().startsWith(\"REFERENCE INTO \");\r\n let loopSourceRowType = \"typeNotFound\";\r\n const spag = highSyntax.spaghetti.lookupPosition(high.getFirstToken().getStart(), lowFile.getFilename());\r\n if (spag !== undefined) {\r\n const found = spag.findVariable(loopSourceName);\r\n const tt = found === null || found === void 0 ? void 0 : found.getType();\r\n if (tt instanceof basic_1.TableType) {\r\n loopSourceRowType = tt.getRowType().getQualifiedName() || \"typeNotFound\";\r\n }\r\n }\r\n let code = `TYPES: BEGIN OF ${groupTargetName}type,\\n`;\r\n let condition = \"\";\r\n let groupCountName = undefined;\r\n let groupIndexName = undefined;\r\n for (const c of group.findAllExpressions(Expressions.LoopGroupByComponent)) {\r\n const name = c.findFirstExpression(Expressions.ComponentName);\r\n let type = ((_h = c.findFirstExpression(Expressions.Source)) === null || _h === void 0 ? void 0 : _h.concatTokens()) || \"todo\";\r\n if ((_j = c.concatTokens()) === null || _j === void 0 ? void 0 : _j.toUpperCase().endsWith(\" = GROUP SIZE\")) {\r\n type = \"i\";\r\n groupCountName = name === null || name === void 0 ? void 0 : name.concatTokens();\r\n }\r\n else if ((_k = c.concatTokens()) === null || _k === void 0 ? void 0 : _k.toUpperCase().endsWith(\" = GROUP INDEX\")) {\r\n type = \"i\";\r\n groupIndexName = name === null || name === void 0 ? void 0 : name.concatTokens();\r\n }\r\n else {\r\n if (condition !== \"\") {\r\n condition += \" \";\r\n }\r\n condition += c.concatTokens();\r\n type = type.replace(loopTargetName, loopSourceRowType);\r\n type = type.replace(\"->\", \"-\");\r\n }\r\n code += ` ${name === null || name === void 0 ? void 0 : name.concatTokens()} TYPE ${type},\\n`;\r\n }\r\n const s = group.findDirectExpression(Expressions.Source);\r\n let singleName = \"\";\r\n if (s) {\r\n let type = s.concatTokens();\r\n type = type.replace(loopTargetName, loopSourceRowType);\r\n type = type.replace(\"->\", \"-\");\r\n singleName = s.concatTokens().split(\"-\")[1];\r\n code += ` ${singleName} TYPE ${type},\\n`;\r\n condition = singleName + \" = \" + s.concatTokens();\r\n }\r\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const uniqueFS = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const uniqueNameIndex = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n code += ` items LIKE ${loopSourceName},\r\n END OF ${groupTargetName}type.\r\nDATA ${groupTargetName}tab TYPE STANDARD TABLE OF ${groupTargetName}type WITH DEFAULT KEY.\r\nDATA ${uniqueName} LIKE LINE OF ${groupTargetName}tab.\r\nLOOP AT ${loopSourceName} ${(_l = high.findFirstExpression(Expressions.LoopTarget)) === null || _l === void 0 ? void 0 : _l.concatTokens()}.\\n`;\r\n if (groupIndexName !== undefined) {\r\n code += `DATA(${uniqueNameIndex}) = sy-tabix.\\n`;\r\n }\r\n code += `READ TABLE ${groupTargetName}tab ASSIGNING FIELD-SYMBOL(<${uniqueFS}>) WITH KEY ${condition}.\r\nIF sy-subrc = 0.\\n`;\r\n if (groupCountName !== undefined) {\r\n code += ` <${uniqueFS}>-${groupCountName} = <${uniqueFS}>-${groupCountName} + 1.\\n`;\r\n }\r\n code += ` INSERT ${loopTargetName}${isReference ? \"->*\" : \"\"} INTO TABLE <${uniqueFS}>-items.\r\nELSE.\\n`;\r\n code += ` CLEAR ${uniqueName}.\\n`;\r\n for (const c of group.findAllExpressions(Expressions.LoopGroupByComponent)) {\r\n const concat = c.concatTokens();\r\n // console.dir(concat);\r\n if (concat.endsWith(\" GROUP INDEX\")) {\r\n code += ` ${uniqueName}-${groupIndexName} = ${uniqueNameIndex}.\\n`;\r\n }\r\n else if (concat.endsWith(\" GROUP SIZE\")) {\r\n code += ` ${uniqueName}-${groupCountName} = 1.\\n`;\r\n }\r\n else {\r\n code += ` ${uniqueName}-${concat}.\\n`;\r\n }\r\n }\r\n if (singleName !== \"\") {\r\n code += ` ${uniqueName}-${singleName} = ${loopTargetName}-${singleName}.\\n`;\r\n }\r\n code += ` INSERT ${loopTargetName}${isReference ? \"->*\" : \"\"} INTO TABLE ${uniqueName}-items.\\n`;\r\n code += ` INSERT ${uniqueName} INTO TABLE ${groupTargetName}tab.\\n`;\r\n code += `ENDIF.\r\nENDLOOP.\r\nLOOP AT ${groupTargetName}tab ${groupTarget}.`;\r\n let fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);\r\n for (const l of ((_m = highFile.getStructure()) === null || _m === void 0 ? void 0 : _m.findAllStructures(Structures.Loop)) || []) {\r\n // make sure to find the correct/current loop statement\r\n if (l.findDirectStatement(Statements.Loop) !== high) {\r\n continue;\r\n }\r\n for (const loop of l.findAllStatements(Statements.Loop)) {\r\n if ((_o = loop.concatTokens()) === null || _o === void 0 ? void 0 : _o.toUpperCase().startsWith(\"LOOP AT GROUP \")) {\r\n const subLoopSource = loop.findFirstExpression(Expressions.SimpleSource2);\r\n if (subLoopSource === undefined) {\r\n continue;\r\n }\r\n const subLoopSourceName = (subLoopSource === null || subLoopSource === void 0 ? void 0 : subLoopSource.concatTokens()) || \"nameNotFound\";\r\n const subCode = `LOOP AT ${subLoopSourceName}${isReference ? \"->\" : \"-\"}items`;\r\n const subFix = edit_helper_1.EditHelper.replaceRange(lowFile, loop.getFirstToken().getStart(), subLoopSource.getLastToken().getEnd(), subCode);\r\n fix = edit_helper_1.EditHelper.merge(subFix, fix);\r\n }\r\n }\r\n }\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, LOOP GROUP\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n downportRef(low, high, lowFile, highSyntax) {\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n let found = undefined;\r\n for (const s of high.findAllExpressionsRecursive(Expressions.Source)) {\r\n if (s.getFirstToken().getStr().toUpperCase() === \"REF\"\r\n && s.findDirectExpression(Expressions.TypeNameOrInfer)) {\r\n found = s;\r\n }\r\n }\r\n if (found === undefined) {\r\n return undefined;\r\n }\r\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const code = `DATA(${uniqueName}) = ${found.concatTokens()}.\\n`;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, found.getFirstToken().getStart(), found.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, REF\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n assignWithTable(low, high, lowFile) {\r\n var _a, _b;\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n if (!(high.get() instanceof Statements.Assign)) {\r\n return undefined;\r\n }\r\n else if (high.getChildren().length !== 5) {\r\n return undefined;\r\n }\r\n const fieldChain = (_b = (_a = high.findDirectExpression(Expressions.AssignSource)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.FieldChain);\r\n const tableExpression = fieldChain === null || fieldChain === void 0 ? void 0 : fieldChain.getLastChild();\r\n if (tableExpression === undefined\r\n || !(tableExpression.get() instanceof Expressions.TableExpression)\r\n || !(tableExpression instanceof nodes_1.ExpressionNode)) {\r\n return undefined;\r\n }\r\n let condition = \"\";\r\n if (tableExpression.getChildren().length === 3) {\r\n const index = tableExpression.findDirectExpression(Expressions.Source);\r\n if (index === undefined) {\r\n return undefined;\r\n }\r\n condition = `INDEX ${index.concatTokens()}`;\r\n }\r\n else {\r\n let concat = tableExpression.concatTokens();\r\n concat = concat.substring(2);\r\n concat = concat.substring(0, concat.length - 2);\r\n condition = `WITH KEY ${concat}`;\r\n }\r\n let pre = \"\";\r\n for (const c of fieldChain.getChildren()) {\r\n if (c === tableExpression) {\r\n break;\r\n }\r\n pre += c.concatTokens();\r\n }\r\n const fsTarget = high.findDirectExpression(Expressions.FSTarget);\r\n const code = `READ TABLE ${pre} ${condition} ASSIGNING ${fsTarget === null || fsTarget === void 0 ? void 0 : fsTarget.concatTokens()}.`;\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, ASSIGN table expr\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n moveWithSimpleValue(low, high, lowFile) {\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n if (!(high.get() instanceof Statements.Move)\r\n || high.getChildren().length !== 4) {\r\n return undefined;\r\n }\r\n const target = high.findDirectExpression(Expressions.Target);\r\n if (target === undefined) {\r\n return undefined;\r\n }\r\n const source = high.findDirectExpression(Expressions.Source);\r\n if (source === undefined) {\r\n return undefined;\r\n }\r\n const field = target.findDirectExpression(Expressions.TargetField);\r\n if (field === undefined) {\r\n return;\r\n }\r\n const valueBody = source.findDirectExpression(Expressions.ValueBody);\r\n if (valueBody === undefined) {\r\n return;\r\n }\r\n const fieldAssignments = valueBody.findDirectExpressions(Expressions.FieldAssignment);\r\n if (fieldAssignments.length === 0) {\r\n return;\r\n }\r\n else if (fieldAssignments.length !== valueBody.getChildren().length) {\r\n return;\r\n }\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n let code = `CLEAR ${target.concatTokens()}.\\n`;\r\n for (const fieldAssignment of fieldAssignments) {\r\n code += indentation + target.concatTokens() + \"-\" + fieldAssignment.concatTokens() + `.\\n`;\r\n }\r\n code = code.trimEnd();\r\n const start = high.getFirstToken().getStart();\r\n const end = high.getLastToken().getEnd();\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, simple move\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n // note, downporting ENUM does not give the correct types, but it will work in most cases?\r\n downportEnum(_low, high, lowFile, _highSyntax, highFile) {\r\n var _a, _b, _c, _d, _e;\r\n if (!(high.get() instanceof Statements.TypeEnumBegin)) {\r\n return undefined;\r\n }\r\n const enumStructure = (_a = highFile.getStructure()) === null || _a === void 0 ? void 0 : _a.findFirstStructure(Structures.TypeEnum);\r\n if (enumStructure === undefined) {\r\n return undefined;\r\n }\r\n if (enumStructure.getFirstStatement() !== high) {\r\n return undefined;\r\n }\r\n const enumName = (_b = high.findExpressionAfterToken(\"ENUM\")) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n const structureName = (_c = high.findExpressionAfterToken(\"STRUCTURE\")) === null || _c === void 0 ? void 0 : _c.concatTokens();\r\n // all ENUMS are char like?\r\n let code = `TYPES ${enumName} TYPE string.\r\nCONSTANTS: BEGIN OF ${structureName},\\n`;\r\n let count = 1;\r\n for (const e of enumStructure.findDirectStatements(Statements.TypeEnum).concat(enumStructure.findDirectStatements(Statements.Type))) {\r\n const name = (_d = e.findFirstExpression(Expressions.NamespaceSimpleName)) === null || _d === void 0 ? void 0 : _d.concatTokens();\r\n let value = (_e = e.findFirstExpression(Expressions.Value)) === null || _e === void 0 ? void 0 : _e.concatTokens();\r\n if (value === undefined) {\r\n value = \"VALUE '\" + count++ + \"'\";\r\n }\r\n code += ` ${name} TYPE ${enumName} ${value},\\n`;\r\n }\r\n code += ` END OF ${structureName}.`;\r\n const start = enumStructure.getFirstToken().getStart();\r\n const end = enumStructure.getLastToken().getEnd();\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport ENUM\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n moveWithTableTarget(low, high, lowFile, highSyntax) {\r\n var _a;\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n if (!(high.get() instanceof Statements.Move)) {\r\n return undefined;\r\n }\r\n const target = high.findDirectExpression(Expressions.Target);\r\n if (target === undefined) {\r\n return undefined;\r\n }\r\n const tableExpression = target.findDirectExpression(Expressions.TableExpression);\r\n if (tableExpression === undefined) {\r\n return undefined;\r\n }\r\n const index = tableExpression.findDirectExpression(Expressions.Source);\r\n if (index === undefined) {\r\n return undefined;\r\n }\r\n let uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n uniqueName = `<${uniqueName}>`;\r\n const tName = target.concatTokens().split(\"[\")[0];\r\n const condition = this.tableCondition(tableExpression);\r\n const tabixBackup = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n // restore tabix before exeption\r\n const code = `FIELD-SYMBOLS ${uniqueName} LIKE LINE OF ${tName}.\r\n${indentation}DATA ${tabixBackup} LIKE sy-tabix.\r\n${indentation}${tabixBackup} = sy-tabix.\r\n${indentation}READ TABLE ${tName} ${condition}ASSIGNING ${uniqueName}.\r\n${indentation}sy-tabix = ${tabixBackup}.\r\n${indentation}IF sy-subrc <> 0.\r\n${indentation} RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.\r\n${indentation}ENDIF.\r\n${indentation}${uniqueName}`;\r\n const start = target.getFirstToken().getStart();\r\n const end = (_a = tableExpression.findDirectTokenByText(\"]\")) === null || _a === void 0 ? void 0 : _a.getEnd();\r\n if (end === undefined) {\r\n return undefined;\r\n }\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport, move with table target\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n moveWithOperator(low, high, lowFile) {\r\n var _a, _b, _c;\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n else if (!(high.get() instanceof Statements.Move)) {\r\n return undefined;\r\n }\r\n const children = high.getChildren();\r\n const secondChild = children[1];\r\n if (secondChild === undefined) {\r\n return undefined;\r\n }\r\n const op = secondChild.getFirstToken();\r\n let operator = \"\";\r\n switch (op.getStr()) {\r\n case \"+\":\r\n operator = \" + \";\r\n break;\r\n case \"-\":\r\n operator = \" - \";\r\n break;\r\n case \"/=\":\r\n operator = \" / \";\r\n break;\r\n case \"*=\":\r\n operator = \" * \";\r\n break;\r\n case \"&&=\":\r\n operator = \" && \";\r\n break;\r\n default:\r\n return undefined;\r\n }\r\n const target = (_a = high.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n if (target === undefined) {\r\n return;\r\n }\r\n const sourceStart = (_c = (_b = high.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.getFirstChild()) === null || _c === void 0 ? void 0 : _c.getFirstToken().getStart();\r\n if (sourceStart === undefined) {\r\n return;\r\n }\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, op.getStart(), sourceStart, \"= \" + target + operator);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Expand operator\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n // must be very simple string templates, like \"|{ ls_line-no ALPHA = IN }|\"\r\n stringTemplateAlpha(low, high, lowFile, highSyntax) {\r\n var _a, _b, _c;\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n else if (!(high.get() instanceof Statements.Move)) {\r\n return undefined;\r\n }\r\n const topSource = high.findDirectExpression(Expressions.Source);\r\n if (topSource === undefined || topSource.getChildren().length !== 1) {\r\n return undefined;\r\n }\r\n let top = true;\r\n let child = topSource.getFirstChild();\r\n if (!(child.get() instanceof Expressions.StringTemplate)) {\r\n child = child.findFirstExpression(Expressions.StringTemplate);\r\n top = false;\r\n }\r\n if (child === undefined || !(child.get() instanceof Expressions.StringTemplate)) {\r\n return undefined;\r\n }\r\n const templateTokens = child.getChildren();\r\n if (templateTokens.length !== 3\r\n || templateTokens[0].getFirstToken().getStr() !== \"|{\"\r\n || templateTokens[2].getFirstToken().getStr() !== \"}|\") {\r\n return undefined;\r\n }\r\n const templateSource = child.findDirectExpression(Expressions.StringTemplateSource);\r\n const formatting = (_a = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.StringTemplateFormatting)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n let functionName = \"\";\r\n switch (formatting) {\r\n case \"ALPHA = IN\":\r\n functionName = \"CONVERSION_EXIT_ALPHA_INPUT\";\r\n break;\r\n case \"ALPHA = OUT\":\r\n functionName = \"CONVERSION_EXIT_ALPHA_OUTPUT\";\r\n break;\r\n default:\r\n return undefined;\r\n }\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const source = (_b = templateSource === null || templateSource === void 0 ? void 0 : templateSource.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n const topTarget = (_c = high.findDirectExpression(Expressions.Target)) === null || _c === void 0 ? void 0 : _c.concatTokens();\r\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n if (top === false) {\r\n const code = `DATA ${uniqueName} TYPE string.\r\n${indentation}CALL FUNCTION '${functionName}'\r\n${indentation} EXPORTING\r\n${indentation} input = ${source}\r\n${indentation} IMPORTING\r\n${indentation} output = ${uniqueName}.\\n`;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, child.getFirstToken().getStart(), child.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport ALPHA\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n else {\r\n const code = `CALL FUNCTION '${functionName}'\r\n${indentation} EXPORTING\r\n${indentation} input = ${source}\r\n${indentation} IMPORTING\r\n${indentation} output = ${topTarget}.`;\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), code);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Downport ALPHA\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n }\r\n outlineLoopInput(low, high, lowFile, highSyntax) {\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n else if (!(high.get() instanceof Statements.Loop)) {\r\n return undefined;\r\n }\r\n else if (high.findDirectExpression(Expressions.SimpleSource2)) {\r\n return undefined;\r\n }\r\n // the first Source must be outlined\r\n const s = high.findDirectExpression(Expressions.Source);\r\n if (s === undefined) {\r\n return undefined;\r\n }\r\n const uniqueName = this.uniqueName(high.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const code = `DATA(${uniqueName}) = ${s.concatTokens()}.\\n` +\r\n \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, s.getFirstToken().getStart(), s.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Outline LOOP input\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n outlineLoopTarget(node, lowFile, _highSyntax) {\r\n var _a, _b, _c, _d, _e, _f, _g;\r\n // also allows outlining of voided types\r\n if (!(node.get() instanceof Statements.Loop)) {\r\n return undefined;\r\n }\r\n const sourceName = (_a = node.findDirectExpression(Expressions.SimpleSource2)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n if (sourceName === undefined) {\r\n return undefined;\r\n }\r\n const concat = node.concatTokens().toUpperCase();\r\n if (concat.includes(\" REFERENCE INTO \")\r\n || concat.includes(\" GROUP BY \")\r\n || concat.startsWith(\"LOOP AT GROUP \")) {\r\n return undefined;\r\n }\r\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const dataTarget = (_c = (_b = node.findDirectExpression(Expressions.LoopTarget)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.Target)) === null || _c === void 0 ? void 0 : _c.findDirectExpression(Expressions.InlineData);\r\n if (dataTarget) {\r\n const targetName = ((_d = dataTarget.findDirectExpression(Expressions.TargetField)) === null || _d === void 0 ? void 0 : _d.concatTokens()) || \"DOWNPORT_ERROR\";\r\n const code = `DATA ${targetName} LIKE LINE OF ${sourceName}.\\n${indentation}`;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, dataTarget.getFirstToken().getStart(), dataTarget.getLastToken().getEnd(), targetName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline LOOP data target\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n const fsTarget = (_f = (_e = node.findDirectExpression(Expressions.LoopTarget)) === null || _e === void 0 ? void 0 : _e.findDirectExpression(Expressions.FSTarget)) === null || _f === void 0 ? void 0 : _f.findDirectExpression(Expressions.InlineFS);\r\n if (fsTarget) {\r\n const targetName = ((_g = fsTarget.findDirectExpression(Expressions.TargetFieldSymbol)) === null || _g === void 0 ? void 0 : _g.concatTokens()) || \"DOWNPORT_ERROR\";\r\n const code = `FIELD-SYMBOLS ${targetName} LIKE LINE OF ${sourceName}.\\n${indentation}`;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, fsTarget.getFirstToken().getStart(), fsTarget.getLastToken().getEnd(), targetName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, node.getFirstToken(), \"Outline LOOP fs target\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n outlineFor(forLoop, indentation, lowFile, highSyntax) {\r\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\r\n let body = \"\";\r\n let end = \"\";\r\n const loopSource = (_a = forLoop.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n let loopTargetFieldExpression = forLoop.findFirstExpression(Expressions.TargetField);\r\n let loopTargetFieldName = loopTargetFieldExpression === null || loopTargetFieldExpression === void 0 ? void 0 : loopTargetFieldExpression.concatTokens();\r\n const of = forLoop.findExpressionAfterToken(\"OF\");\r\n if (of !== undefined) {\r\n loopTargetFieldExpression = of;\r\n loopTargetFieldName = of === null || of === void 0 ? void 0 : of.concatTokens();\r\n }\r\n if (((_c = (_b = forLoop.findDirectExpression(Expressions.InlineLoopDefinition)) === null || _b === void 0 ? void 0 : _b.getFirstChild()) === null || _c === void 0 ? void 0 : _c.get()) instanceof Expressions.TargetFieldSymbol) {\r\n loopTargetFieldExpression = undefined;\r\n loopTargetFieldName = undefined;\r\n }\r\n if (loopTargetFieldExpression) {\r\n const start = loopTargetFieldExpression.getFirstToken().getStart();\r\n const spag = highSyntax.spaghetti.lookupPosition(start, lowFile.getFilename());\r\n if (loopTargetFieldName && spag) {\r\n if (new SpagHelper(spag).isDuplicateName(loopTargetFieldName, start)) {\r\n this.renameVariable(spag, loopTargetFieldName, start, lowFile, highSyntax);\r\n }\r\n }\r\n }\r\n let cond = ((_d = forLoop.findDirectExpression(Expressions.ComponentCond)) === null || _d === void 0 ? void 0 : _d.concatTokens()) || \"\";\r\n if (cond !== \"\") {\r\n cond = \" WHERE \" + cond;\r\n }\r\n const loop = forLoop.findDirectExpression(Expressions.InlineLoopDefinition);\r\n const indexInto = (_e = loop === null || loop === void 0 ? void 0 : loop.findExpressionAfterToken(\"INTO\")) === null || _e === void 0 ? void 0 : _e.concatTokens();\r\n if (forLoop.findDirectTokenByText(\"UNTIL\")\r\n || forLoop.findDirectTokenByText(\"WHILE\")) {\r\n const fieldDef = forLoop.findDirectExpression(Expressions.InlineFieldDefinition);\r\n const field = (_f = fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.findFirstExpression(Expressions.Field)) === null || _f === void 0 ? void 0 : _f.concatTokens();\r\n const indexBackup = this.uniqueName(forLoop.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n body += indentation + \"DATA \" + field + \" TYPE i.\\n\";\r\n const second = fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.getChildren()[2];\r\n if ((second === null || second === void 0 ? void 0 : second.get()) instanceof Expressions.Source) {\r\n body += indentation + field + \" = \" + second.concatTokens() + \".\\n\";\r\n }\r\n const not = forLoop.findDirectTokenByText(\"UNTIL\") ? \" NOT\" : \"\";\r\n const cond = forLoop.findFirstExpression(Expressions.Cond);\r\n body += indentation + `DATA ${indexBackup} LIKE sy-index.\\n`;\r\n body += indentation + `${indexBackup} = sy-index.\\n`;\r\n body += indentation + `WHILE${not} ${cond === null || cond === void 0 ? void 0 : cond.concatTokens()}.\\n`;\r\n body += indentation + ` sy-index = ${indexBackup}.\\n`;\r\n const then = forLoop.findExpressionAfterToken(\"THEN\");\r\n if (then) {\r\n end += ` ${field} = ${then.concatTokens()}.\\n`;\r\n }\r\n else {\r\n end += ` ${field} = ${field} + 1.\\n`;\r\n }\r\n end += indentation + \"ENDWHILE\";\r\n }\r\n else if (loopTargetFieldName !== undefined) {\r\n let from = (_g = forLoop.findExpressionAfterToken(\"FROM\")) === null || _g === void 0 ? void 0 : _g.concatTokens();\r\n from = from ? \" FROM \" + from : \"\";\r\n let to = (_h = forLoop.findExpressionAfterToken(\"TO\")) === null || _h === void 0 ? void 0 : _h.concatTokens();\r\n to = to ? \" TO \" + to : \"\";\r\n let gby = \"\";\r\n for (const lg of forLoop.findDirectExpressions(Expressions.LoopGroupByComponent)) {\r\n if (gby !== \"\") {\r\n gby += \" \";\r\n }\r\n gby += lg.concatTokens();\r\n }\r\n if (gby !== \"\") {\r\n gby = \" GROUP BY ( \" + gby + \" )\";\r\n }\r\n const fc = forLoop.findDirectExpression(Expressions.FieldChain);\r\n if (fc) {\r\n gby = \" GROUP BY \" + fc.concatTokens();\r\n }\r\n if (forLoop.findDirectTokenByText(\"ASCENDING\")) {\r\n gby += \" ASCENDING\";\r\n }\r\n if (forLoop.findDirectTokenByText(\"DESCENDING\")) {\r\n gby += \" DESCENDING\";\r\n }\r\n const groups = forLoop.findExpressionAfterToken(\"GROUPS\");\r\n if (groups) {\r\n const concat = groups.concatTokens();\r\n if (concat.startsWith(\"<\")) {\r\n gby += \" ASSIGNING FIELD-SYMBOL(\" + concat + \")\";\r\n }\r\n else {\r\n gby += \" INTO DATA(\" + concat + \")\";\r\n }\r\n }\r\n let inGroup = \"\";\r\n if (forLoop.concatTokens().toUpperCase().includes(\" IN GROUP \")) {\r\n inGroup = \"-items\";\r\n }\r\n let into = \"INTO DATA\";\r\n if (loopTargetFieldName.startsWith(\"<\")) {\r\n into = \"ASSIGNING FIELD-SYMBOL\";\r\n }\r\n // todo, also backup sy-index / sy-tabix here?\r\n body += indentation + `LOOP AT ${loopSource}${inGroup} ${into}(${loopTargetFieldName})${from}${to}${cond}${gby}.\\n`;\r\n if (indexInto) {\r\n body += indentation + \" DATA(\" + indexInto + \") = sy-tabix.\\n\";\r\n }\r\n end = \"ENDLOOP\";\r\n }\r\n else if (loopTargetFieldName === undefined) {\r\n // todo, also backup sy-index / sy-tabix here?\r\n const loopTargetFieldSymbol = (_j = forLoop.findFirstExpression(Expressions.TargetFieldSymbol)) === null || _j === void 0 ? void 0 : _j.concatTokens();\r\n body += indentation + `LOOP AT ${loopSource} ASSIGNING FIELD-SYMBOL(${loopTargetFieldSymbol})${cond}.\\n`;\r\n if (indexInto) {\r\n body += indentation + \" DATA(\" + indexInto + \") = sy-tabix.\\n\";\r\n }\r\n end = \"ENDLOOP\";\r\n }\r\n const l = forLoop.findDirectExpression(Expressions.Let);\r\n if (l) {\r\n body += this.outlineLet(l, indentation, highSyntax, lowFile);\r\n }\r\n return { body, end };\r\n }\r\n outlineFilter(low, high, lowFile, highSyntax) {\r\n var _a;\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n for (const i of high.findAllExpressionsRecursive(Expressions.Source)) {\r\n const firstToken = i.getFirstToken();\r\n if (firstToken.getStr().toUpperCase() !== \"FILTER\") {\r\n continue;\r\n }\r\n const filterBody = i.findDirectExpression(Expressions.FilterBody);\r\n if (filterBody === undefined) {\r\n continue;\r\n }\r\n const sourceName = (_a = filterBody.findDirectExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n if (sourceName === undefined) {\r\n continue;\r\n }\r\n let type = this.findType(i, lowFile, highSyntax);\r\n if (type === undefined) {\r\n type = \"LIKE \" + sourceName;\r\n }\r\n else {\r\n type = \"TYPE \" + type;\r\n }\r\n const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\r\n const loopName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n let body = \"\";\r\n body += `DATA ${uniqueName} ${type}.\\n`;\r\n body += `${indentation}LOOP AT ${sourceName} INTO DATA(${loopName}) ${filterBody.concatTokens().substring(sourceName.length + 1)}.\\n`;\r\n body += `${indentation} INSERT ${loopName} INTO TABLE ${uniqueName}.\\n`;\r\n body += `${indentation}ENDLOOP.\\n${indentation}`;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), body);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), i.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, firstToken, \"Downport FILTER\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n outlineSwitch(low, high, lowFile, highSyntax) {\r\n var _a, _b, _c, _d;\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n for (const i of high.findAllExpressionsRecursive(Expressions.Source)) {\r\n const firstToken = i.getFirstToken();\r\n if (firstToken.getStr().toUpperCase() !== \"SWITCH\") {\r\n continue;\r\n }\r\n let type = this.findType(i, lowFile, highSyntax);\r\n if (type === undefined) {\r\n if (high.get() instanceof Statements.Move\r\n && high.findDirectExpression(Expressions.Source) === i\r\n && ((_a = high.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.TargetField)) !== undefined) {\r\n type = \"LIKE \" + ((_b = high.findDirectExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.concatTokens());\r\n }\r\n if (type === undefined) {\r\n continue;\r\n }\r\n }\r\n else {\r\n type = \"TYPE \" + type;\r\n }\r\n const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n let body = \"\";\r\n let name = \"\";\r\n const switchBody = i.findDirectExpression(Expressions.SwitchBody);\r\n if (switchBody === undefined) {\r\n continue;\r\n }\r\n for (const l of ((_c = switchBody === null || switchBody === void 0 ? void 0 : switchBody.findDirectExpression(Expressions.Let)) === null || _c === void 0 ? void 0 : _c.findDirectExpressions(Expressions.InlineFieldDefinition)) || []) {\r\n name = l.getFirstToken().getStr();\r\n body += indentation + `DATA(${name}) = ${(_d = switchBody.findFirstExpression(Expressions.Source)) === null || _d === void 0 ? void 0 : _d.concatTokens()}.\\n`;\r\n }\r\n body += `DATA ${uniqueName} ${type}.\\n`;\r\n let firstSource = false;\r\n let inWhen = false;\r\n for (const c of switchBody.getChildren()) {\r\n if (c.get() instanceof Expressions.Source && firstSource === false) {\r\n body += indentation + `CASE ${c.concatTokens()}.`;\r\n firstSource = true;\r\n }\r\n else if (c instanceof nodes_1.TokenNode && c.concatTokens().toUpperCase() === \"THEN\") {\r\n inWhen = true;\r\n body += \".\\n\";\r\n }\r\n else if (c instanceof nodes_1.TokenNode && c.concatTokens().toUpperCase() === \"WHEN\") {\r\n inWhen = false;\r\n body += `\\n${indentation} WHEN `;\r\n }\r\n else if (c instanceof nodes_1.TokenNode && c.concatTokens().toUpperCase() === \"OR\") {\r\n body += ` OR `;\r\n }\r\n else if (c instanceof nodes_1.TokenNode && c.concatTokens().toUpperCase() === \"ELSE\") {\r\n inWhen = true;\r\n body += `\\n${indentation} WHEN OTHERS.\\n`;\r\n }\r\n else if (inWhen === false) {\r\n body += c.concatTokens();\r\n }\r\n else {\r\n body += indentation + \" \" + uniqueName + \" = \" + c.concatTokens() + \".\";\r\n }\r\n }\r\n body += \"\\n\" + indentation + \"ENDCASE.\\n\" + indentation;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), body);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), i.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, firstToken, \"Downport SWITCH\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n outlineReduce(low, high, lowFile, highSyntax) {\r\n var _a, _b;\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n for (const i of high.findAllExpressionsRecursive(Expressions.Source)) {\r\n const firstToken = i.getFirstToken();\r\n if (firstToken.getStr().toUpperCase() !== \"REDUCE\") {\r\n continue;\r\n }\r\n const type = this.findType(i, lowFile, highSyntax);\r\n if (type === undefined) {\r\n continue;\r\n }\r\n const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n let body = \"\";\r\n let name = \"\";\r\n const reduceBody = i.findDirectExpression(Expressions.ReduceBody);\r\n if (reduceBody === undefined) {\r\n continue;\r\n }\r\n const letNode = reduceBody.findDirectExpression(Expressions.Let);\r\n if (letNode) {\r\n body += this.outlineLet(letNode, indentation, highSyntax, lowFile);\r\n }\r\n let firstName = \"\";\r\n for (const init of reduceBody.findDirectExpressions(Expressions.InlineFieldDefinition)) {\r\n name = init.getFirstToken().getStr();\r\n if (firstName === \"\") {\r\n firstName = name;\r\n }\r\n const spag = highSyntax.spaghetti.lookupPosition(init.getFirstToken().getStart(), lowFile.getFilename());\r\n if (spag && new SpagHelper(spag).isDuplicateName(name, init.getFirstToken().getStart())) {\r\n this.renameVariable(spag, name, init.getFirstToken().getStart(), lowFile, highSyntax);\r\n }\r\n const s = (_a = init.findFirstExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n const t = (_b = init.findFirstExpression(Expressions.TypeName)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n if (s) {\r\n body += indentation + `DATA(${name}) = ${s}.\\n`;\r\n }\r\n else {\r\n body += indentation + `DATA ${name} TYPE ${t}.\\n`;\r\n }\r\n }\r\n let end = \"\";\r\n for (const forLoop of (reduceBody === null || reduceBody === void 0 ? void 0 : reduceBody.findDirectExpressions(Expressions.For)) || []) {\r\n const outlineFor = this.outlineFor(forLoop, indentation, lowFile, highSyntax);\r\n body += outlineFor.body;\r\n end = outlineFor.end + `.\\n` + end;\r\n }\r\n const next = reduceBody.findDirectExpression(Expressions.ReduceNext);\r\n if (next === undefined) {\r\n continue;\r\n }\r\n for (const n of next.getChildren()) {\r\n const concat = n.concatTokens();\r\n if (concat.toUpperCase() === \"NEXT\") {\r\n continue;\r\n }\r\n else if (n.get() instanceof Expressions.SimpleTarget) {\r\n body += indentation + \" \" + concat + \" \";\r\n }\r\n else if (n.get() instanceof Expressions.Source) {\r\n body += \" \" + concat + \".\\n\";\r\n }\r\n else {\r\n body += concat;\r\n }\r\n }\r\n body += indentation + end;\r\n body += indentation + `${uniqueName} = ${firstName}.\\n`;\r\n const abap = `DATA ${uniqueName} TYPE ${type}.\\n` +\r\n body +\r\n indentation;\r\n const reduceEnd = i.findDirectTokenByText(\")\");\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), reduceEnd.getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, firstToken, \"Downport REDUCE\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n outlineValue(low, high, lowFile, highSyntax) {\r\n var _a, _b, _c;\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n const allSources = high.findAllExpressionsRecursive(Expressions.Source);\r\n for (const s of allSources) {\r\n const firstToken = s.getFirstToken();\r\n if (firstToken.getStr().toUpperCase() !== \"VALUE\") {\r\n continue;\r\n }\r\n let type = this.findType(s, lowFile, highSyntax);\r\n if (type === undefined) {\r\n if (high.get() instanceof Statements.Move && high.findDirectExpression(Expressions.Source) === s) {\r\n type = \"LIKE \" + ((_a = high.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.concatTokens());\r\n }\r\n if (type === undefined) {\r\n continue;\r\n }\r\n }\r\n else {\r\n type = \"TYPE \" + type;\r\n }\r\n const valueBody = s.findDirectExpression(Expressions.ValueBody);\r\n const uniqueName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\r\n let indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n let body = \"\";\r\n const base = valueBody === null || valueBody === void 0 ? void 0 : valueBody.findExpressionAfterToken(\"BASE\");\r\n if (base) {\r\n body += indentation + uniqueName + \" = \" + base.concatTokens() + \".\\n\";\r\n }\r\n let end = \"\";\r\n let structureName = uniqueName;\r\n let added = false;\r\n let data = \"\";\r\n let previous = undefined;\r\n for (const a of (valueBody === null || valueBody === void 0 ? void 0 : valueBody.getChildren()) || []) {\r\n if (a.get() instanceof Expressions.FieldAssignment) {\r\n if (added === false) {\r\n body += data;\r\n added = true;\r\n }\r\n body += indentation + structureName + \"-\" + a.concatTokens() + \".\\n\";\r\n }\r\n else if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.For) {\r\n const outlineFor = this.outlineFor(a, indentation, lowFile, highSyntax);\r\n body += outlineFor.body;\r\n end = outlineFor.end + `.\\n` + end;\r\n indentation += \" \";\r\n }\r\n else if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.Source) {\r\n // special handling for superflous value expression\r\n if ((valueBody === null || valueBody === void 0 ? void 0 : valueBody.getChildren().length) === 1) {\r\n body += indentation + uniqueName + \" = \" + a.concatTokens() + `.\\n`;\r\n }\r\n }\r\n else if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.Let) {\r\n body += this.outlineLet(a, indentation, highSyntax, lowFile);\r\n }\r\n if (a instanceof nodes_1.ExpressionNode && a.get() instanceof Expressions.ValueBodyLine) {\r\n let skip = false;\r\n for (const b of (a === null || a === void 0 ? void 0 : a.getChildren()) || []) {\r\n if (b.concatTokens() === \"(\" && added === false) {\r\n structureName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\r\n data = indentation + `DATA ${structureName} LIKE LINE OF ${uniqueName}.\\n`;\r\n }\r\n if (b.get() instanceof Expressions.FieldAssignment) {\r\n if (added === false) {\r\n body += data;\r\n added = true;\r\n }\r\n body += indentation + structureName + \"-\" + b.concatTokens() + \".\\n\";\r\n }\r\n else if (b.get() instanceof Expressions.Source) {\r\n body += indentation + \"APPEND \" + b.concatTokens() + ` TO ${uniqueName}.\\n`;\r\n skip = true;\r\n }\r\n else if (b.get() instanceof Expressions.ValueBodyLines) {\r\n body += indentation + \"APPEND \" + b.concatTokens() + ` TO ${uniqueName}.\\n`;\r\n skip = true;\r\n }\r\n else if (b.concatTokens() === \")\") {\r\n if (added === false && (previous === null || previous === void 0 ? void 0 : previous.concatTokens()) === \"(\") {\r\n body += data;\r\n added = true;\r\n }\r\n if (skip === false) {\r\n body += indentation + `APPEND ${structureName} TO ${uniqueName}.\\n`;\r\n }\r\n }\r\n previous = b;\r\n }\r\n }\r\n }\r\n if (body === \"\" && ((_b = valueBody === null || valueBody === void 0 ? void 0 : valueBody.getLastChild()) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr().toUpperCase()) === \"OPTIONAL\") {\r\n const fieldChain = valueBody.findFirstExpression(Expressions.FieldChain);\r\n const rowName = this.uniqueName(firstToken.getStart(), lowFile.getFilename(), highSyntax);\r\n let tableExpression = undefined;\r\n let tabName = \"\";\r\n let after = \"\";\r\n for (const c of (fieldChain === null || fieldChain === void 0 ? void 0 : fieldChain.getChildren()) || []) {\r\n if (c.get() instanceof Expressions.TableExpression && c instanceof nodes_1.ExpressionNode) {\r\n tableExpression = c;\r\n }\r\n else if (tableExpression === undefined) {\r\n tabName += c.concatTokens();\r\n }\r\n else {\r\n after += c.concatTokens();\r\n }\r\n }\r\n let condition = \"\";\r\n if ((tableExpression === null || tableExpression === void 0 ? void 0 : tableExpression.getChildren().length) === 3) {\r\n condition = \"INDEX \" + ((_c = tableExpression === null || tableExpression === void 0 ? void 0 : tableExpression.findDirectExpression(Expressions.Source)) === null || _c === void 0 ? void 0 : _c.concatTokens());\r\n }\r\n else {\r\n condition = \"WITH KEY \" + (tableExpression === null || tableExpression === void 0 ? void 0 : tableExpression.concatTokens().replace(\"[ \", \"\").replace(\" ]\", \"\"));\r\n }\r\n body +=\r\n indentation + `READ TABLE ${tabName} INTO DATA(${rowName}) ${condition}.\\n` +\r\n indentation + `IF sy-subrc = 0.\\n` +\r\n indentation + ` ${uniqueName} = ${rowName}${after}.\\n` +\r\n indentation + `ENDIF.\\n`;\r\n }\r\n if (end !== \"\") {\r\n indentation = indentation.substring(2);\r\n body += indentation + end;\r\n }\r\n const abap = `DATA ${uniqueName} ${type}.\\n` +\r\n indentation + `CLEAR ${uniqueName}.\\n` + // might be called inside a loop\r\n body +\r\n indentation;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, firstToken.getStart(), s.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, firstToken, \"Downport VALUE\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n outlineLet(node, indentation, highSyntax, lowFile) {\r\n var _a;\r\n let ret = \"\";\r\n for (const f of node.findDirectExpressions(Expressions.InlineFieldDefinition)) {\r\n const c = f.getFirstChild();\r\n if (c === undefined) {\r\n continue;\r\n }\r\n const name = c.concatTokens().toLowerCase();\r\n const spag = highSyntax.spaghetti.lookupPosition(c.getFirstToken().getStart(), lowFile.getFilename());\r\n if (spag === undefined) {\r\n continue;\r\n }\r\n if (new SpagHelper(spag).isDuplicateName(name, c.getFirstToken().getStart())) {\r\n this.renameVariable(spag, name, c.getFirstToken().getStart(), lowFile, highSyntax);\r\n }\r\n const found = spag.findVariable(name);\r\n if (found === undefined) {\r\n const source = f.findFirstExpression(Expressions.Source);\r\n if (source) {\r\n ret += indentation + \"DATA(\" + name + `) = ${source.concatTokens()}.\\n`;\r\n }\r\n continue;\r\n }\r\n const type = found.getType().getQualifiedName() ? (_a = found.getType().getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toLowerCase() : found.getType().toABAP();\r\n ret += indentation + \"DATA \" + name + ` TYPE ${type}.\\n`;\r\n const source = f.findFirstExpression(Expressions.Source);\r\n if (source) {\r\n ret += indentation + name + ` = ${source.concatTokens()}.\\n`;\r\n }\r\n }\r\n return ret;\r\n }\r\n renameVariable(spag, name, pos, lowFile, highSyntax) {\r\n const newName = this.uniqueName(pos, lowFile.getFilename(), highSyntax);\r\n const fix = new SpagHelper(spag).renameVariable(name, pos, lowFile, newName);\r\n const issue = issue_1.Issue.atPosition(lowFile, pos, \"Rename before outline\", this.getMetadata().key, this.conf.severity, fix);\r\n throw new SkipToNextFile(issue);\r\n }\r\n findType(i, lowFile, highSyntax, ref = false) {\r\n var _a;\r\n const expr = i.findDirectExpression(Expressions.TypeNameOrInfer);\r\n if (expr === undefined) {\r\n return undefined;\r\n }\r\n const firstToken = expr.getFirstToken();\r\n const concat = expr.concatTokens().toLowerCase();\r\n if (concat !== \"#\") {\r\n return ref ? \"REF TO \" + concat : concat;\r\n }\r\n const spag = highSyntax.spaghetti.lookupPosition(firstToken.getStart(), lowFile.getFilename());\r\n if (spag === undefined) {\r\n return undefined;\r\n }\r\n let inferred = undefined;\r\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\r\n if (r.referenceType === _reference_1.ReferenceType.InferredType\r\n && r.resolved\r\n && r.position.getStart().equals(firstToken.getStart())\r\n && r.resolved instanceof _typed_identifier_1.TypedIdentifier) {\r\n inferred = r.resolved;\r\n break;\r\n }\r\n }\r\n if (inferred === undefined) {\r\n return undefined;\r\n }\r\n if (inferred.getType() instanceof basic_1.ObjectReferenceType) {\r\n return inferred.getType().toABAP();\r\n }\r\n else {\r\n return (_a = inferred.getType().getQualifiedName()) === null || _a === void 0 ? void 0 : _a.toLowerCase();\r\n }\r\n }\r\n outlineFS(low, high, lowFile, highSyntax) {\r\n var _a, _b;\r\n if (!(low.get() instanceof _statement_1.Unknown)\r\n || (high.get() instanceof Statements.Loop)) {\r\n return undefined;\r\n }\r\n for (const i of high.findAllExpressionsRecursive(Expressions.InlineFS)) {\r\n const nameToken = (_a = i.findDirectExpression(Expressions.TargetFieldSymbol)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\r\n if (nameToken === undefined) {\r\n continue;\r\n }\r\n const name = nameToken.getStr();\r\n let type = \"\";\r\n if (high.concatTokens().toUpperCase().startsWith(\"APPEND INITIAL LINE TO \")) {\r\n type = \"LIKE LINE OF \" + ((_b = high.findFirstExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.concatTokens());\r\n }\r\n else {\r\n const spag = highSyntax.spaghetti.lookupPosition(nameToken.getStart(), lowFile.getFilename());\r\n if (spag === undefined) {\r\n continue;\r\n }\r\n const found = spag.findVariable(name);\r\n if (found === undefined) {\r\n continue;\r\n }\r\n else if (found.getType() instanceof basic_1.VoidType) {\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Error outlining voided type\", this.getMetadata().key, this.conf.severity);\r\n }\r\n type = \"TYPE \";\r\n type += found.getType().getQualifiedName() ? found.getType().getQualifiedName().toLowerCase() : found.getType().toABAP();\r\n }\r\n const code = `FIELD-SYMBOLS ${name} ${type}.\\n` +\r\n \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), name);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Outline FIELD-SYMBOL\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n outlineData(node, lowFile, highSyntax) {\r\n // hmm, no guard here, as DATA(SDF) is valid in 702\r\n var _a, _b;\r\n for (const i of node.findAllExpressionsRecursive(Expressions.InlineData)) {\r\n const nameToken = (_a = i.findDirectExpression(Expressions.TargetField)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\r\n if (nameToken === undefined) {\r\n continue;\r\n }\r\n const name = nameToken.getStr();\r\n const spag = highSyntax.spaghetti.lookupPosition(nameToken.getStart(), lowFile.getFilename());\r\n if (spag === undefined) {\r\n continue;\r\n }\r\n const found = spag.findVariable(name);\r\n if (found === undefined) {\r\n continue;\r\n }\r\n else if (found.getType() instanceof basic_1.VoidType && found.getType().getQualifiedName() === undefined) {\r\n continue;\r\n }\r\n let type = found.getType().getQualifiedName() ? (_b = found.getType().getQualifiedName()) === null || _b === void 0 ? void 0 : _b.toLowerCase() : found.getType().toABAP();\r\n if (found.getType() instanceof basic_1.ObjectReferenceType) {\r\n type = found.getType().toABAP();\r\n }\r\n const code = `DATA ${name} TYPE ${type}.\\n` +\r\n \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), name);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Outline DATA\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n outlineCond(low, high, lowFile, highSyntax) {\r\n var _a, _b;\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n for (const i of high.findAllExpressionsRecursive(Expressions.Source)) {\r\n if (i.getFirstToken().getStr().toUpperCase() !== \"COND\") {\r\n continue;\r\n }\r\n const body = i.findDirectExpression(Expressions.CondBody);\r\n if (body === undefined) {\r\n continue;\r\n }\r\n const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n let type = this.findType(i, lowFile, highSyntax);\r\n if (type === undefined) {\r\n if (high.get() instanceof Statements.Move\r\n && high.findDirectExpression(Expressions.Source) === i\r\n && ((_a = high.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.TargetField)) !== undefined) {\r\n type = \"LIKE \" + ((_b = high.findDirectExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.concatTokens());\r\n }\r\n if (type === undefined) {\r\n continue;\r\n }\r\n }\r\n else {\r\n type = \"TYPE \" + type;\r\n }\r\n const indent = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const bodyCode = this.buildCondBody(body, uniqueName, indent, lowFile, highSyntax);\r\n const abap = `DATA ${uniqueName} ${type}.\\n` + bodyCode;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Downport COND\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n buildCondBody(body, uniqueName, indent, lowFile, highSyntax) {\r\n let code = \"\";\r\n let first = true;\r\n let addElse = true;\r\n for (const c of body.getChildren()) {\r\n if (c instanceof nodes_1.TokenNode) {\r\n switch (c.getFirstToken().getStr().toUpperCase()) {\r\n case \"WHEN\":\r\n if (first === true) {\r\n code += indent + \"IF \";\r\n first = false;\r\n }\r\n else {\r\n code += indent + \"ELSEIF \";\r\n }\r\n break;\r\n case \"THEN\":\r\n code += \".\\n\";\r\n break;\r\n case \"ELSE\":\r\n code += indent + \"ELSE.\\n\";\r\n addElse = false;\r\n break;\r\n default:\r\n throw \"buildCondBody, unexpected token\";\r\n }\r\n }\r\n else if (c.get() instanceof Expressions.Cond) {\r\n code += c.concatTokens();\r\n }\r\n else if (c.get() instanceof Expressions.Let) {\r\n code += this.outlineLet(c, indent, highSyntax, lowFile);\r\n }\r\n else if (c.get() instanceof Expressions.Source) {\r\n code += indent + \" \" + uniqueName + \" = \" + c.concatTokens() + \".\\n\";\r\n }\r\n else {\r\n throw \"buildCondBody, unexpected expression, \" + c.get().constructor.name;\r\n }\r\n }\r\n if (addElse) {\r\n // COND might be called inside a loop\r\n code += indent + \"ELSE.\\n\";\r\n code += indent + ` CLEAR ${uniqueName}.\\n`;\r\n }\r\n code += indent + \"ENDIF.\\n\";\r\n code += indent;\r\n return code;\r\n }\r\n outlineConv(low, high, lowFile, highSyntax) {\r\n var _a;\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n for (const i of high.findAllExpressionsRecursive(Expressions.Source)) {\r\n if (i.getFirstToken().getStr().toUpperCase() !== \"CONV\") {\r\n continue;\r\n }\r\n const end = i.findDirectTokenByText(\")\");\r\n if (end === undefined) {\r\n continue;\r\n }\r\n const body = (_a = i.findDirectExpression(Expressions.ConvBody)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n if (body === undefined) {\r\n continue;\r\n }\r\n const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const type = this.findType(i, lowFile, highSyntax);\r\n const indent = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const abap = `DATA ${uniqueName} TYPE ${type}.\\n` +\r\n indent + `${uniqueName} = ${body}.\\n` +\r\n indent;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), end.getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Downport CONV\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n // \"CAST\" to \"?=\"\r\n outlineCast(low, high, lowFile, highSyntax) {\r\n var _a;\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n for (const i of high.findAllExpressionsRecursive(Expressions.Cast)) {\r\n const uniqueName = this.uniqueName(i.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const type = this.findType(i, lowFile, highSyntax, true);\r\n const body = (_a = i.findDirectExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n const abap = `DATA ${uniqueName} TYPE ${type}.\\n` +\r\n \" \".repeat(high.getFirstToken().getStart().getCol() - 1) +\r\n `${uniqueName} ?= ${body}.\\n` +\r\n \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), abap);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, i.getFirstToken().getStart(), i.getLastToken().getEnd(), uniqueName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, i.getFirstToken(), \"Downport CAST\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n uniqueName(position, filename, highSyntax) {\r\n const spag = highSyntax.spaghetti.lookupPosition(position, filename);\r\n if (spag === undefined) {\r\n const name = \"temprr\" + this.counter;\r\n this.counter++;\r\n return name;\r\n }\r\n while (true) {\r\n const name = \"temp\" + this.counter;\r\n const exists = this.existsRecursive(spag, name);\r\n this.counter++;\r\n if (exists === false) {\r\n return name;\r\n }\r\n }\r\n }\r\n existsRecursive(spag, name) {\r\n const existsDirect = spag.findVariable(name);\r\n if (existsDirect) {\r\n return true;\r\n }\r\n for (const child of spag.getChildren()) {\r\n if (child.findVariable(name) || this.existsRecursive(child, name)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n replaceXsdBool(node, lowFile, highSyntax) {\r\n const spag = highSyntax.spaghetti.lookupPosition(node.getFirstToken().getStart(), lowFile.getFilename());\r\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\r\n if (r.referenceType === _reference_1.ReferenceType.BuiltinMethodReference\r\n && r.position.getName().toUpperCase() === \"XSDBOOL\") {\r\n const token = r.position.getToken();\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, token.getStart(), token.getEnd(), \"boolc\");\r\n return issue_1.Issue.atToken(lowFile, token, \"Use BOOLC\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n }\r\n return undefined;\r\n }\r\n findMethodCallExpression(node, token) {\r\n var _a;\r\n for (const m of node.findAllExpressions(Expressions.MethodCall)) {\r\n if ((_a = m.findDirectExpression(Expressions.MethodName)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStart().equals(token.getStart())) {\r\n return m;\r\n }\r\n }\r\n return undefined;\r\n }\r\n replaceMethodConditional(low, high, lowFile, highSyntax) {\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n for (const c of high.findAllExpressionsRecursive(Expressions.Compare)) {\r\n const chain = c.findDirectExpression(Expressions.MethodCallChain);\r\n if (chain === undefined) {\r\n continue;\r\n }\r\n let predicate = false;\r\n const spag = highSyntax.spaghetti.lookupPosition(high.getFirstToken().getStart(), lowFile.getFilename());\r\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\r\n if (r.referenceType === _reference_1.ReferenceType.BuiltinMethodReference &&\r\n new _builtin_1.BuiltIn().isPredicate(chain.getFirstToken().getStr().toUpperCase())) {\r\n predicate = true;\r\n break;\r\n }\r\n }\r\n const end = chain.getLastToken().getEnd();\r\n let fix = edit_helper_1.EditHelper.insertAt(lowFile, end, \" IS NOT INITIAL\");\r\n if (predicate === true) {\r\n fix = edit_helper_1.EditHelper.insertAt(lowFile, end, \" ) = abap_true\");\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, chain.getFirstToken().getStart(), \"boolc( \");\r\n fix = edit_helper_1.EditHelper.merge(fix, fix1);\r\n }\r\n return issue_1.Issue.atToken(lowFile, chain.getFirstToken(), \"Downport method conditional\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n return undefined;\r\n }\r\n getReference(node, lowFile, _highSyntax) {\r\n var _a, _b, _c;\r\n if (!(node.get() instanceof Statements.GetReference)) {\r\n return undefined;\r\n }\r\n const inline = (_a = node.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.InlineData);\r\n if (inline === undefined) {\r\n return undefined;\r\n }\r\n const targetName = (_b = inline.findDirectExpression(Expressions.TargetField)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n const sourceName = (_c = node.findDirectExpression(Expressions.Source)) === null || _c === void 0 ? void 0 : _c.concatTokens();\r\n if (targetName === undefined || sourceName === undefined) {\r\n return undefined;\r\n }\r\n const code = `DATA ${targetName} LIKE REF TO ${sourceName}.\\n`;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, inline.getFirstToken().getStart(), inline.getLastToken().getEnd(), targetName);\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, inline.getFirstToken(), \"Downport, outline DATA ref\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n replaceContains(node, lowFile, highSyntax) {\r\n const spag = highSyntax.spaghetti.lookupPosition(node.getFirstToken().getStart(), lowFile.getFilename());\r\n // only downport if its an single method call condition\r\n let found = false;\r\n for (const c of node.findAllExpressionsRecursive(Expressions.Compare)) {\r\n found = c.findDirectExpression(Expressions.MethodCallChain) !== undefined;\r\n if (found === true) {\r\n break;\r\n }\r\n }\r\n if (found === false) {\r\n return undefined;\r\n }\r\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\r\n if (r.referenceType !== _reference_1.ReferenceType.BuiltinMethodReference) {\r\n continue;\r\n }\r\n const func = r.position.getName().toUpperCase();\r\n if (func === \"CONTAINS\") {\r\n const token = r.position.getToken();\r\n const expression = this.findMethodCallExpression(node, token);\r\n if (expression === undefined) {\r\n continue;\r\n }\r\n const sList = expression.findAllExpressions(Expressions.Source).map(e => e.concatTokens());\r\n if (sList.length !== 2) {\r\n continue;\r\n }\r\n const code = sList[0] + \" CS \" + sList[1];\r\n const start = expression.getFirstToken().getStart();\r\n const end = expression.getLastToken().getEnd();\r\n const fix = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, code);\r\n return issue_1.Issue.atToken(lowFile, token, \"Downport contains()\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n }\r\n return undefined;\r\n }\r\n replaceLineFunctions(node, lowFile, highSyntax) {\r\n var _a, _b;\r\n const spag = highSyntax.spaghetti.lookupPosition(node.getFirstToken().getStart(), lowFile.getFilename());\r\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\r\n if (r.referenceType !== _reference_1.ReferenceType.BuiltinMethodReference) {\r\n continue;\r\n }\r\n const func = r.position.getName().toUpperCase();\r\n if (func === \"LINE_EXISTS\" || func === \"LINE_INDEX\") {\r\n const token = r.position.getToken();\r\n const expression = this.findMethodCallExpression(node, token);\r\n if (expression === undefined) {\r\n continue;\r\n }\r\n let condition = \"\";\r\n for (const c of ((_a = expression === null || expression === void 0 ? void 0 : expression.findFirstExpression(Expressions.TableExpression)) === null || _a === void 0 ? void 0 : _a.getChildren()) || []) {\r\n if (c.getFirstToken().getStr() === \"[\" || c.getFirstToken().getStr() === \"]\") {\r\n continue;\r\n }\r\n else if (c.get() instanceof Expressions.ComponentChainSimple && condition === \"\") {\r\n condition = \"WITH KEY \";\r\n }\r\n else if (c.get() instanceof Expressions.Source && condition === \"\") {\r\n condition = \"INDEX \";\r\n }\r\n condition += c.concatTokens() + \" \";\r\n }\r\n const tableName = (_b = expression.findFirstExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens().split(\"[\")[0];\r\n const uniqueName = this.uniqueName(node.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const indentation = \" \".repeat(node.getFirstToken().getStart().getCol() - 1);\r\n const sy = func === \"LINE_EXISTS\" ? \"sy-subrc\" : \"sy-tabix\";\r\n const code = `DATA ${uniqueName} LIKE sy-subrc.\\n` +\r\n indentation + `READ TABLE ${tableName} ${condition}TRANSPORTING NO FIELDS.\\n` +\r\n indentation + uniqueName + ` = ${sy}.\\n` +\r\n indentation;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, node.getFirstToken().getStart(), code);\r\n const start = expression.getFirstToken().getStart();\r\n const end = expression.getLastToken().getEnd();\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, start, end, uniqueName + (func === \"LINE_EXISTS\" ? \" = 0\" : \"\"));\r\n const fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n return issue_1.Issue.atToken(lowFile, token, \"Use BOOLC\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n }\r\n return undefined;\r\n }\r\n newToCreateObject(low, high, lowFile, highSyntax) {\r\n if (!(low.get() instanceof _statement_1.Unknown)) {\r\n return undefined;\r\n }\r\n const source = high.findDirectExpression(Expressions.Source);\r\n let fix = undefined;\r\n if (high.get() instanceof Statements.Move\r\n && source\r\n && source.getFirstToken().getStr().toUpperCase() === \"NEW\") {\r\n const target = high.findDirectExpression(Expressions.Target);\r\n const found = source === null || source === void 0 ? void 0 : source.findFirstExpression(Expressions.NewObject);\r\n // must be at top level of the source for quickfix to work(todo: handle more scenarios)\r\n if (target\r\n && found\r\n && source.concatTokens() === found.concatTokens()\r\n && target.findDirectExpression(Expressions.InlineData) === undefined) {\r\n const abap = this.newParameters(found, target.concatTokens(), highSyntax, lowFile);\r\n if (abap !== undefined) {\r\n fix = edit_helper_1.EditHelper.replaceRange(lowFile, high.getFirstToken().getStart(), high.getLastToken().getEnd(), abap);\r\n }\r\n }\r\n }\r\n if (fix === undefined && high.findAllExpressions(Expressions.NewObject)) {\r\n const found = high.findFirstExpression(Expressions.NewObject);\r\n if (found === undefined) {\r\n return undefined;\r\n }\r\n const name = this.uniqueName(found.getFirstToken().getStart(), lowFile.getFilename(), highSyntax);\r\n const abap = this.newParameters(found, name, highSyntax, lowFile);\r\n if (abap === undefined) {\r\n return undefined;\r\n }\r\n const type = this.findType(found, lowFile, highSyntax);\r\n const indentation = \" \".repeat(high.getFirstToken().getStart().getCol() - 1);\r\n const data = `DATA ${name} TYPE REF TO ${type}.\\n` +\r\n indentation + abap + \"\\n\" +\r\n indentation;\r\n const fix1 = edit_helper_1.EditHelper.insertAt(lowFile, high.getFirstToken().getStart(), data);\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(lowFile, found.getFirstToken().getStart(), found.getLastToken().getEnd(), name);\r\n fix = edit_helper_1.EditHelper.merge(fix2, fix1);\r\n }\r\n if (fix) {\r\n return issue_1.Issue.atToken(lowFile, high.getFirstToken(), \"Use CREATE OBJECT instead of NEW\", this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n else {\r\n return undefined;\r\n }\r\n }\r\n newParameters(found, name, highSyntax, lowFile) {\r\n var _a, _b, _c;\r\n const typeToken = (_a = found.findDirectExpression(Expressions.TypeNameOrInfer)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\r\n let extra = (typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStr()) === \"#\" ? \"\" : \" TYPE \" + (typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStr());\r\n const parameters = found.findFirstExpression(Expressions.ParameterListS);\r\n if (parameters) {\r\n extra = parameters ? extra + \" EXPORTING \" + parameters.concatTokens() : extra;\r\n }\r\n else if (typeToken) {\r\n const source = (_b = found.findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n if (source) {\r\n // find the default parameter name for the constructor\r\n const spag = highSyntax.spaghetti.lookupPosition(typeToken === null || typeToken === void 0 ? void 0 : typeToken.getStart(), lowFile.getFilename());\r\n let cdef = undefined;\r\n for (const r of (spag === null || spag === void 0 ? void 0 : spag.getData().references) || []) {\r\n if ((r.referenceType === _reference_1.ReferenceType.InferredType\r\n || r.referenceType === _reference_1.ReferenceType.ObjectOrientedReference)\r\n && r.resolved && r.position.getStart().equals(typeToken.getStart())) {\r\n cdef = r.resolved;\r\n }\r\n }\r\n if (cdef && cdef.getMethodDefinitions === undefined) {\r\n return undefined; // something wrong\r\n }\r\n const importing = (_c = cdef === null || cdef === void 0 ? void 0 : cdef.getMethodDefinitions().getByName(\"CONSTRUCTOR\")) === null || _c === void 0 ? void 0 : _c.getParameters().getDefaultImporting();\r\n if (importing) {\r\n extra += \" EXPORTING \" + importing + \" = \" + source;\r\n }\r\n else if (spag === undefined) {\r\n extra += \" SpagUndefined\";\r\n }\r\n else if (cdef === undefined) {\r\n extra += \" ClassDefinitionNotFound\";\r\n }\r\n else {\r\n extra += \" SomeError\";\r\n }\r\n }\r\n }\r\n const abap = `CREATE OBJECT ${name}${extra}.`;\r\n return abap;\r\n }\r\n}\r\nexports.Downport = Downport;\r\n//# sourceMappingURL=downport.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/downport.js?");
|
|
12186
12186
|
|
|
12187
12187
|
/***/ }),
|
|
12188
12188
|
|
|
@@ -12226,7 +12226,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12226
12226
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12227
12227
|
|
|
12228
12228
|
"use strict";
|
|
12229
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ExitOrCheck = exports.ExitOrCheckConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass ExitOrCheckConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n this.allowExit = false;\r\n this.allowCheck = false;\r\n }\r\n}\r\nexports.ExitOrCheckConf = ExitOrCheckConf;\r\nclass ExitOrCheck extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ExitOrCheckConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"exit_or_check\",\r\n title: \"Find EXIT or CHECK outside loops\",\r\n shortDescription: `Detects usages of EXIT or CHECK statements outside of loops.\nUse RETURN to leave procesing blocks instead.`,\r\n extendedInformation: `https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenleave_processing_blocks.htm\nhttps://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abapcheck_processing_blocks.htm\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#check-vs-return`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],\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 const issues = [];\r\n const stack = [];\r\n for (const statement of file.getStatements()) {\r\n const get = statement.get();\r\n if (get instanceof Statements.Loop\r\n || get instanceof Statements.While\r\n || get instanceof Statements.LoopAtScreen\r\n || get instanceof Statements.SelectLoop\r\n || get instanceof Statements.Do) {\r\n stack.push(statement);\r\n }\r\n else if (get instanceof Statements.EndLoop\r\n || get instanceof Statements.EndWhile\r\n || get instanceof Statements.EndSelect\r\n || get instanceof Statements.EndDo) {\r\n stack.pop();\r\n }\r\n else if (this.conf.allowCheck === false && get instanceof Statements.Check && stack.length === 0) {\r\n const message = \"CHECK is not allowed outside of loops\";\r\n let tokensString = statement.concatTokens();\r\n tokensString = tokensString.slice(statement.getFirstToken().getEnd().getCol());\r\n const replacement = \"IF NOT \" + tokensString + \"\\n RETURN.\\nENDIF.\";\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, statement.getFirstToken().getStart(), statement.getLastToken().getEnd(), replacement);\r\n const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n else if (this.conf.allowExit === false && get instanceof Statements.Exit && stack.length === 0) {\r\n const message = \"EXIT is not allowed outside of loops\";\r\n const fix = edit_helper_1.EditHelper.replaceToken(file, statement.getFirstToken(), \"RETURN\");\r\n const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.ExitOrCheck = ExitOrCheck;\r\n//# sourceMappingURL=exit_or_check.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/exit_or_check.js?");
|
|
12229
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ExitOrCheck = exports.ExitOrCheckConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass ExitOrCheckConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n this.allowExit = false;\r\n this.allowCheck = false;\r\n }\r\n}\r\nexports.ExitOrCheckConf = ExitOrCheckConf;\r\nclass ExitOrCheck extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ExitOrCheckConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"exit_or_check\",\r\n title: \"Find EXIT or CHECK outside loops\",\r\n shortDescription: `Detects usages of EXIT or CHECK statements outside of loops.\r\nUse RETURN to leave procesing blocks instead.`,\r\n extendedInformation: `https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenleave_processing_blocks.htm\r\nhttps://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abapcheck_processing_blocks.htm\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#check-vs-return`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],\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 const issues = [];\r\n const stack = [];\r\n for (const statement of file.getStatements()) {\r\n const get = statement.get();\r\n if (get instanceof Statements.Loop\r\n || get instanceof Statements.While\r\n || get instanceof Statements.LoopAtScreen\r\n || get instanceof Statements.SelectLoop\r\n || get instanceof Statements.Do) {\r\n stack.push(statement);\r\n }\r\n else if (get instanceof Statements.EndLoop\r\n || get instanceof Statements.EndWhile\r\n || get instanceof Statements.EndSelect\r\n || get instanceof Statements.EndDo) {\r\n stack.pop();\r\n }\r\n else if (this.conf.allowCheck === false && get instanceof Statements.Check && stack.length === 0) {\r\n const message = \"CHECK is not allowed outside of loops\";\r\n let tokensString = statement.concatTokens();\r\n tokensString = tokensString.slice(statement.getFirstToken().getEnd().getCol());\r\n const replacement = \"IF NOT \" + tokensString + \"\\n RETURN.\\nENDIF.\";\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, statement.getFirstToken().getStart(), statement.getLastToken().getEnd(), replacement);\r\n const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n else if (this.conf.allowExit === false && get instanceof Statements.Exit && stack.length === 0) {\r\n const message = \"EXIT is not allowed outside of loops\";\r\n const fix = edit_helper_1.EditHelper.replaceToken(file, statement.getFirstToken(), \"RETURN\");\r\n const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.ExitOrCheck = ExitOrCheck;\r\n//# sourceMappingURL=exit_or_check.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/exit_or_check.js?");
|
|
12230
12230
|
|
|
12231
12231
|
/***/ }),
|
|
12232
12232
|
|
|
@@ -12237,7 +12237,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12237
12237
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12238
12238
|
|
|
12239
12239
|
"use strict";
|
|
12240
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Exporting = exports.ExportingConf = void 0;\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_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 expressions_1 = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass ExportingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.ExportingConf = ExportingConf;\r\nclass Exporting extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ExportingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"exporting\",\r\n title: \"EXPORTING can be omitted\",\r\n shortDescription: `Detects EXPORTING statements which can be omitted.`,\r\n badExample: `call_method( EXPORTING foo = bar ).`,\r\n goodExample: `call_method( foo = bar ).`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#omit-the-optional-keyword-exporting\nhttps://docs.abapopenchecks.org/checks/30/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getMessage() {\r\n return \"The EXPORTING keyword can be omitted\";\r\n }\r\n runParsed(file, obj) {\r\n let issues = [];\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n for (const statement of file.getStatements()) {\r\n const expressions = statement.findAllExpressionsMulti([expressions_1.MethodCallBody, expressions_1.MethodCall]);\r\n for (const b of expressions) {\r\n if (b.get() instanceof expressions_1.MethodCallBody) {\r\n if (b.getFirstToken().getStr() !== \"(\") {\r\n continue;\r\n }\r\n issues = issues.concat(this.check(b, file));\r\n }\r\n else if (b.get() instanceof expressions_1.MethodCall) {\r\n issues = issues.concat(this.check(b, file));\r\n }\r\n }\r\n }\r\n return issues;\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 check(node, file) {\r\n const e = node.findFirstExpression(expressions_1.MethodParameters);\r\n if (e === undefined) {\r\n return [];\r\n }\r\n if (e.getFirstToken().getStr().toUpperCase() !== \"EXPORTING\") {\r\n return [];\r\n }\r\n const tokens = e.getDirectTokens();\r\n const strings = tokens.map(t => t.getStr().toUpperCase());\r\n if (strings[0] === \"EXPORTING\"\r\n && strings.includes(\"IMPORTING\") === false\r\n && strings.includes(\"RECEIVING\") === false\r\n && strings.includes(\"EXCEPTIONS\") === false\r\n && strings.includes(\"CHANGING\") === false) {\r\n const next = e.getAllTokens()[1];\r\n const fix = edit_helper_1.EditHelper.deleteRange(file, tokens[0].getStart(), next.getStart());\r\n const issue = issue_1.Issue.atToken(file, tokens[0], this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n return [issue];\r\n }\r\n return [];\r\n }\r\n}\r\nexports.Exporting = Exporting;\r\n//# sourceMappingURL=exporting.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/exporting.js?");
|
|
12240
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Exporting = exports.ExportingConf = void 0;\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_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 expressions_1 = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass ExportingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.ExportingConf = ExportingConf;\r\nclass Exporting extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ExportingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"exporting\",\r\n title: \"EXPORTING can be omitted\",\r\n shortDescription: `Detects EXPORTING statements which can be omitted.`,\r\n badExample: `call_method( EXPORTING foo = bar ).`,\r\n goodExample: `call_method( foo = bar ).`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#omit-the-optional-keyword-exporting\r\nhttps://docs.abapopenchecks.org/checks/30/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getMessage() {\r\n return \"The EXPORTING keyword can be omitted\";\r\n }\r\n runParsed(file, obj) {\r\n let issues = [];\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n for (const statement of file.getStatements()) {\r\n const expressions = statement.findAllExpressionsMulti([expressions_1.MethodCallBody, expressions_1.MethodCall]);\r\n for (const b of expressions) {\r\n if (b.get() instanceof expressions_1.MethodCallBody) {\r\n if (b.getFirstToken().getStr() !== \"(\") {\r\n continue;\r\n }\r\n issues = issues.concat(this.check(b, file));\r\n }\r\n else if (b.get() instanceof expressions_1.MethodCall) {\r\n issues = issues.concat(this.check(b, file));\r\n }\r\n }\r\n }\r\n return issues;\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 check(node, file) {\r\n const e = node.findFirstExpression(expressions_1.MethodParameters);\r\n if (e === undefined) {\r\n return [];\r\n }\r\n if (e.getFirstToken().getStr().toUpperCase() !== \"EXPORTING\") {\r\n return [];\r\n }\r\n const tokens = e.getDirectTokens();\r\n const strings = tokens.map(t => t.getStr().toUpperCase());\r\n if (strings[0] === \"EXPORTING\"\r\n && strings.includes(\"IMPORTING\") === false\r\n && strings.includes(\"RECEIVING\") === false\r\n && strings.includes(\"EXCEPTIONS\") === false\r\n && strings.includes(\"CHANGING\") === false) {\r\n const next = e.getAllTokens()[1];\r\n const fix = edit_helper_1.EditHelper.deleteRange(file, tokens[0].getStart(), next.getStart());\r\n const issue = issue_1.Issue.atToken(file, tokens[0], this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n return [issue];\r\n }\r\n return [];\r\n }\r\n}\r\nexports.Exporting = Exporting;\r\n//# sourceMappingURL=exporting.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/exporting.js?");
|
|
12241
12241
|
|
|
12242
12242
|
/***/ }),
|
|
12243
12243
|
|
|
@@ -12248,7 +12248,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12248
12248
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12249
12249
|
|
|
12250
12250
|
"use strict";
|
|
12251
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ForbiddenIdentifier = exports.ForbiddenIdentifierConf = void 0;\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 issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass ForbiddenIdentifierConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** List of forbideen identifiers, array of string regex\r\n * @uniqueItems true\r\n */\r\n this.check = [];\r\n }\r\n}\r\nexports.ForbiddenIdentifierConf = ForbiddenIdentifierConf;\r\nclass ForbiddenIdentifier extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ForbiddenIdentifierConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"forbidden_identifier\",\r\n title: \"Forbidden Identifier\",\r\n shortDescription: `Forbid use of specified identifiers, list of regex.`,\r\n extendedInformation: `Used in the transpiler to find javascript keywords in ABAP identifiers,\nhttps://github.com/abaplint/transpiler/blob/bda94b8b56e2b7f2f87be2168f12361aa530220e/packages/transpiler/src/validation.ts#L44`,\r\n tags: [_irule_1.RuleTag.SingleFile],\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 if (this.conf.check === undefined) {\r\n this.conf.check = [];\r\n }\r\n }\r\n runParsed(file) {\r\n if (this.conf.check.length === 0) {\r\n return [];\r\n }\r\n let ret = [];\r\n for (const s of file.getStatements()) {\r\n ret = ret.concat(this.traverse(s, file));\r\n }\r\n return ret;\r\n }\r\n traverse(node, file) {\r\n let ret = [];\r\n for (const c of node.getChildren()) {\r\n if (c instanceof nodes_1.TokenNodeRegex) {\r\n ret = ret.concat(this.check(c.get(), file));\r\n }\r\n else if (c instanceof nodes_1.TokenNode) {\r\n continue;\r\n }\r\n else {\r\n ret = ret.concat(this.traverse(c, file));\r\n }\r\n }\r\n return ret;\r\n }\r\n check(token, file) {\r\n const str = token.getStr();\r\n const ret = [];\r\n for (const c of this.conf.check) {\r\n const reg = new RegExp(c, \"i\");\r\n if (reg.exec(str)) {\r\n const message = \"Identifer \\\"\" + str + \"\\\" not allowed\";\r\n ret.push(issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.ForbiddenIdentifier = ForbiddenIdentifier;\r\n//# sourceMappingURL=forbidden_identifier.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/forbidden_identifier.js?");
|
|
12251
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ForbiddenIdentifier = exports.ForbiddenIdentifierConf = void 0;\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 issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass ForbiddenIdentifierConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** List of forbideen identifiers, array of string regex\r\n * @uniqueItems true\r\n */\r\n this.check = [];\r\n }\r\n}\r\nexports.ForbiddenIdentifierConf = ForbiddenIdentifierConf;\r\nclass ForbiddenIdentifier extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ForbiddenIdentifierConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"forbidden_identifier\",\r\n title: \"Forbidden Identifier\",\r\n shortDescription: `Forbid use of specified identifiers, list of regex.`,\r\n extendedInformation: `Used in the transpiler to find javascript keywords in ABAP identifiers,\r\nhttps://github.com/abaplint/transpiler/blob/bda94b8b56e2b7f2f87be2168f12361aa530220e/packages/transpiler/src/validation.ts#L44`,\r\n tags: [_irule_1.RuleTag.SingleFile],\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 if (this.conf.check === undefined) {\r\n this.conf.check = [];\r\n }\r\n }\r\n runParsed(file) {\r\n if (this.conf.check.length === 0) {\r\n return [];\r\n }\r\n let ret = [];\r\n for (const s of file.getStatements()) {\r\n ret = ret.concat(this.traverse(s, file));\r\n }\r\n return ret;\r\n }\r\n traverse(node, file) {\r\n let ret = [];\r\n for (const c of node.getChildren()) {\r\n if (c instanceof nodes_1.TokenNodeRegex) {\r\n ret = ret.concat(this.check(c.get(), file));\r\n }\r\n else if (c instanceof nodes_1.TokenNode) {\r\n continue;\r\n }\r\n else {\r\n ret = ret.concat(this.traverse(c, file));\r\n }\r\n }\r\n return ret;\r\n }\r\n check(token, file) {\r\n const str = token.getStr();\r\n const ret = [];\r\n for (const c of this.conf.check) {\r\n const reg = new RegExp(c, \"i\");\r\n if (reg.exec(str)) {\r\n const message = \"Identifer \\\"\" + str + \"\\\" not allowed\";\r\n ret.push(issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.ForbiddenIdentifier = ForbiddenIdentifier;\r\n//# sourceMappingURL=forbidden_identifier.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/forbidden_identifier.js?");
|
|
12252
12252
|
|
|
12253
12253
|
/***/ }),
|
|
12254
12254
|
|
|
@@ -12270,7 +12270,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12270
12270
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12271
12271
|
|
|
12272
12272
|
"use strict";
|
|
12273
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ForbiddenVoidType = exports.ForbiddenVoidTypeConf = void 0;\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 _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 void_type_1 = __webpack_require__(/*! ../abap/types/basic/void_type */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/void_type.js\");\r\nconst _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\r\nconst basic_1 = __webpack_require__(/*! ../abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nclass ForbiddenVoidTypeConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** List of forbidden void types, array of string regex, case in-sensitive\r\n * @uniqueItems true\r\n */\r\n this.check = [];\r\n }\r\n}\r\nexports.ForbiddenVoidTypeConf = ForbiddenVoidTypeConf;\r\nclass ForbiddenVoidType {\r\n constructor() {\r\n this.conf = new ForbiddenVoidTypeConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"forbidden_void_type\",\r\n title: \"Forbidden Void Types\",\r\n shortDescription: `Avoid usage of specified void types.`,\r\n extendedInformation: `Inspiration:\nBOOLEAN, BOOLE_D, CHAR01, CHAR1, CHAR10, CHAR12, CHAR128, CHAR2, CHAR20, CHAR4, CHAR70,\nDATS, TIMS, DATUM, FLAG, INT4, NUMC3, NUMC4, SAP_BOOL, TEXT25, TEXT80, X255, XFELD`,\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 if (this.conf.check === undefined) {\r\n this.conf.check = [];\r\n }\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof _abap_object_1.ABAPObject) || this.conf.check.length === 0) {\r\n return [];\r\n }\r\n return this.traverse(new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti.getTop());\r\n }\r\n ///////////////\r\n traverse(node) {\r\n var _a, _b, _c;\r\n let ret = [];\r\n const message = \"Forbidden void type: \";\r\n if (node.getIdentifier().stype !== _scope_type_1.ScopeType.BuiltIn) {\r\n for (const r of node.getData().references) {\r\n if (r.referenceType === _reference_1.ReferenceType.ObjectOrientedVoidReference\r\n && ((_a = r.extra) === null || _a === void 0 ? void 0 : _a.ooName) !== undefined\r\n && this.isForbiddenName((_b = r.extra) === null || _b === void 0 ? void 0 : _b.ooName)) {\r\n ret.push(issue_1.Issue.atIdentifier(r.position, message + ((_c = r.extra) === null || _c === void 0 ? void 0 : _c.ooName), this.getMetadata().key, this.conf.severity));\r\n }\r\n if ((r.referenceType === _reference_1.ReferenceType.VoidType\r\n || r.referenceType === _reference_1.ReferenceType.TableVoidReference)\r\n && this.isForbiddenName(r.position.getName())) {\r\n ret.push(issue_1.Issue.atIdentifier(r.position, message + r.position.getName(), this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n }\r\n for (const c of node.getChildren()) {\r\n ret = ret.concat(this.traverse(c));\r\n }\r\n return ret;\r\n }\r\n isForbiddenType(type) {\r\n if (type instanceof basic_1.StructureType) {\r\n return type.getComponents().some(c => this.isForbiddenType(c.type));\r\n }\r\n else if (!(type instanceof void_type_1.VoidType)) {\r\n return false;\r\n }\r\n const name = type.getVoided();\r\n return this.isForbiddenName(name);\r\n }\r\n isForbiddenName(name) {\r\n if (name === undefined) {\r\n return false;\r\n }\r\n for (const c of this.conf.check) {\r\n const reg = new RegExp(c, \"i\");\r\n const match = reg.test(name);\r\n if (match === true) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\nexports.ForbiddenVoidType = ForbiddenVoidType;\r\n//# sourceMappingURL=forbidden_void_type.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/forbidden_void_type.js?");
|
|
12273
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ForbiddenVoidType = exports.ForbiddenVoidTypeConf = void 0;\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 _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 void_type_1 = __webpack_require__(/*! ../abap/types/basic/void_type */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/void_type.js\");\r\nconst _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\r\nconst basic_1 = __webpack_require__(/*! ../abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nclass ForbiddenVoidTypeConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** List of forbidden void types, array of string regex, case in-sensitive\r\n * @uniqueItems true\r\n */\r\n this.check = [];\r\n }\r\n}\r\nexports.ForbiddenVoidTypeConf = ForbiddenVoidTypeConf;\r\nclass ForbiddenVoidType {\r\n constructor() {\r\n this.conf = new ForbiddenVoidTypeConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"forbidden_void_type\",\r\n title: \"Forbidden Void Types\",\r\n shortDescription: `Avoid usage of specified void types.`,\r\n extendedInformation: `Inspiration:\r\nBOOLEAN, BOOLE_D, CHAR01, CHAR1, CHAR10, CHAR12, CHAR128, CHAR2, CHAR20, CHAR4, CHAR70,\r\nDATS, TIMS, DATUM, FLAG, INT4, NUMC3, NUMC4, SAP_BOOL, TEXT25, TEXT80, X255, XFELD`,\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 if (this.conf.check === undefined) {\r\n this.conf.check = [];\r\n }\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof _abap_object_1.ABAPObject) || this.conf.check.length === 0) {\r\n return [];\r\n }\r\n return this.traverse(new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti.getTop());\r\n }\r\n ///////////////\r\n traverse(node) {\r\n var _a, _b, _c;\r\n let ret = [];\r\n const message = \"Forbidden void type: \";\r\n if (node.getIdentifier().stype !== _scope_type_1.ScopeType.BuiltIn) {\r\n for (const r of node.getData().references) {\r\n if (r.referenceType === _reference_1.ReferenceType.ObjectOrientedVoidReference\r\n && ((_a = r.extra) === null || _a === void 0 ? void 0 : _a.ooName) !== undefined\r\n && this.isForbiddenName((_b = r.extra) === null || _b === void 0 ? void 0 : _b.ooName)) {\r\n ret.push(issue_1.Issue.atIdentifier(r.position, message + ((_c = r.extra) === null || _c === void 0 ? void 0 : _c.ooName), this.getMetadata().key, this.conf.severity));\r\n }\r\n if ((r.referenceType === _reference_1.ReferenceType.VoidType\r\n || r.referenceType === _reference_1.ReferenceType.TableVoidReference)\r\n && this.isForbiddenName(r.position.getName())) {\r\n ret.push(issue_1.Issue.atIdentifier(r.position, message + r.position.getName(), this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n }\r\n for (const c of node.getChildren()) {\r\n ret = ret.concat(this.traverse(c));\r\n }\r\n return ret;\r\n }\r\n isForbiddenType(type) {\r\n if (type instanceof basic_1.StructureType) {\r\n return type.getComponents().some(c => this.isForbiddenType(c.type));\r\n }\r\n else if (!(type instanceof void_type_1.VoidType)) {\r\n return false;\r\n }\r\n const name = type.getVoided();\r\n return this.isForbiddenName(name);\r\n }\r\n isForbiddenName(name) {\r\n if (name === undefined) {\r\n return false;\r\n }\r\n for (const c of this.conf.check) {\r\n const reg = new RegExp(c, \"i\");\r\n const match = reg.test(name);\r\n if (match === true) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\nexports.ForbiddenVoidType = ForbiddenVoidType;\r\n//# sourceMappingURL=forbidden_void_type.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/forbidden_void_type.js?");
|
|
12274
12274
|
|
|
12275
12275
|
/***/ }),
|
|
12276
12276
|
|
|
@@ -12314,7 +12314,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12314
12314
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12315
12315
|
|
|
12316
12316
|
"use strict";
|
|
12317
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FunctionalWriting = exports.FunctionalWritingConf = void 0;\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 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 _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass FunctionalWritingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Ignore functional writing in exception classes, local + global */\r\n this.ignoreExceptions = true;\r\n }\r\n}\r\nexports.FunctionalWritingConf = FunctionalWritingConf;\r\nclass FunctionalWriting extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new FunctionalWritingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"functional_writing\",\r\n title: \"Use functional writing\",\r\n shortDescription: `Detects usage of call method when functional style calls can be used.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-functional-to-procedural-calls\nhttps://docs.abapopenchecks.org/checks/07/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n badExample: `CALL METHOD zcl_class=>method( ).\nCALL METHOD cl_abap_typedescr=>describe_by_name\n EXPORTING\n p_name = 'NAME'\n RECEIVING\n p_descr_ref = lr_typedescr\n EXCEPTIONS\n type_not_found = 1\n OTHERS = 2.`,\r\n goodExample: `zcl_class=>method( ).\ncl_abap_typedescr=>describe_by_name(\n EXPORTING\n p_name = 'NAME'\n RECEIVING\n p_descr_ref = lr_typedescr\n EXCEPTIONS\n type_not_found = 1\n OTHERS = 2 ).`,\r\n };\r\n }\r\n getMessage() {\r\n return \"Use functional writing style for method calls\";\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, obj) {\r\n var _a, _b;\r\n const issues = [];\r\n let exception = false;\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n let definition = undefined;\r\n if (obj instanceof objects_1.Class) {\r\n definition = obj.getClassDefinition();\r\n }\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n for (const statNode of file.getStatements()) {\r\n if (statNode.get() instanceof Statements.ClassImplementation\r\n && definition\r\n && ddic.isException(definition, obj)\r\n && this.conf.ignoreExceptions) {\r\n exception = true;\r\n }\r\n else if (statNode.get() instanceof Statements.EndClass) {\r\n exception = false;\r\n }\r\n else if (exception === false && statNode.get() instanceof Statements.Call) {\r\n if (((_a = statNode.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.MethodCallChain) {\r\n continue;\r\n }\r\n const dynamic = (_b = statNode.findDirectExpression(Expressions.MethodSource)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.Dynamic);\r\n if (dynamic !== undefined) {\r\n continue;\r\n }\r\n issues.push(this.createIssueForStatementNode(file, statNode));\r\n }\r\n }\r\n return issues;\r\n }\r\n createIssueForStatementNode(file, statNode) {\r\n const fixString = this.buildFixString(statNode);\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, statNode.getStart(), statNode.getEnd(), fixString);\r\n return issue_1.Issue.atStatement(file, statNode, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n buildFixString(statNode) {\r\n // Note: line breaks from source are lost\r\n const methodSource = statNode.findDirectExpression(Expressions.MethodSource);\r\n let methodSourceStr = methodSource === null || methodSource === void 0 ? void 0 : methodSource.concatTokens();\r\n const methodBody = statNode.findDirectExpression(Expressions.MethodCallBody);\r\n let methodBodyStr = \"\";\r\n if (methodBody) {\r\n const methodCallParam = methodBody.findDirectExpression(Expressions.MethodCallParam);\r\n if (methodCallParam && methodCallParam.getFirstToken().getStr() === \"(\") {\r\n // has parameters and parantheses\r\n methodBodyStr = `${methodBody.concatTokens()}.`;\r\n }\r\n else {\r\n // has parameters, but parentheses are missing\r\n methodSourceStr = `${methodSourceStr}( `;\r\n methodBodyStr = `${methodBody.concatTokens()} ).`;\r\n }\r\n }\r\n else {\r\n // no body means no parentheses and no parameters\r\n methodBodyStr = \"( ).\";\r\n }\r\n return methodSourceStr + methodBodyStr;\r\n }\r\n}\r\nexports.FunctionalWriting = FunctionalWriting;\r\n//# sourceMappingURL=functional_writing.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/functional_writing.js?");
|
|
12317
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FunctionalWriting = exports.FunctionalWritingConf = void 0;\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 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 _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass FunctionalWritingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Ignore functional writing in exception classes, local + global */\r\n this.ignoreExceptions = true;\r\n }\r\n}\r\nexports.FunctionalWritingConf = FunctionalWritingConf;\r\nclass FunctionalWriting extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new FunctionalWritingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"functional_writing\",\r\n title: \"Use functional writing\",\r\n shortDescription: `Detects usage of call method when functional style calls can be used.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-functional-to-procedural-calls\r\nhttps://docs.abapopenchecks.org/checks/07/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n badExample: `CALL METHOD zcl_class=>method( ).\r\nCALL METHOD cl_abap_typedescr=>describe_by_name\r\n EXPORTING\r\n p_name = 'NAME'\r\n RECEIVING\r\n p_descr_ref = lr_typedescr\r\n EXCEPTIONS\r\n type_not_found = 1\r\n OTHERS = 2.`,\r\n goodExample: `zcl_class=>method( ).\r\ncl_abap_typedescr=>describe_by_name(\r\n EXPORTING\r\n p_name = 'NAME'\r\n RECEIVING\r\n p_descr_ref = lr_typedescr\r\n EXCEPTIONS\r\n type_not_found = 1\r\n OTHERS = 2 ).`,\r\n };\r\n }\r\n getMessage() {\r\n return \"Use functional writing style for method calls\";\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, obj) {\r\n var _a, _b;\r\n const issues = [];\r\n let exception = false;\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n let definition = undefined;\r\n if (obj instanceof objects_1.Class) {\r\n definition = obj.getClassDefinition();\r\n }\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n for (const statNode of file.getStatements()) {\r\n if (statNode.get() instanceof Statements.ClassImplementation\r\n && definition\r\n && ddic.isException(definition, obj)\r\n && this.conf.ignoreExceptions) {\r\n exception = true;\r\n }\r\n else if (statNode.get() instanceof Statements.EndClass) {\r\n exception = false;\r\n }\r\n else if (exception === false && statNode.get() instanceof Statements.Call) {\r\n if (((_a = statNode.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.MethodCallChain) {\r\n continue;\r\n }\r\n const dynamic = (_b = statNode.findDirectExpression(Expressions.MethodSource)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.Dynamic);\r\n if (dynamic !== undefined) {\r\n continue;\r\n }\r\n issues.push(this.createIssueForStatementNode(file, statNode));\r\n }\r\n }\r\n return issues;\r\n }\r\n createIssueForStatementNode(file, statNode) {\r\n const fixString = this.buildFixString(statNode);\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, statNode.getStart(), statNode.getEnd(), fixString);\r\n return issue_1.Issue.atStatement(file, statNode, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n }\r\n buildFixString(statNode) {\r\n // Note: line breaks from source are lost\r\n const methodSource = statNode.findDirectExpression(Expressions.MethodSource);\r\n let methodSourceStr = methodSource === null || methodSource === void 0 ? void 0 : methodSource.concatTokens();\r\n const methodBody = statNode.findDirectExpression(Expressions.MethodCallBody);\r\n let methodBodyStr = \"\";\r\n if (methodBody) {\r\n const methodCallParam = methodBody.findDirectExpression(Expressions.MethodCallParam);\r\n if (methodCallParam && methodCallParam.getFirstToken().getStr() === \"(\") {\r\n // has parameters and parantheses\r\n methodBodyStr = `${methodBody.concatTokens()}.`;\r\n }\r\n else {\r\n // has parameters, but parentheses are missing\r\n methodSourceStr = `${methodSourceStr}( `;\r\n methodBodyStr = `${methodBody.concatTokens()} ).`;\r\n }\r\n }\r\n else {\r\n // no body means no parentheses and no parameters\r\n methodBodyStr = \"( ).\";\r\n }\r\n return methodSourceStr + methodBodyStr;\r\n }\r\n}\r\nexports.FunctionalWriting = FunctionalWriting;\r\n//# sourceMappingURL=functional_writing.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/functional_writing.js?");
|
|
12318
12318
|
|
|
12319
12319
|
/***/ }),
|
|
12320
12320
|
|
|
@@ -12325,7 +12325,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12325
12325
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12326
12326
|
|
|
12327
12327
|
"use strict";
|
|
12328
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.GlobalClass = exports.GlobalClassConf = void 0;\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 Objects = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass GlobalClassConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.GlobalClassConf = GlobalClassConf;\r\nclass GlobalClass extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new GlobalClassConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"global_class\",\r\n title: \"Global class checks\",\r\n shortDescription: `Checks related to global classes`,\r\n extendedInformation: `* global classes must be in own files\n\n* file names must match class name\n\n* file names must match interface name\n\n* global classes must be global definitions\n\n* global interfaces must be global definitions`,\r\n tags: [_irule_1.RuleTag.Syntax],\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, obj) {\r\n const output = [];\r\n for (const definition of file.getInfo().listClassDefinitions()) {\r\n if (definition.isLocal && obj instanceof Objects.Class && file.getFilename().match(/\\.clas\\.abap$/)) {\r\n const issue = issue_1.Issue.atIdentifier(definition.identifier, \"Global classes must be global\", this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n if (definition.isGlobal && obj instanceof Objects.Class && definition.name.toUpperCase() !== obj.getName().toUpperCase()) {\r\n const issue = issue_1.Issue.atIdentifier(definition.identifier, \"Class definition name must match filename\", this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n if (definition.isGlobal && !(obj instanceof Objects.Class)) {\r\n const issue = issue_1.Issue.atIdentifier(definition.identifier, \"Class must be local\", this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n }\r\n for (const impl of file.getInfo().listClassImplementations()) {\r\n if (file.getFilename().match(/\\.clas\\.abap$/)\r\n && obj instanceof Objects.Class\r\n && impl.identifier.getName().toUpperCase() !== obj.getName().toUpperCase()) {\r\n const issue = issue_1.Issue.atIdentifier(impl.identifier, \"Class implementation name must match filename\", this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n }\r\n for (const impl of file.getInfo().listInterfaceDefinitions()) {\r\n if (file.getFilename().match(/\\.intf\\.abap$/)\r\n && obj instanceof Objects.Interface\r\n && impl.identifier.getName().toUpperCase() !== obj.getName().toUpperCase()) {\r\n const issue = issue_1.Issue.atIdentifier(impl.identifier, \"Interface implementation name must match filename\", this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n }\r\n for (const intf of file.getInfo().listInterfaceDefinitions()) {\r\n if (intf.isLocal && obj instanceof Objects.Interface && file.getFilename().match(/\\.intf\\.abap$/)) {\r\n const issue = issue_1.Issue.atIdentifier(intf.identifier, \"Global interface must be global\", this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n }\r\n return output;\r\n }\r\n}\r\nexports.GlobalClass = GlobalClass;\r\n//# sourceMappingURL=global_class.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/global_class.js?");
|
|
12328
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.GlobalClass = exports.GlobalClassConf = void 0;\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 Objects = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass GlobalClassConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.GlobalClassConf = GlobalClassConf;\r\nclass GlobalClass extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new GlobalClassConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"global_class\",\r\n title: \"Global class checks\",\r\n shortDescription: `Checks related to global classes`,\r\n extendedInformation: `* global classes must be in own files\r\n\r\n* file names must match class name\r\n\r\n* file names must match interface name\r\n\r\n* global classes must be global definitions\r\n\r\n* global interfaces must be global definitions`,\r\n tags: [_irule_1.RuleTag.Syntax],\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, obj) {\r\n const output = [];\r\n for (const definition of file.getInfo().listClassDefinitions()) {\r\n if (definition.isLocal && obj instanceof Objects.Class && file.getFilename().match(/\\.clas\\.abap$/)) {\r\n const issue = issue_1.Issue.atIdentifier(definition.identifier, \"Global classes must be global\", this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n if (definition.isGlobal && obj instanceof Objects.Class && definition.name.toUpperCase() !== obj.getName().toUpperCase()) {\r\n const issue = issue_1.Issue.atIdentifier(definition.identifier, \"Class definition name must match filename\", this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n if (definition.isGlobal && !(obj instanceof Objects.Class)) {\r\n const issue = issue_1.Issue.atIdentifier(definition.identifier, \"Class must be local\", this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n }\r\n for (const impl of file.getInfo().listClassImplementations()) {\r\n if (file.getFilename().match(/\\.clas\\.abap$/)\r\n && obj instanceof Objects.Class\r\n && impl.identifier.getName().toUpperCase() !== obj.getName().toUpperCase()) {\r\n const issue = issue_1.Issue.atIdentifier(impl.identifier, \"Class implementation name must match filename\", this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n }\r\n for (const impl of file.getInfo().listInterfaceDefinitions()) {\r\n if (file.getFilename().match(/\\.intf\\.abap$/)\r\n && obj instanceof Objects.Interface\r\n && impl.identifier.getName().toUpperCase() !== obj.getName().toUpperCase()) {\r\n const issue = issue_1.Issue.atIdentifier(impl.identifier, \"Interface implementation name must match filename\", this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n }\r\n for (const intf of file.getInfo().listInterfaceDefinitions()) {\r\n if (intf.isLocal && obj instanceof Objects.Interface && file.getFilename().match(/\\.intf\\.abap$/)) {\r\n const issue = issue_1.Issue.atIdentifier(intf.identifier, \"Global interface must be global\", this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n }\r\n }\r\n return output;\r\n }\r\n}\r\nexports.GlobalClass = GlobalClass;\r\n//# sourceMappingURL=global_class.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/global_class.js?");
|
|
12329
12329
|
|
|
12330
12330
|
/***/ }),
|
|
12331
12331
|
|
|
@@ -12336,7 +12336,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12336
12336
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12337
12337
|
|
|
12338
12338
|
"use strict";
|
|
12339
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.IdenticalConditions = exports.IdenticalConditionsConf = 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 issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nclass Conditions {\r\n constructor() {\r\n this.arr = [];\r\n this.arr = [];\r\n }\r\n push(e) {\r\n this.arr.push(e.concatTokens());\r\n }\r\n hasDuplicates() {\r\n return this.arr.some(x => this.arr.indexOf(x) !== this.arr.lastIndexOf(x));\r\n }\r\n}\r\nclass IdenticalConditionsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.IdenticalConditionsConf = IdenticalConditionsConf;\r\nclass IdenticalConditions extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new IdenticalConditionsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"identical_conditions\",\r\n title: \"Identical conditions\",\r\n shortDescription: `Find identical conditions in IF + CASE + WHILE etc\n\nPrerequsites: code is pretty printed with identical cAsE`,\r\n tags: [_irule_1.RuleTag.SingleFile],\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 let issues = [];\r\n const structure = file.getStructure();\r\n if (structure === undefined) {\r\n return [];\r\n }\r\n for (const i of structure.findAllStructures(Structures.If)) {\r\n issues = issues.concat(this.analyzeIf(file, i));\r\n }\r\n for (const i of structure.findAllStructures(Structures.Case)) {\r\n issues = issues.concat(this.analyzeWhen(file, i));\r\n }\r\n for (const i of structure.findAllExpressions(Expressions.Cond)) {\r\n issues = issues.concat(this.analyzeCond(file, i));\r\n }\r\n return issues;\r\n }\r\n ////////////////\r\n analyzeCond(file, node) {\r\n const conditions = new Conditions();\r\n let operator = \"\";\r\n for (const c of node.getChildren()) {\r\n if (c instanceof nodes_1.ExpressionNode) {\r\n conditions.push(c);\r\n }\r\n else if (operator === \"\") {\r\n operator = c.get().getStr().toUpperCase();\r\n }\r\n else if (operator !== c.get().getStr().toUpperCase()) {\r\n return [];\r\n }\r\n }\r\n if (conditions.hasDuplicates()) {\r\n const message = \"Identical conditions\";\r\n const issue = issue_1.Issue.atToken(file, node.getFirstToken(), message, this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n return [];\r\n }\r\n analyzeIf(file, node) {\r\n var _a;\r\n const conditions = new Conditions();\r\n const i = node.findDirectStatement(Statements.If);\r\n if (i === undefined) {\r\n throw new Error(\"identical_conditions, no IF found\");\r\n }\r\n const c = i === null || i === void 0 ? void 0 : i.findDirectExpression(Expressions.Cond);\r\n if (c) {\r\n conditions.push(c);\r\n }\r\n for (const e of node.findDirectStructures(Structures.ElseIf)) {\r\n const c = (_a = e.findDirectStatement(Statements.ElseIf)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Cond);\r\n if (c) {\r\n conditions.push(c);\r\n }\r\n }\r\n if (conditions.hasDuplicates()) {\r\n const message = \"Identical conditions\";\r\n const issue = issue_1.Issue.atStatement(file, i, message, this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n return [];\r\n }\r\n analyzeWhen(file, node) {\r\n const conditions = new Conditions();\r\n const i = node.findDirectStatement(Statements.Case);\r\n if (i === undefined) {\r\n throw new Error(\"identical_conditions, no CASE found\");\r\n }\r\n for (const e of node.findDirectStructures(Structures.When)) {\r\n const w = e.findDirectStatement(Statements.When);\r\n if (w === undefined) {\r\n continue;\r\n }\r\n for (const s of w.findAllExpressions(Expressions.Source)) {\r\n conditions.push(s);\r\n }\r\n }\r\n if (conditions.hasDuplicates()) {\r\n const message = \"Identical conditions\";\r\n const issue = issue_1.Issue.atStatement(file, i, message, this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n return [];\r\n }\r\n}\r\nexports.IdenticalConditions = IdenticalConditions;\r\n//# sourceMappingURL=identical_conditions.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/identical_conditions.js?");
|
|
12339
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.IdenticalConditions = exports.IdenticalConditionsConf = 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 issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nclass Conditions {\r\n constructor() {\r\n this.arr = [];\r\n this.arr = [];\r\n }\r\n push(e) {\r\n this.arr.push(e.concatTokens());\r\n }\r\n hasDuplicates() {\r\n return this.arr.some(x => this.arr.indexOf(x) !== this.arr.lastIndexOf(x));\r\n }\r\n}\r\nclass IdenticalConditionsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.IdenticalConditionsConf = IdenticalConditionsConf;\r\nclass IdenticalConditions extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new IdenticalConditionsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"identical_conditions\",\r\n title: \"Identical conditions\",\r\n shortDescription: `Find identical conditions in IF + CASE + WHILE etc\r\n\r\nPrerequsites: code is pretty printed with identical cAsE`,\r\n tags: [_irule_1.RuleTag.SingleFile],\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 let issues = [];\r\n const structure = file.getStructure();\r\n if (structure === undefined) {\r\n return [];\r\n }\r\n for (const i of structure.findAllStructures(Structures.If)) {\r\n issues = issues.concat(this.analyzeIf(file, i));\r\n }\r\n for (const i of structure.findAllStructures(Structures.Case)) {\r\n issues = issues.concat(this.analyzeWhen(file, i));\r\n }\r\n for (const i of structure.findAllExpressions(Expressions.Cond)) {\r\n issues = issues.concat(this.analyzeCond(file, i));\r\n }\r\n return issues;\r\n }\r\n ////////////////\r\n analyzeCond(file, node) {\r\n const conditions = new Conditions();\r\n let operator = \"\";\r\n for (const c of node.getChildren()) {\r\n if (c instanceof nodes_1.ExpressionNode) {\r\n conditions.push(c);\r\n }\r\n else if (operator === \"\") {\r\n operator = c.get().getStr().toUpperCase();\r\n }\r\n else if (operator !== c.get().getStr().toUpperCase()) {\r\n return [];\r\n }\r\n }\r\n if (conditions.hasDuplicates()) {\r\n const message = \"Identical conditions\";\r\n const issue = issue_1.Issue.atToken(file, node.getFirstToken(), message, this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n return [];\r\n }\r\n analyzeIf(file, node) {\r\n var _a;\r\n const conditions = new Conditions();\r\n const i = node.findDirectStatement(Statements.If);\r\n if (i === undefined) {\r\n throw new Error(\"identical_conditions, no IF found\");\r\n }\r\n const c = i === null || i === void 0 ? void 0 : i.findDirectExpression(Expressions.Cond);\r\n if (c) {\r\n conditions.push(c);\r\n }\r\n for (const e of node.findDirectStructures(Structures.ElseIf)) {\r\n const c = (_a = e.findDirectStatement(Statements.ElseIf)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Cond);\r\n if (c) {\r\n conditions.push(c);\r\n }\r\n }\r\n if (conditions.hasDuplicates()) {\r\n const message = \"Identical conditions\";\r\n const issue = issue_1.Issue.atStatement(file, i, message, this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n return [];\r\n }\r\n analyzeWhen(file, node) {\r\n const conditions = new Conditions();\r\n const i = node.findDirectStatement(Statements.Case);\r\n if (i === undefined) {\r\n throw new Error(\"identical_conditions, no CASE found\");\r\n }\r\n for (const e of node.findDirectStructures(Structures.When)) {\r\n const w = e.findDirectStatement(Statements.When);\r\n if (w === undefined) {\r\n continue;\r\n }\r\n for (const s of w.findAllExpressions(Expressions.Source)) {\r\n conditions.push(s);\r\n }\r\n }\r\n if (conditions.hasDuplicates()) {\r\n const message = \"Identical conditions\";\r\n const issue = issue_1.Issue.atStatement(file, i, message, this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n return [];\r\n }\r\n}\r\nexports.IdenticalConditions = IdenticalConditions;\r\n//# sourceMappingURL=identical_conditions.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/identical_conditions.js?");
|
|
12340
12340
|
|
|
12341
12341
|
/***/ }),
|
|
12342
12342
|
|
|
@@ -12347,7 +12347,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12347
12347
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12348
12348
|
|
|
12349
12349
|
"use strict";
|
|
12350
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.IdenticalContents = exports.IdenticalContentsConf = void 0;\r\nconst Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nclass IdenticalContentsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.IdenticalContentsConf = IdenticalContentsConf;\r\nclass IdenticalContents extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new IdenticalContentsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"identical_contents\",\r\n title: \"Identical contents\",\r\n shortDescription: `Find identical contents in blocks inside IFs, both in the beginning and in the end.`,\r\n extendedInformation: `\nPrerequsites: code is pretty printed with identical cAsE\n\nChained statments are ignored`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `IF foo = bar.\n WRITE 'bar'.\n WRITE 'world'.\nELSE.\n WRITE 'foo'.\n WRITE 'world'.\nENDIF.`,\r\n goodExample: `IF foo = bar.\n WRITE 'bar'.\nELSE.\n WRITE 'foo'.\nENDIF.\nWRITE 'world'.`,\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 let issues = [];\r\n const structure = file.getStructure();\r\n if (structure === undefined) {\r\n return [];\r\n }\r\n for (const i of structure.findAllStructuresRecursive(Structures.If)) {\r\n issues = issues.concat(this.analyzeIf(file, i));\r\n }\r\n return issues;\r\n }\r\n ////////////////\r\n analyzeIf(file, node) {\r\n var _a;\r\n if (node.getChildren().length !== 4) {\r\n return [];\r\n }\r\n const ifBody = node.findDirectStructure(Structures.Body);\r\n if (node.findDirectStructure(Structures.ElseIf)) {\r\n return [];\r\n }\r\n const elseBody = (_a = node.findDirectStructure(Structures.Else)) === null || _a === void 0 ? void 0 : _a.findDirectStructure(Structures.Body);\r\n if (elseBody === undefined || ifBody === undefined) {\r\n return [];\r\n }\r\n {\r\n const ifFirst = ifBody.getFirstChild();\r\n const elseFirst = elseBody.getFirstChild();\r\n if (ifFirst === undefined || elseFirst === undefined || this.isChained(ifFirst)) {\r\n return [];\r\n }\r\n else if (ifFirst.concatTokens() === elseFirst.concatTokens()) {\r\n const message = \"Identical contents\";\r\n const issue = issue_1.Issue.atToken(file, node.getFirstToken(), message, this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n }\r\n {\r\n const ifLast = ifBody.getLastChild();\r\n const elseLast = elseBody.getLastChild();\r\n if (ifLast === undefined || elseLast === undefined || this.isChained(ifLast)) {\r\n return [];\r\n }\r\n else if (ifLast.concatTokens() === elseLast.concatTokens()) {\r\n const message = \"Identical contents\";\r\n const issue = issue_1.Issue.atToken(file, node.getFirstToken(), message, this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n }\r\n return [];\r\n }\r\n isChained(node) {\r\n if (node === undefined) {\r\n return false;\r\n }\r\n else if (node instanceof nodes_1.StatementNode) {\r\n return node.getColon() !== undefined;\r\n }\r\n else {\r\n return this.isChained(node.getFirstStatement());\r\n }\r\n }\r\n}\r\nexports.IdenticalContents = IdenticalContents;\r\n//# sourceMappingURL=identical_contents.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/identical_contents.js?");
|
|
12350
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.IdenticalContents = exports.IdenticalContentsConf = void 0;\r\nconst Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nclass IdenticalContentsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.IdenticalContentsConf = IdenticalContentsConf;\r\nclass IdenticalContents extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new IdenticalContentsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"identical_contents\",\r\n title: \"Identical contents\",\r\n shortDescription: `Find identical contents in blocks inside IFs, both in the beginning and in the end.`,\r\n extendedInformation: `\r\nPrerequsites: code is pretty printed with identical cAsE\r\n\r\nChained statments are ignored`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `IF foo = bar.\r\n WRITE 'bar'.\r\n WRITE 'world'.\r\nELSE.\r\n WRITE 'foo'.\r\n WRITE 'world'.\r\nENDIF.`,\r\n goodExample: `IF foo = bar.\r\n WRITE 'bar'.\r\nELSE.\r\n WRITE 'foo'.\r\nENDIF.\r\nWRITE 'world'.`,\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 let issues = [];\r\n const structure = file.getStructure();\r\n if (structure === undefined) {\r\n return [];\r\n }\r\n for (const i of structure.findAllStructuresRecursive(Structures.If)) {\r\n issues = issues.concat(this.analyzeIf(file, i));\r\n }\r\n return issues;\r\n }\r\n ////////////////\r\n analyzeIf(file, node) {\r\n var _a;\r\n if (node.getChildren().length !== 4) {\r\n return [];\r\n }\r\n const ifBody = node.findDirectStructure(Structures.Body);\r\n if (node.findDirectStructure(Structures.ElseIf)) {\r\n return [];\r\n }\r\n const elseBody = (_a = node.findDirectStructure(Structures.Else)) === null || _a === void 0 ? void 0 : _a.findDirectStructure(Structures.Body);\r\n if (elseBody === undefined || ifBody === undefined) {\r\n return [];\r\n }\r\n {\r\n const ifFirst = ifBody.getFirstChild();\r\n const elseFirst = elseBody.getFirstChild();\r\n if (ifFirst === undefined || elseFirst === undefined || this.isChained(ifFirst)) {\r\n return [];\r\n }\r\n else if (ifFirst.concatTokens() === elseFirst.concatTokens()) {\r\n const message = \"Identical contents\";\r\n const issue = issue_1.Issue.atToken(file, node.getFirstToken(), message, this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n }\r\n {\r\n const ifLast = ifBody.getLastChild();\r\n const elseLast = elseBody.getLastChild();\r\n if (ifLast === undefined || elseLast === undefined || this.isChained(ifLast)) {\r\n return [];\r\n }\r\n else if (ifLast.concatTokens() === elseLast.concatTokens()) {\r\n const message = \"Identical contents\";\r\n const issue = issue_1.Issue.atToken(file, node.getFirstToken(), message, this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n }\r\n return [];\r\n }\r\n isChained(node) {\r\n if (node === undefined) {\r\n return false;\r\n }\r\n else if (node instanceof nodes_1.StatementNode) {\r\n return node.getColon() !== undefined;\r\n }\r\n else {\r\n return this.isChained(node.getFirstStatement());\r\n }\r\n }\r\n}\r\nexports.IdenticalContents = IdenticalContents;\r\n//# sourceMappingURL=identical_contents.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/identical_contents.js?");
|
|
12351
12351
|
|
|
12352
12352
|
/***/ }),
|
|
12353
12353
|
|
|
@@ -12358,7 +12358,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12358
12358
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12359
12359
|
|
|
12360
12360
|
"use strict";
|
|
12361
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.IdenticalDescriptions = exports.IdenticalDescriptionsConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nclass IdenticalDescriptionsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.IdenticalDescriptionsConf = IdenticalDescriptionsConf;\r\nclass IdenticalDescriptions {\r\n constructor() {\r\n this.conf = new IdenticalDescriptionsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"identical_descriptions\",\r\n title: \"Identical descriptions\",\r\n shortDescription: `Searches for objects with the same type and same description`,\r\n extendedInformation: `Case insensitive\n\nOnly checks the master language descriptions\n\nDependencies are skipped\n\nWorks for: INTF, CLAS, DOMA, DTEL, FUNC in same FUGR`,\r\n tags: [],\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 initialize(reg) {\r\n var _a;\r\n this.descriptions = {};\r\n this.types = [\"INTF\", \"CLAS\", \"DOMA\", \"DTEL\"];\r\n for (const o of reg.getObjects()) {\r\n if (reg.isDependency(o)) {\r\n continue;\r\n }\r\n const type = o.getType();\r\n if (this.types.includes(type)) {\r\n const description = (_a = o.getDescription()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\r\n if (description === undefined || description === \"\") {\r\n continue;\r\n }\r\n if (this.descriptions[type] === undefined) {\r\n this.descriptions[type] = {};\r\n }\r\n if (this.descriptions[type][description] === undefined) {\r\n this.descriptions[type][description] = [];\r\n }\r\n this.descriptions[type][description].push(o.getName());\r\n }\r\n }\r\n return this;\r\n }\r\n run(o) {\r\n var _a;\r\n const issues = [];\r\n const type = o.getType();\r\n if (this.types.includes(type)) {\r\n const description = (_a = o.getDescription()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\r\n if (description === undefined || description === \"\") {\r\n return issues;\r\n }\r\n const found = this.descriptions[type][description].filter(a => a !== o.getName());\r\n if (found.length > 0) {\r\n const message = \"Identical description: \" + found[0];\r\n issues.push(issue_1.Issue.atRow(o.getXMLFile(), 1, message, this.getMetadata().key, this.getConfig().severity));\r\n }\r\n }\r\n if (o instanceof objects_1.FunctionGroup) {\r\n issues.push(...this.checkFunctionModules(o));\r\n }\r\n return issues;\r\n }\r\n checkFunctionModules(fugr) {\r\n var _a;\r\n const descriptions = {};\r\n for (const fm of fugr.getModules()) {\r\n const d = (_a = fm.getDescription()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\r\n if (d === undefined || d === \"\") {\r\n continue;\r\n }\r\n if (descriptions[d] !== undefined) {\r\n const message = \"FUGR \" + fugr.getName() + \" contains function modules with identical descriptions\";\r\n return [issue_1.Issue.atRow(fugr.getXMLFile(), 1, message, this.getMetadata().key, this.getConfig().severity)];\r\n }\r\n descriptions[d] = true;\r\n }\r\n return [];\r\n }\r\n}\r\nexports.IdenticalDescriptions = IdenticalDescriptions;\r\n//# sourceMappingURL=identical_descriptions.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/identical_descriptions.js?");
|
|
12361
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.IdenticalDescriptions = exports.IdenticalDescriptionsConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nclass IdenticalDescriptionsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.IdenticalDescriptionsConf = IdenticalDescriptionsConf;\r\nclass IdenticalDescriptions {\r\n constructor() {\r\n this.conf = new IdenticalDescriptionsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"identical_descriptions\",\r\n title: \"Identical descriptions\",\r\n shortDescription: `Searches for objects with the same type and same description`,\r\n extendedInformation: `Case insensitive\r\n\r\nOnly checks the master language descriptions\r\n\r\nDependencies are skipped\r\n\r\nWorks for: INTF, CLAS, DOMA, DTEL, FUNC in same FUGR`,\r\n tags: [],\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 initialize(reg) {\r\n var _a;\r\n this.descriptions = {};\r\n this.types = [\"INTF\", \"CLAS\", \"DOMA\", \"DTEL\"];\r\n for (const o of reg.getObjects()) {\r\n if (reg.isDependency(o)) {\r\n continue;\r\n }\r\n const type = o.getType();\r\n if (this.types.includes(type)) {\r\n const description = (_a = o.getDescription()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\r\n if (description === undefined || description === \"\") {\r\n continue;\r\n }\r\n if (this.descriptions[type] === undefined) {\r\n this.descriptions[type] = {};\r\n }\r\n if (this.descriptions[type][description] === undefined) {\r\n this.descriptions[type][description] = [];\r\n }\r\n this.descriptions[type][description].push(o.getName());\r\n }\r\n }\r\n return this;\r\n }\r\n run(o) {\r\n var _a;\r\n const issues = [];\r\n const type = o.getType();\r\n if (this.types.includes(type)) {\r\n const description = (_a = o.getDescription()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\r\n if (description === undefined || description === \"\") {\r\n return issues;\r\n }\r\n const found = this.descriptions[type][description].filter(a => a !== o.getName());\r\n if (found.length > 0) {\r\n const message = \"Identical description: \" + found[0];\r\n issues.push(issue_1.Issue.atRow(o.getXMLFile(), 1, message, this.getMetadata().key, this.getConfig().severity));\r\n }\r\n }\r\n if (o instanceof objects_1.FunctionGroup) {\r\n issues.push(...this.checkFunctionModules(o));\r\n }\r\n return issues;\r\n }\r\n checkFunctionModules(fugr) {\r\n var _a;\r\n const descriptions = {};\r\n for (const fm of fugr.getModules()) {\r\n const d = (_a = fm.getDescription()) === null || _a === void 0 ? void 0 : _a.toUpperCase();\r\n if (d === undefined || d === \"\") {\r\n continue;\r\n }\r\n if (descriptions[d] !== undefined) {\r\n const message = \"FUGR \" + fugr.getName() + \" contains function modules with identical descriptions\";\r\n return [issue_1.Issue.atRow(fugr.getXMLFile(), 1, message, this.getMetadata().key, this.getConfig().severity)];\r\n }\r\n descriptions[d] = true;\r\n }\r\n return [];\r\n }\r\n}\r\nexports.IdenticalDescriptions = IdenticalDescriptions;\r\n//# sourceMappingURL=identical_descriptions.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/identical_descriptions.js?");
|
|
12362
12362
|
|
|
12363
12363
|
/***/ }),
|
|
12364
12364
|
|
|
@@ -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.IfInIf = exports.IfInIfConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 _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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass IfInIfConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.IfInIfConf = IfInIfConf;\r\nclass IfInIf extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new IfInIfConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"if_in_if\",\r\n title: \"IF in IF\",\r\n shortDescription: `Detects nested ifs which can be refactored.`,\r\n extendedInformation: `\nDirectly nested IFs without ELSE can be refactored to a single condition using AND.\n\nELSE condtions with directly nested IF refactored to ELSEIF, quickfixes are suggested for this case.\n\nhttps://docs.abapopenchecks.org/checks/01/\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#keep-the-nesting-depth-low`,\r\n badExample: `IF condition1.\n IF condition2.\n ...\n ENDIF.\nENDIF.\n\nIF condition1.\n ...\nELSE.\n IF condition2.\n ...\n ENDIF.\nENDIF.`,\r\n goodExample: `IF ( condition1 ) AND ( condition2 ).\n ...\nENDIF.\n\nIF condition1.\n ...\nELSEIF condition2.\n ...\nENDIF.`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],\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, obj) {\r\n var _a, _b;\r\n const issues = [];\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return [];\r\n }\r\n let fixed = false;\r\n let possible = stru.findAllStructures(Structures.If);\r\n possible = possible.concat(stru.findAllStructures(Structures.Else));\r\n for (const i of possible) {\r\n if (i.findDirectStructures(Structures.ElseIf).length > 0\r\n || i.findDirectStructures(Structures.Else).length > 0) {\r\n continue;\r\n }\r\n const blist = i.findDirectStructures(Structures.Body);\r\n if (blist.length === 0) {\r\n continue;\r\n }\r\n const nlist = blist[0].findDirectStructures(Structures.Normal);\r\n if (nlist.length !== 1) {\r\n continue;\r\n }\r\n const niflist = nlist[0].findDirectStructures(Structures.If);\r\n if (niflist.length !== 1) {\r\n continue;\r\n }\r\n const nestedIf = niflist[0];\r\n if (i.get() instanceof Structures.If\r\n && (nestedIf.findDirectStructures(Structures.ElseIf).length > 0\r\n || nestedIf.findDirectStructures(Structures.Else).length > 0)) {\r\n continue;\r\n }\r\n let message = \"IF in IF. Use IF cond1 AND cond2 instead\";\r\n let fix = undefined;\r\n if (i.get() instanceof Structures.Else) {\r\n message = \"Change ELSE part to ELSEIF\";\r\n const els = i.findFirstStatement(Statements.Else);\r\n const iff = (_a = i.findFirstStructure(Structures.If)) === null || _a === void 0 ? void 0 : _a.findDirectStatement(Statements.If);\r\n const endif = (_b = i.findFirstStructure(Structures.If)) === null || _b === void 0 ? void 0 : _b.findDirectStatement(Statements.EndIf);\r\n if (fixed === false && iff && els && endif) {\r\n const fix1 = edit_helper_1.EditHelper.deleteRange(file, els.getLastToken().getStart(), iff === null || iff === void 0 ? void 0 : iff.getFirstToken().getStart());\r\n const fix2 = edit_helper_1.EditHelper.deleteStatement(file, endif);\r\n fix = edit_helper_1.EditHelper.merge(fix1, fix2);\r\n // max one fix per file at a time\r\n fixed = true;\r\n }\r\n }\r\n const token = i.getFirstToken();\r\n const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.IfInIf = IfInIf;\r\n//# sourceMappingURL=if_in_if.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/if_in_if.js?");
|
|
12383
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.IfInIf = exports.IfInIfConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 _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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass IfInIfConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.IfInIfConf = IfInIfConf;\r\nclass IfInIf extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new IfInIfConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"if_in_if\",\r\n title: \"IF in IF\",\r\n shortDescription: `Detects nested ifs which can be refactored.`,\r\n extendedInformation: `\r\nDirectly nested IFs without ELSE can be refactored to a single condition using AND.\r\n\r\nELSE condtions with directly nested IF refactored to ELSEIF, quickfixes are suggested for this case.\r\n\r\nhttps://docs.abapopenchecks.org/checks/01/\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#keep-the-nesting-depth-low`,\r\n badExample: `IF condition1.\r\n IF condition2.\r\n ...\r\n ENDIF.\r\nENDIF.\r\n\r\nIF condition1.\r\n ...\r\nELSE.\r\n IF condition2.\r\n ...\r\n ENDIF.\r\nENDIF.`,\r\n goodExample: `IF ( condition1 ) AND ( condition2 ).\r\n ...\r\nENDIF.\r\n\r\nIF condition1.\r\n ...\r\nELSEIF condition2.\r\n ...\r\nENDIF.`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],\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, obj) {\r\n var _a, _b;\r\n const issues = [];\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return [];\r\n }\r\n let fixed = false;\r\n let possible = stru.findAllStructures(Structures.If);\r\n possible = possible.concat(stru.findAllStructures(Structures.Else));\r\n for (const i of possible) {\r\n if (i.findDirectStructures(Structures.ElseIf).length > 0\r\n || i.findDirectStructures(Structures.Else).length > 0) {\r\n continue;\r\n }\r\n const blist = i.findDirectStructures(Structures.Body);\r\n if (blist.length === 0) {\r\n continue;\r\n }\r\n const nlist = blist[0].findDirectStructures(Structures.Normal);\r\n if (nlist.length !== 1) {\r\n continue;\r\n }\r\n const niflist = nlist[0].findDirectStructures(Structures.If);\r\n if (niflist.length !== 1) {\r\n continue;\r\n }\r\n const nestedIf = niflist[0];\r\n if (i.get() instanceof Structures.If\r\n && (nestedIf.findDirectStructures(Structures.ElseIf).length > 0\r\n || nestedIf.findDirectStructures(Structures.Else).length > 0)) {\r\n continue;\r\n }\r\n let message = \"IF in IF. Use IF cond1 AND cond2 instead\";\r\n let fix = undefined;\r\n if (i.get() instanceof Structures.Else) {\r\n message = \"Change ELSE part to ELSEIF\";\r\n const els = i.findFirstStatement(Statements.Else);\r\n const iff = (_a = i.findFirstStructure(Structures.If)) === null || _a === void 0 ? void 0 : _a.findDirectStatement(Statements.If);\r\n const endif = (_b = i.findFirstStructure(Structures.If)) === null || _b === void 0 ? void 0 : _b.findDirectStatement(Statements.EndIf);\r\n if (fixed === false && iff && els && endif) {\r\n const fix1 = edit_helper_1.EditHelper.deleteRange(file, els.getLastToken().getStart(), iff === null || iff === void 0 ? void 0 : iff.getFirstToken().getStart());\r\n const fix2 = edit_helper_1.EditHelper.deleteStatement(file, endif);\r\n fix = edit_helper_1.EditHelper.merge(fix1, fix2);\r\n // max one fix per file at a time\r\n fixed = true;\r\n }\r\n }\r\n const token = i.getFirstToken();\r\n const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.IfInIf = IfInIf;\r\n//# sourceMappingURL=if_in_if.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/if_in_if.js?");
|
|
12384
12384
|
|
|
12385
12385
|
/***/ }),
|
|
12386
12386
|
|
|
@@ -12391,7 +12391,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12391
12391
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12392
12392
|
|
|
12393
12393
|
"use strict";
|
|
12394
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ImplementMethods = exports.ImplementMethodsConf = void 0;\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 objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/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 Expressions = __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\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\n// todo: abstract methods from superclass parents(might be multiple), if class is not abstract\r\nclass ImplementMethodsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.ImplementMethodsConf = ImplementMethodsConf;\r\nclass ImplementMethods extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ImplementMethodsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"implement_methods\",\r\n title: \"Implement methods\",\r\n shortDescription: `Checks for abstract methods and methods from interfaces which need implementing.`,\r\n extendedInformation: `INCLUDE programs are only checked in connection with their main programs.`,\r\n tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.Quickfix],\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, obj) {\r\n let ret = [];\r\n if (file.getStructure() === undefined) {\r\n return [];\r\n }\r\n else if (obj instanceof objects_1.Program && obj.isInclude() === true) {\r\n return [];\r\n }\r\n this.obj = obj;\r\n for (const classDefinition of file.getInfo().listClassDefinitions()) {\r\n const classImplementation = this.lookupImplementationInObject(classDefinition.name, obj);\r\n ret = ret.concat(this.checkClass(classDefinition, classImplementation));\r\n ret = ret.concat(this.checkInterfaces(classDefinition, classImplementation));\r\n }\r\n return ret;\r\n }\r\n /////////////////////////////////\r\n lookupImplementationInObject(name, obj) {\r\n for (const sub of obj.getABAPFiles()) {\r\n const impl = sub.getInfo().getClassImplementationByName(name);\r\n if (impl !== undefined) {\r\n return impl;\r\n }\r\n }\r\n return undefined;\r\n }\r\n lookupDefinitionInObject(name) {\r\n for (const sub of this.obj.getABAPFiles()) {\r\n const def = sub.getInfo().getClassDefinitionByName(name);\r\n if (def !== undefined) {\r\n return def;\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkClass(def, impl) {\r\n const ret = [];\r\n for (const md of def.methods) {\r\n const found = impl === null || impl === void 0 ? void 0 : impl.methods.find(m => m.getName().toUpperCase() === md.name.toUpperCase());\r\n if (md.isAbstract === true) {\r\n if (found !== undefined) {\r\n const issue = issue_1.Issue.atIdentifier(found, \"Do not implement abstract method \\\"\" + md.name + \"\\\"\", this.getMetadata().key, this.conf.severity);\r\n ret.push(issue);\r\n }\r\n continue;\r\n }\r\n if (impl === undefined) {\r\n const message = \"Class implementation for \\\"\" + def.name + \"\\\" not found\";\r\n const issue = issue_1.Issue.atIdentifier(def.identifier, message, this.getMetadata().key, this.conf.severity);\r\n ret.push(issue);\r\n }\r\n else if (found === undefined) {\r\n const message = \"Implement method \\\"\" + md.name + \"\\\"\";\r\n const fix = this.buildFix(impl, md.name);\r\n const issue = issue_1.Issue.atIdentifier(impl.identifier, message, this.getMetadata().key, this.conf.severity, fix);\r\n ret.push(issue);\r\n }\r\n }\r\n return ret;\r\n }\r\n buildFix(impl, methodName) {\r\n var _a, _b;\r\n const file = this.obj.getABAPFileByName(impl.identifier.getFilename());\r\n if (file === undefined) {\r\n return undefined;\r\n }\r\n for (const i of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllStatements(Statements.ClassImplementation)) || []) {\r\n const name = (_b = i.findFirstExpression(Expressions.ClassName)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr().toUpperCase();\r\n if (name === impl.identifier.getName().toUpperCase()) {\r\n return edit_helper_1.EditHelper.insertAt(file, i.getLastToken().getEnd(), `\n METHOD ${methodName.toLowerCase()}.\n RETURN. \" todo, implement method\n ENDMETHOD.`);\r\n }\r\n }\r\n return undefined;\r\n }\r\n findInterface(identifier, name) {\r\n const idef = this.findInterfaceByName(name);\r\n if (idef === undefined) {\r\n const message = \"Implemented interface \\\"\" + name + \"\\\" not found\";\r\n const issue = issue_1.Issue.atIdentifier(identifier, message, this.getMetadata().key, this.conf.severity);\r\n return issue;\r\n }\r\n return idef;\r\n }\r\n findInterfaceByName(name) {\r\n var _a;\r\n let idef = undefined;\r\n const intf = this.reg.getObject(\"INTF\", name);\r\n if (intf === undefined) {\r\n // lookup in localfiles\r\n for (const file of this.obj.getABAPFiles()) {\r\n const found = file.getInfo().getInterfaceDefinitionByName(name);\r\n if (found) {\r\n idef = found;\r\n break;\r\n }\r\n }\r\n }\r\n else {\r\n idef = (_a = intf.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getInfo().listInterfaceDefinitions()[0];\r\n }\r\n return idef;\r\n }\r\n /** including implemented super interfaces */\r\n findInterfaceMethods(idef) {\r\n const methods = idef.methods.map((m) => {\r\n return { objectName: idef.name, method: m };\r\n });\r\n for (const i of idef.interfaces) {\r\n const sup = this.findInterface(idef.identifier, i.name);\r\n if (sup !== undefined && !(sup instanceof issue_1.Issue)) {\r\n sup.methods.forEach(m => {\r\n methods.push({ objectName: sup.name, method: m });\r\n });\r\n }\r\n }\r\n return methods;\r\n }\r\n findClass(name) {\r\n let def = this.lookupDefinitionInObject(name);\r\n let impl = this.lookupImplementationInObject(name, this.obj);\r\n if (def && impl) {\r\n return { def, impl };\r\n }\r\n const global = this.reg.getObject(\"CLAS\", name);\r\n if (global) {\r\n def = global.getClassDefinition();\r\n impl = this.lookupImplementationInObject(name, global);\r\n if (def && impl) {\r\n return { def, impl };\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkInterfaces(def, impl) {\r\n const ret = [];\r\n for (const interfaceInfo of def.interfaces) {\r\n const idef = this.findInterface(def.identifier, interfaceInfo.name);\r\n if (idef === undefined || interfaceInfo.partial === true || interfaceInfo.allAbstract === true) {\r\n continue; // ignore parser errors in interface\r\n }\r\n else if (idef instanceof issue_1.Issue) {\r\n return [idef];\r\n }\r\n for (const m of this.findInterfaceMethods(idef)) {\r\n if (interfaceInfo.abstractMethods.includes(m.method.name.toUpperCase())) {\r\n continue;\r\n }\r\n if (this.isImplemented(m, def, impl) === false) {\r\n const message = \"Implement method \\\"\" + m.method.name + \"\\\" from interface \\\"\" + m.objectName + \"\\\"\";\r\n if (impl) {\r\n const fix = this.buildFix(impl, m.objectName + \"~\" + m.method.name);\r\n const issue = issue_1.Issue.atIdentifier(impl.identifier, message, this.getMetadata().key, this.conf.severity, fix);\r\n ret.push(issue);\r\n }\r\n else {\r\n const issue = issue_1.Issue.atIdentifier(def.identifier, message, this.getMetadata().key, this.conf.severity);\r\n ret.push(issue);\r\n }\r\n }\r\n }\r\n }\r\n return ret;\r\n }\r\n isImplemented(m, def, impl) {\r\n if (impl === undefined) {\r\n return false;\r\n }\r\n const name = m.objectName + \"~\" + m.method.name;\r\n let found = impl.methods.find(m => m.getName().toUpperCase() === name.toUpperCase());\r\n if (found === undefined) {\r\n // try looking for ALIASes\r\n for (const alias of def.aliases) {\r\n if (alias.component.toUpperCase() === name.toUpperCase()) {\r\n found = impl.methods.find(m => m.getName().toUpperCase() === alias.name.toUpperCase());\r\n break;\r\n }\r\n }\r\n }\r\n if (found === undefined && def.superClassName !== undefined) {\r\n const clas = this.findClass(def.superClassName);\r\n if (clas) {\r\n return this.isImplemented(m, clas === null || clas === void 0 ? void 0 : clas.def, clas === null || clas === void 0 ? void 0 : clas.impl);\r\n }\r\n }\r\n if (found === undefined) {\r\n for (const i of def.interfaces) {\r\n const idef = this.findInterfaceByName(i.name);\r\n if (idef === undefined) {\r\n continue;\r\n }\r\n const ali = this.viaAliasInInterface(m, idef, impl);\r\n if (ali) {\r\n return ali;\r\n }\r\n }\r\n }\r\n return found !== undefined;\r\n }\r\n viaAliasInInterface(m, intf, impl) {\r\n for (const a of intf.aliases) {\r\n if (a.component.toUpperCase() === m.objectName.toUpperCase() + \"~\" + m.method.name.toUpperCase()) {\r\n const name = intf.name + \"~\" + a.name;\r\n const found = impl.methods.find(m => m.getName().toUpperCase() === name.toUpperCase());\r\n if (found) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\nexports.ImplementMethods = ImplementMethods;\r\n//# sourceMappingURL=implement_methods.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/implement_methods.js?");
|
|
12394
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ImplementMethods = exports.ImplementMethodsConf = void 0;\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 objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/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 Expressions = __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\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\n// todo: abstract methods from superclass parents(might be multiple), if class is not abstract\r\nclass ImplementMethodsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.ImplementMethodsConf = ImplementMethodsConf;\r\nclass ImplementMethods extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ImplementMethodsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"implement_methods\",\r\n title: \"Implement methods\",\r\n shortDescription: `Checks for abstract methods and methods from interfaces which need implementing.`,\r\n extendedInformation: `INCLUDE programs are only checked in connection with their main programs.`,\r\n tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.Quickfix],\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, obj) {\r\n let ret = [];\r\n if (file.getStructure() === undefined) {\r\n return [];\r\n }\r\n else if (obj instanceof objects_1.Program && obj.isInclude() === true) {\r\n return [];\r\n }\r\n this.obj = obj;\r\n for (const classDefinition of file.getInfo().listClassDefinitions()) {\r\n const classImplementation = this.lookupImplementationInObject(classDefinition.name, obj);\r\n ret = ret.concat(this.checkClass(classDefinition, classImplementation));\r\n ret = ret.concat(this.checkInterfaces(classDefinition, classImplementation));\r\n }\r\n return ret;\r\n }\r\n /////////////////////////////////\r\n lookupImplementationInObject(name, obj) {\r\n for (const sub of obj.getABAPFiles()) {\r\n const impl = sub.getInfo().getClassImplementationByName(name);\r\n if (impl !== undefined) {\r\n return impl;\r\n }\r\n }\r\n return undefined;\r\n }\r\n lookupDefinitionInObject(name) {\r\n for (const sub of this.obj.getABAPFiles()) {\r\n const def = sub.getInfo().getClassDefinitionByName(name);\r\n if (def !== undefined) {\r\n return def;\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkClass(def, impl) {\r\n const ret = [];\r\n for (const md of def.methods) {\r\n const found = impl === null || impl === void 0 ? void 0 : impl.methods.find(m => m.getName().toUpperCase() === md.name.toUpperCase());\r\n if (md.isAbstract === true) {\r\n if (found !== undefined) {\r\n const issue = issue_1.Issue.atIdentifier(found, \"Do not implement abstract method \\\"\" + md.name + \"\\\"\", this.getMetadata().key, this.conf.severity);\r\n ret.push(issue);\r\n }\r\n continue;\r\n }\r\n if (impl === undefined) {\r\n const message = \"Class implementation for \\\"\" + def.name + \"\\\" not found\";\r\n const issue = issue_1.Issue.atIdentifier(def.identifier, message, this.getMetadata().key, this.conf.severity);\r\n ret.push(issue);\r\n }\r\n else if (found === undefined) {\r\n const message = \"Implement method \\\"\" + md.name + \"\\\"\";\r\n const fix = this.buildFix(impl, md.name);\r\n const issue = issue_1.Issue.atIdentifier(impl.identifier, message, this.getMetadata().key, this.conf.severity, fix);\r\n ret.push(issue);\r\n }\r\n }\r\n return ret;\r\n }\r\n buildFix(impl, methodName) {\r\n var _a, _b;\r\n const file = this.obj.getABAPFileByName(impl.identifier.getFilename());\r\n if (file === undefined) {\r\n return undefined;\r\n }\r\n for (const i of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllStatements(Statements.ClassImplementation)) || []) {\r\n const name = (_b = i.findFirstExpression(Expressions.ClassName)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr().toUpperCase();\r\n if (name === impl.identifier.getName().toUpperCase()) {\r\n return edit_helper_1.EditHelper.insertAt(file, i.getLastToken().getEnd(), `\r\n METHOD ${methodName.toLowerCase()}.\r\n RETURN. \" todo, implement method\r\n ENDMETHOD.`);\r\n }\r\n }\r\n return undefined;\r\n }\r\n findInterface(identifier, name) {\r\n const idef = this.findInterfaceByName(name);\r\n if (idef === undefined) {\r\n const message = \"Implemented interface \\\"\" + name + \"\\\" not found\";\r\n const issue = issue_1.Issue.atIdentifier(identifier, message, this.getMetadata().key, this.conf.severity);\r\n return issue;\r\n }\r\n return idef;\r\n }\r\n findInterfaceByName(name) {\r\n var _a;\r\n let idef = undefined;\r\n const intf = this.reg.getObject(\"INTF\", name);\r\n if (intf === undefined) {\r\n // lookup in localfiles\r\n for (const file of this.obj.getABAPFiles()) {\r\n const found = file.getInfo().getInterfaceDefinitionByName(name);\r\n if (found) {\r\n idef = found;\r\n break;\r\n }\r\n }\r\n }\r\n else {\r\n idef = (_a = intf.getMainABAPFile()) === null || _a === void 0 ? void 0 : _a.getInfo().listInterfaceDefinitions()[0];\r\n }\r\n return idef;\r\n }\r\n /** including implemented super interfaces */\r\n findInterfaceMethods(idef) {\r\n const methods = idef.methods.map((m) => {\r\n return { objectName: idef.name, method: m };\r\n });\r\n for (const i of idef.interfaces) {\r\n const sup = this.findInterface(idef.identifier, i.name);\r\n if (sup !== undefined && !(sup instanceof issue_1.Issue)) {\r\n sup.methods.forEach(m => {\r\n methods.push({ objectName: sup.name, method: m });\r\n });\r\n }\r\n }\r\n return methods;\r\n }\r\n findClass(name) {\r\n let def = this.lookupDefinitionInObject(name);\r\n let impl = this.lookupImplementationInObject(name, this.obj);\r\n if (def && impl) {\r\n return { def, impl };\r\n }\r\n const global = this.reg.getObject(\"CLAS\", name);\r\n if (global) {\r\n def = global.getClassDefinition();\r\n impl = this.lookupImplementationInObject(name, global);\r\n if (def && impl) {\r\n return { def, impl };\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkInterfaces(def, impl) {\r\n const ret = [];\r\n for (const interfaceInfo of def.interfaces) {\r\n const idef = this.findInterface(def.identifier, interfaceInfo.name);\r\n if (idef === undefined || interfaceInfo.partial === true || interfaceInfo.allAbstract === true) {\r\n continue; // ignore parser errors in interface\r\n }\r\n else if (idef instanceof issue_1.Issue) {\r\n return [idef];\r\n }\r\n for (const m of this.findInterfaceMethods(idef)) {\r\n if (interfaceInfo.abstractMethods.includes(m.method.name.toUpperCase())) {\r\n continue;\r\n }\r\n if (this.isImplemented(m, def, impl) === false) {\r\n const message = \"Implement method \\\"\" + m.method.name + \"\\\" from interface \\\"\" + m.objectName + \"\\\"\";\r\n if (impl) {\r\n const fix = this.buildFix(impl, m.objectName + \"~\" + m.method.name);\r\n const issue = issue_1.Issue.atIdentifier(impl.identifier, message, this.getMetadata().key, this.conf.severity, fix);\r\n ret.push(issue);\r\n }\r\n else {\r\n const issue = issue_1.Issue.atIdentifier(def.identifier, message, this.getMetadata().key, this.conf.severity);\r\n ret.push(issue);\r\n }\r\n }\r\n }\r\n }\r\n return ret;\r\n }\r\n isImplemented(m, def, impl) {\r\n if (impl === undefined) {\r\n return false;\r\n }\r\n const name = m.objectName + \"~\" + m.method.name;\r\n let found = impl.methods.find(m => m.getName().toUpperCase() === name.toUpperCase());\r\n if (found === undefined) {\r\n // try looking for ALIASes\r\n for (const alias of def.aliases) {\r\n if (alias.component.toUpperCase() === name.toUpperCase()) {\r\n found = impl.methods.find(m => m.getName().toUpperCase() === alias.name.toUpperCase());\r\n break;\r\n }\r\n }\r\n }\r\n if (found === undefined && def.superClassName !== undefined) {\r\n const clas = this.findClass(def.superClassName);\r\n if (clas) {\r\n return this.isImplemented(m, clas === null || clas === void 0 ? void 0 : clas.def, clas === null || clas === void 0 ? void 0 : clas.impl);\r\n }\r\n }\r\n if (found === undefined) {\r\n for (const i of def.interfaces) {\r\n const idef = this.findInterfaceByName(i.name);\r\n if (idef === undefined) {\r\n continue;\r\n }\r\n const ali = this.viaAliasInInterface(m, idef, impl);\r\n if (ali) {\r\n return ali;\r\n }\r\n }\r\n }\r\n return found !== undefined;\r\n }\r\n viaAliasInInterface(m, intf, impl) {\r\n for (const a of intf.aliases) {\r\n if (a.component.toUpperCase() === m.objectName.toUpperCase() + \"~\" + m.method.name.toUpperCase()) {\r\n const name = intf.name + \"~\" + a.name;\r\n const found = impl.methods.find(m => m.getName().toUpperCase() === name.toUpperCase());\r\n if (found) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\nexports.ImplementMethods = ImplementMethods;\r\n//# sourceMappingURL=implement_methods.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/implement_methods.js?");
|
|
12395
12395
|
|
|
12396
12396
|
/***/ }),
|
|
12397
12397
|
|
|
@@ -12402,7 +12402,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12402
12402
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12403
12403
|
|
|
12404
12404
|
"use strict";
|
|
12405
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.InStatementIndentation = exports.InStatementIndentationConf = void 0;\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 objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/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 Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass InStatementIndentationConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Additional indent for first statement of blocks */\r\n this.blockStatements = 2;\r\n /** Ignore global exception classes */\r\n this.ignoreExceptions = true;\r\n }\r\n}\r\nexports.InStatementIndentationConf = InStatementIndentationConf;\r\nclass InStatementIndentation extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new InStatementIndentationConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"in_statement_indentation\",\r\n title: \"In-statement indentation\",\r\n shortDescription: \"Checks alignment within statements which span multiple lines.\",\r\n extendedInformation: `Lines following the first line should be indented once (2 spaces).\n \nFor block declaration statements, lines after the first should be indented an additional time (default: +2 spaces)\nto distinguish them better from code within the block.`,\r\n badExample: `IF 1 = 1\n AND 2 = 2.\n WRITE 'hello' &&\n 'world'.\nENDIF.`,\r\n goodExample: `IF 1 = 1\n AND 2 = 2.\n WRITE 'hello' &&\n 'world'.\nENDIF.`,\r\n tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getMessage() {\r\n return \"Fix in-statement indentation\";\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, obj) {\r\n const ret = [];\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n if (obj instanceof objects_1.Class) {\r\n const definition = obj.getClassDefinition();\r\n if (definition === undefined) {\r\n return [];\r\n }\r\n else if (this.conf.ignoreExceptions && ddic.isException(definition, obj)) {\r\n return [];\r\n }\r\n }\r\n for (const s of file.getStatements()) {\r\n if (s.get() instanceof _statement_1.Comment || s.get() instanceof _statement_1.Unknown) {\r\n continue;\r\n }\r\n const tokens = s.getTokens();\r\n if (tokens.length === 0) {\r\n continue;\r\n }\r\n const beginLine = tokens[0].getRow();\r\n let expected = tokens[0].getCol() + 2;\r\n const type = s.get();\r\n if (type instanceof Statements.If\r\n || type instanceof Statements.While\r\n || type instanceof Statements.Module\r\n || type instanceof Statements.SelectLoop\r\n || type instanceof Statements.FunctionModule\r\n || type instanceof Statements.Do\r\n || type instanceof Statements.At\r\n || type instanceof Statements.Catch\r\n || type instanceof Statements.Case\r\n || type instanceof Statements.When\r\n || type instanceof Statements.Cleanup\r\n || type instanceof Statements.Loop\r\n || type instanceof Statements.Form\r\n || type instanceof Statements.Else\r\n || type instanceof Statements.ElseIf\r\n || type instanceof Statements.MethodImplementation) {\r\n expected = expected + this.conf.blockStatements;\r\n }\r\n for (const t of tokens) {\r\n if (t.getRow() === beginLine) {\r\n continue;\r\n }\r\n if (t.getCol() < expected) {\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, new position_1.Position(t.getRow(), 1), t.getStart(), \" \".repeat(expected - 1));\r\n const issue = issue_1.Issue.atToken(file, t, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n ret.push(issue);\r\n break;\r\n }\r\n }\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.InStatementIndentation = InStatementIndentation;\r\n//# sourceMappingURL=in_statement_indentation.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/in_statement_indentation.js?");
|
|
12405
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.InStatementIndentation = exports.InStatementIndentationConf = void 0;\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 objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/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 Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass InStatementIndentationConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Additional indent for first statement of blocks */\r\n this.blockStatements = 2;\r\n /** Ignore global exception classes */\r\n this.ignoreExceptions = true;\r\n }\r\n}\r\nexports.InStatementIndentationConf = InStatementIndentationConf;\r\nclass InStatementIndentation extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new InStatementIndentationConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"in_statement_indentation\",\r\n title: \"In-statement indentation\",\r\n shortDescription: \"Checks alignment within statements which span multiple lines.\",\r\n extendedInformation: `Lines following the first line should be indented once (2 spaces).\r\n \r\nFor block declaration statements, lines after the first should be indented an additional time (default: +2 spaces)\r\nto distinguish them better from code within the block.`,\r\n badExample: `IF 1 = 1\r\n AND 2 = 2.\r\n WRITE 'hello' &&\r\n 'world'.\r\nENDIF.`,\r\n goodExample: `IF 1 = 1\r\n AND 2 = 2.\r\n WRITE 'hello' &&\r\n 'world'.\r\nENDIF.`,\r\n tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getMessage() {\r\n return \"Fix in-statement indentation\";\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, obj) {\r\n const ret = [];\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n if (obj instanceof objects_1.Class) {\r\n const definition = obj.getClassDefinition();\r\n if (definition === undefined) {\r\n return [];\r\n }\r\n else if (this.conf.ignoreExceptions && ddic.isException(definition, obj)) {\r\n return [];\r\n }\r\n }\r\n for (const s of file.getStatements()) {\r\n if (s.get() instanceof _statement_1.Comment || s.get() instanceof _statement_1.Unknown) {\r\n continue;\r\n }\r\n const tokens = s.getTokens();\r\n if (tokens.length === 0) {\r\n continue;\r\n }\r\n const beginLine = tokens[0].getRow();\r\n let expected = tokens[0].getCol() + 2;\r\n const type = s.get();\r\n if (type instanceof Statements.If\r\n || type instanceof Statements.While\r\n || type instanceof Statements.Module\r\n || type instanceof Statements.SelectLoop\r\n || type instanceof Statements.FunctionModule\r\n || type instanceof Statements.Do\r\n || type instanceof Statements.At\r\n || type instanceof Statements.Catch\r\n || type instanceof Statements.Case\r\n || type instanceof Statements.When\r\n || type instanceof Statements.Cleanup\r\n || type instanceof Statements.Loop\r\n || type instanceof Statements.Form\r\n || type instanceof Statements.Else\r\n || type instanceof Statements.ElseIf\r\n || type instanceof Statements.MethodImplementation) {\r\n expected = expected + this.conf.blockStatements;\r\n }\r\n for (const t of tokens) {\r\n if (t.getRow() === beginLine) {\r\n continue;\r\n }\r\n if (t.getCol() < expected) {\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, new position_1.Position(t.getRow(), 1), t.getStart(), \" \".repeat(expected - 1));\r\n const issue = issue_1.Issue.atToken(file, t, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n ret.push(issue);\r\n break;\r\n }\r\n }\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.InStatementIndentation = InStatementIndentation;\r\n//# sourceMappingURL=in_statement_indentation.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/in_statement_indentation.js?");
|
|
12406
12406
|
|
|
12407
12407
|
/***/ }),
|
|
12408
12408
|
|
|
@@ -12446,7 +12446,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12446
12446
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12447
12447
|
|
|
12448
12448
|
"use strict";
|
|
12449
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.IntfReferencingClas = exports.IntfReferencingClasConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nclass IntfReferencingClasConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** List of classes allowed to be referenced, regex, case insensitive\r\n * @uniqueItems true\r\n */\r\n this.allow = [];\r\n }\r\n}\r\nexports.IntfReferencingClasConf = IntfReferencingClasConf;\r\nclass IntfReferencingClas {\r\n constructor() {\r\n this.conf = new IntfReferencingClasConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"intf_referencing_clas\",\r\n title: \"INTF referencing CLAS\",\r\n shortDescription: `Interface contains references to class`,\r\n extendedInformation: `Only global interfaces are checked.\n Only first level references are checked.\n Exception class references are ignored.\n Void references are ignored.`,\r\n };\r\n }\r\n getConfig() {\r\n if (this.conf.allow === undefined) {\r\n this.conf.allow = [];\r\n }\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof objects_1.Interface)) {\r\n return [];\r\n }\r\n return this.traverse(new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti.getTop());\r\n }\r\n ////////////////\r\n traverse(node) {\r\n var _a, _b;\r\n let ret = [];\r\n const message = \"Referencing CLAS: \";\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n for (const r of node.getData().references) {\r\n if (r.referenceType === _reference_1.ReferenceType.ObjectOrientedReference\r\n && ((_a = r.extra) === null || _a === void 0 ? void 0 : _a.ooType) === \"CLAS\"\r\n && ((_b = r.extra) === null || _b === void 0 ? void 0 : _b.ooName) !== undefined) {\r\n const found = this.reg.getObject(\"CLAS\", r.extra.ooName) || undefined;\r\n if (found && ddic.isException(found.getClassDefinition(), found)) {\r\n continue;\r\n }\r\n else if (this.getConfig().allow.some(reg => new RegExp(reg, \"i\").test(r.extra.ooName))) {\r\n continue;\r\n }\r\n ret.push(issue_1.Issue.atIdentifier(r.position, message + r.extra.ooName, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n for (const c of node.getChildren()) {\r\n ret = ret.concat(this.traverse(c));\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.IntfReferencingClas = IntfReferencingClas;\r\n//# sourceMappingURL=intf_referencing_clas.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/intf_referencing_clas.js?");
|
|
12449
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.IntfReferencingClas = exports.IntfReferencingClasConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nclass IntfReferencingClasConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** List of classes allowed to be referenced, regex, case insensitive\r\n * @uniqueItems true\r\n */\r\n this.allow = [];\r\n }\r\n}\r\nexports.IntfReferencingClasConf = IntfReferencingClasConf;\r\nclass IntfReferencingClas {\r\n constructor() {\r\n this.conf = new IntfReferencingClasConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"intf_referencing_clas\",\r\n title: \"INTF referencing CLAS\",\r\n shortDescription: `Interface contains references to class`,\r\n extendedInformation: `Only global interfaces are checked.\r\n Only first level references are checked.\r\n Exception class references are ignored.\r\n Void references are ignored.`,\r\n };\r\n }\r\n getConfig() {\r\n if (this.conf.allow === undefined) {\r\n this.conf.allow = [];\r\n }\r\n return this.conf;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof objects_1.Interface)) {\r\n return [];\r\n }\r\n return this.traverse(new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti.getTop());\r\n }\r\n ////////////////\r\n traverse(node) {\r\n var _a, _b;\r\n let ret = [];\r\n const message = \"Referencing CLAS: \";\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n for (const r of node.getData().references) {\r\n if (r.referenceType === _reference_1.ReferenceType.ObjectOrientedReference\r\n && ((_a = r.extra) === null || _a === void 0 ? void 0 : _a.ooType) === \"CLAS\"\r\n && ((_b = r.extra) === null || _b === void 0 ? void 0 : _b.ooName) !== undefined) {\r\n const found = this.reg.getObject(\"CLAS\", r.extra.ooName) || undefined;\r\n if (found && ddic.isException(found.getClassDefinition(), found)) {\r\n continue;\r\n }\r\n else if (this.getConfig().allow.some(reg => new RegExp(reg, \"i\").test(r.extra.ooName))) {\r\n continue;\r\n }\r\n ret.push(issue_1.Issue.atIdentifier(r.position, message + r.extra.ooName, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n for (const c of node.getChildren()) {\r\n ret = ret.concat(this.traverse(c));\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.IntfReferencingClas = IntfReferencingClas;\r\n//# sourceMappingURL=intf_referencing_clas.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/intf_referencing_clas.js?");
|
|
12450
12450
|
|
|
12451
12451
|
/***/ }),
|
|
12452
12452
|
|
|
@@ -12490,7 +12490,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12490
12490
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12491
12491
|
|
|
12492
12492
|
"use strict";
|
|
12493
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LineBreakStyle = exports.LineBreakStyleConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass LineBreakStyleConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.LineBreakStyleConf = LineBreakStyleConf;\r\nclass LineBreakStyle {\r\n constructor() {\r\n this.conf = new LineBreakStyleConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"line_break_style\",\r\n title: \"Makes sure line breaks are consistent in the ABAP code\",\r\n shortDescription: `Enforces LF as newlines in ABAP files\n\nabapGit does not work with CRLF`,\r\n tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n initialize(_reg) {\r\n return this;\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 run(obj) {\r\n const output = [];\r\n for (const file of obj.getFiles()) {\r\n if (file.getFilename().endsWith(\".abap\")) {\r\n const rows = file.getRawRows();\r\n for (let i = 0; i < rows.length; i++) {\r\n if (rows[i].endsWith(\"\\r\") === true) {\r\n const message = \"Line contains carriage return\";\r\n const issue = issue_1.Issue.atRow(file, i + 1, message, this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n break; // only one finding per file\r\n }\r\n }\r\n }\r\n }\r\n return output;\r\n }\r\n}\r\nexports.LineBreakStyle = LineBreakStyle;\r\n//# sourceMappingURL=line_break_style.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/line_break_style.js?");
|
|
12493
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LineBreakStyle = exports.LineBreakStyleConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass LineBreakStyleConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.LineBreakStyleConf = LineBreakStyleConf;\r\nclass LineBreakStyle {\r\n constructor() {\r\n this.conf = new LineBreakStyleConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"line_break_style\",\r\n title: \"Makes sure line breaks are consistent in the ABAP code\",\r\n shortDescription: `Enforces LF as newlines in ABAP files\r\n\r\nabapGit does not work with CRLF`,\r\n tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n initialize(_reg) {\r\n return this;\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 run(obj) {\r\n const output = [];\r\n for (const file of obj.getFiles()) {\r\n if (file.getFilename().endsWith(\".abap\")) {\r\n const rows = file.getRawRows();\r\n for (let i = 0; i < rows.length; i++) {\r\n if (rows[i].endsWith(\"\\r\") === true) {\r\n const message = \"Line contains carriage return\";\r\n const issue = issue_1.Issue.atRow(file, i + 1, message, this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n break; // only one finding per file\r\n }\r\n }\r\n }\r\n }\r\n return output;\r\n }\r\n}\r\nexports.LineBreakStyle = LineBreakStyle;\r\n//# sourceMappingURL=line_break_style.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/line_break_style.js?");
|
|
12494
12494
|
|
|
12495
12495
|
/***/ }),
|
|
12496
12496
|
|
|
@@ -12501,7 +12501,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12501
12501
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12502
12502
|
|
|
12503
12503
|
"use strict";
|
|
12504
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LineLength = exports.LineLengthConf = void 0;\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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass LineLengthConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Maximum line length in characters, trailing whitespace ignored */\r\n this.length = 120;\r\n }\r\n}\r\nexports.LineLengthConf = LineLengthConf;\r\nclass LineLength extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new LineLengthConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"line_length\",\r\n title: \"Line length\",\r\n shortDescription: `Detects lines exceeding the provided maximum length.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#stick-to-a-reasonable-line-length\nhttps://docs.abapopenchecks.org/checks/04/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\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 const issues = [];\r\n // maximum line length in abap files\r\n const maxLineLength = 255;\r\n const array = file.getRawRows();\r\n for (let rowIndex = 0; rowIndex < array.length; rowIndex++) {\r\n const row = array[rowIndex].replace(\"\\r\", \"\");\r\n if (row.length > maxLineLength) {\r\n const message = `Maximum allowed line length of ${maxLineLength} exceeded, currently ${row.length}`;\r\n issues.push(issue_1.Issue.atRow(file, rowIndex + 1, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (row.length > this.conf.length) {\r\n const message = `Reduce line length to max ${this.conf.length}, currently ${row.length}`;\r\n issues.push(issue_1.Issue.atRow(file, rowIndex + 1, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.LineLength = LineLength;\r\n//# sourceMappingURL=line_length.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/line_length.js?");
|
|
12504
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LineLength = exports.LineLengthConf = void 0;\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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass LineLengthConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Maximum line length in characters, trailing whitespace ignored */\r\n this.length = 120;\r\n }\r\n}\r\nexports.LineLengthConf = LineLengthConf;\r\nclass LineLength extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new LineLengthConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"line_length\",\r\n title: \"Line length\",\r\n shortDescription: `Detects lines exceeding the provided maximum length.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#stick-to-a-reasonable-line-length\r\nhttps://docs.abapopenchecks.org/checks/04/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\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 const issues = [];\r\n // maximum line length in abap files\r\n const maxLineLength = 255;\r\n const array = file.getRawRows();\r\n for (let rowIndex = 0; rowIndex < array.length; rowIndex++) {\r\n const row = array[rowIndex].replace(\"\\r\", \"\");\r\n if (row.length > maxLineLength) {\r\n const message = `Maximum allowed line length of ${maxLineLength} exceeded, currently ${row.length}`;\r\n issues.push(issue_1.Issue.atRow(file, rowIndex + 1, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n else if (row.length > this.conf.length) {\r\n const message = `Reduce line length to max ${this.conf.length}, currently ${row.length}`;\r\n issues.push(issue_1.Issue.atRow(file, rowIndex + 1, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.LineLength = LineLength;\r\n//# sourceMappingURL=line_length.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/line_length.js?");
|
|
12505
12505
|
|
|
12506
12506
|
/***/ }),
|
|
12507
12507
|
|
|
@@ -12512,7 +12512,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12512
12512
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12513
12513
|
|
|
12514
12514
|
"use strict";
|
|
12515
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LineOnlyPunc = exports.LineOnlyPuncConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.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 objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nclass LineOnlyPuncConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Ignore lines with only puncutation in global exception classes */\r\n this.ignoreExceptions = true;\r\n }\r\n}\r\nexports.LineOnlyPuncConf = LineOnlyPuncConf;\r\nclass LineOnlyPunc extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new LineOnlyPuncConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"line_only_punc\",\r\n title: \"Line containing only punctuation\",\r\n shortDescription: `Detects lines containing only punctuation.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#close-brackets-at-line-end\nhttps://docs.abapopenchecks.org/checks/16/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n badExample: \"zcl_class=>method(\\n).\",\r\n goodExample: \"zcl_class=>method( ).\",\r\n };\r\n }\r\n getMessage() {\r\n return \"A line should not contain only \\\".\\\" or \\\").\\\"\";\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, obj) {\r\n const issues = [];\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n if (obj instanceof objects_1.Class) {\r\n const definition = obj.getClassDefinition();\r\n if (definition === undefined) {\r\n return [];\r\n }\r\n else if (this.conf.ignoreExceptions && ddic.isException(definition, obj)) {\r\n return [];\r\n }\r\n }\r\n const rows = file.getRawRows();\r\n const reg = new RegExp(\"^\\\\)?\\\\. *(\\\\\\\".*)?$\");\r\n for (let i = 0; i < rows.length; i++) {\r\n if (reg.exec(rows[i].trim())) {\r\n const column = rows[i].indexOf(\")\") >= 0 ? rows[i].indexOf(\")\") + 1 : rows[i].indexOf(\".\") + 1;\r\n const position = new position_1.Position(i + 1, column);\r\n // merge punc into previous row\r\n let rowContent = rows[i].trim();\r\n // if reported row contains a paranthesis, prefix with space if needed\r\n if (rowContent.length > 1 && !rows[i - 1].endsWith(\" \") && !rows[i - 1].endsWith(\" \\r\")) {\r\n rowContent = \" \" + rowContent;\r\n }\r\n let offset = 0;\r\n if (rows[i - 1].endsWith(\"\\r\")) {\r\n offset = -1;\r\n }\r\n const startPos = new position_1.Position(i, rows[i - 1].length + 1 + offset);\r\n const endPos = new position_1.Position(i + 1, rows[i].length + 1);\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, startPos, endPos, rowContent);\r\n const issue = issue_1.Issue.atPosition(file, position, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.LineOnlyPunc = LineOnlyPunc;\r\n//# sourceMappingURL=line_only_punc.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/line_only_punc.js?");
|
|
12515
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LineOnlyPunc = exports.LineOnlyPuncConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.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 objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nclass LineOnlyPuncConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Ignore lines with only puncutation in global exception classes */\r\n this.ignoreExceptions = true;\r\n }\r\n}\r\nexports.LineOnlyPuncConf = LineOnlyPuncConf;\r\nclass LineOnlyPunc extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new LineOnlyPuncConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"line_only_punc\",\r\n title: \"Line containing only punctuation\",\r\n shortDescription: `Detects lines containing only punctuation.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#close-brackets-at-line-end\r\nhttps://docs.abapopenchecks.org/checks/16/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n badExample: \"zcl_class=>method(\\n).\",\r\n goodExample: \"zcl_class=>method( ).\",\r\n };\r\n }\r\n getMessage() {\r\n return \"A line should not contain only \\\".\\\" or \\\").\\\"\";\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, obj) {\r\n const issues = [];\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n if (obj instanceof objects_1.Class) {\r\n const definition = obj.getClassDefinition();\r\n if (definition === undefined) {\r\n return [];\r\n }\r\n else if (this.conf.ignoreExceptions && ddic.isException(definition, obj)) {\r\n return [];\r\n }\r\n }\r\n const rows = file.getRawRows();\r\n const reg = new RegExp(\"^\\\\)?\\\\. *(\\\\\\\".*)?$\");\r\n for (let i = 0; i < rows.length; i++) {\r\n if (reg.exec(rows[i].trim())) {\r\n const column = rows[i].indexOf(\")\") >= 0 ? rows[i].indexOf(\")\") + 1 : rows[i].indexOf(\".\") + 1;\r\n const position = new position_1.Position(i + 1, column);\r\n // merge punc into previous row\r\n let rowContent = rows[i].trim();\r\n // if reported row contains a paranthesis, prefix with space if needed\r\n if (rowContent.length > 1 && !rows[i - 1].endsWith(\" \") && !rows[i - 1].endsWith(\" \\r\")) {\r\n rowContent = \" \" + rowContent;\r\n }\r\n let offset = 0;\r\n if (rows[i - 1].endsWith(\"\\r\")) {\r\n offset = -1;\r\n }\r\n const startPos = new position_1.Position(i, rows[i - 1].length + 1 + offset);\r\n const endPos = new position_1.Position(i + 1, rows[i].length + 1);\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, startPos, endPos, rowContent);\r\n const issue = issue_1.Issue.atPosition(file, position, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.LineOnlyPunc = LineOnlyPunc;\r\n//# sourceMappingURL=line_only_punc.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/line_only_punc.js?");
|
|
12516
12516
|
|
|
12517
12517
|
/***/ }),
|
|
12518
12518
|
|
|
@@ -12545,7 +12545,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12545
12545
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12546
12546
|
|
|
12547
12547
|
"use strict";
|
|
12548
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LocalVariableNames = exports.LocalVariableNamesConf = void 0;\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 Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/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 Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.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 name_validator_1 = __webpack_require__(/*! ../utils/name_validator */ \"./node_modules/@abaplint/core/build/src/utils/name_validator.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass LocalVariableNamesConf extends _naming_rule_config_1.NamingRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** The pattern for local variable names */\r\n this.expectedData = \"^L._.+$\";\r\n /** The pattern for local constant names */\r\n this.expectedConstant = \"^LC_.+$\";\r\n /** The pattern for field symbol names */\r\n this.expectedFS = \"^<L._.+>$\";\r\n }\r\n}\r\nexports.LocalVariableNamesConf = LocalVariableNamesConf;\r\nclass LocalVariableNames extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new LocalVariableNamesConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"local_variable_names\",\r\n title: \"Local variable naming conventions\",\r\n shortDescription: `\nAllows you to enforce a pattern, such as a prefix, for local variables, constants and field symbols.\nRegexes are case-insensitive.`,\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 \"Local variable name does not match pattern \" + expected + \": \" + actual :\r\n \"Local 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 ret = [];\r\n if (this.conf.patternKind === undefined) {\r\n this.conf.patternKind = \"required\";\r\n }\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return [];\r\n }\r\n // inside METHOD, FORM, FUNCTION MODULE\r\n for (const node of stru.findAllStructures(Structures.Form)) {\r\n ret.push(...this.checkLocals(node, file));\r\n }\r\n for (const node of stru.findAllStructures(Structures.Method)) {\r\n ret.push(...this.checkLocals(node, file));\r\n }\r\n for (const node of stru.findAllStructures(Structures.FunctionModule)) {\r\n ret.push(...this.checkLocals(node, file));\r\n }\r\n return ret;\r\n }\r\n checkLocals(structure, file) {\r\n let ret = [];\r\n // data, field symbols\r\n for (const dat of structure.findAllStatements(Statements.Data)) {\r\n const parent = structure.findParent(dat);\r\n if (parent && parent.get() instanceof Structures.Data) {\r\n continue; // inside DATA BEGIN OF\r\n }\r\n const found = dat.findFirstExpression(Expressions.DefinitionName);\r\n if (found) {\r\n const token = found.getFirstToken();\r\n ret = ret.concat(this.checkName(token, file, this.conf.expectedData));\r\n }\r\n }\r\n // inline data\r\n for (const dat of structure.findAllExpressions(Expressions.InlineData)) {\r\n const found = dat.findFirstExpression(Expressions.TargetField);\r\n if (found) {\r\n const token = found.getFirstToken();\r\n ret = ret.concat(this.checkName(token, file, this.conf.expectedData));\r\n }\r\n }\r\n // data structures, data begin of, first level\r\n const dataStructures = structure.findAllStructures(Structures.Data);\r\n for (const struc of dataStructures) {\r\n // ignore nested DATA BEGIN\r\n const stat = struc.findFirstStatement(Statements.DataBegin);\r\n const found = stat === null || stat === void 0 ? void 0 : stat.findFirstExpression(Expressions.DefinitionName);\r\n if (found) {\r\n const token = found.getFirstToken();\r\n ret = ret.concat(this.checkName(token, file, this.conf.expectedData));\r\n }\r\n }\r\n for (const fieldsymbol of structure.findAllStatements(Statements.FieldSymbol)) {\r\n const found = fieldsymbol.findFirstExpression(Expressions.FieldSymbol);\r\n if (found) {\r\n const token = found.getFirstToken();\r\n ret = ret.concat(this.checkName(token, file, this.conf.expectedFS));\r\n }\r\n }\r\n // inline field symbols\r\n for (const fieldsymbol of structure.findAllExpressions(Expressions.InlineFS)) {\r\n const found = fieldsymbol.findFirstExpression(Expressions.TargetFieldSymbol);\r\n if (found) {\r\n const token = found.getFirstToken();\r\n ret = ret.concat(this.checkName(token, file, this.conf.expectedFS));\r\n }\r\n }\r\n const constants = structure.findAllStatements(Statements.Constant);\r\n for (const constant of constants) {\r\n const parent = structure.findParent(constant);\r\n if (parent && parent.get() instanceof Structures.Constants) {\r\n continue; // inside DATA BEGIN OF\r\n }\r\n const found = constant.findFirstExpression(Expressions.DefinitionName);\r\n if (found) {\r\n const token = found.getFirstToken();\r\n ret = ret.concat(this.checkName(token, file, this.conf.expectedConstant));\r\n }\r\n }\r\n return ret;\r\n }\r\n checkName(token, file, expected) {\r\n const ret = [];\r\n const regex = new RegExp(expected, \"i\");\r\n const name = token.getStr();\r\n if (name_validator_1.NameValidator.violatesRule(name, regex, this.conf)) {\r\n const message = this.getDescription(expected, name);\r\n const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity);\r\n ret.push(issue);\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.LocalVariableNames = LocalVariableNames;\r\n//# sourceMappingURL=local_variable_names.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/local_variable_names.js?");
|
|
12548
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.LocalVariableNames = exports.LocalVariableNamesConf = void 0;\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 Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/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 Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.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 name_validator_1 = __webpack_require__(/*! ../utils/name_validator */ \"./node_modules/@abaplint/core/build/src/utils/name_validator.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass LocalVariableNamesConf extends _naming_rule_config_1.NamingRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** The pattern for local variable names */\r\n this.expectedData = \"^L._.+$\";\r\n /** The pattern for local constant names */\r\n this.expectedConstant = \"^LC_.+$\";\r\n /** The pattern for field symbol names */\r\n this.expectedFS = \"^<L._.+>$\";\r\n }\r\n}\r\nexports.LocalVariableNamesConf = LocalVariableNamesConf;\r\nclass LocalVariableNames extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new LocalVariableNamesConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"local_variable_names\",\r\n title: \"Local variable naming conventions\",\r\n shortDescription: `\r\nAllows you to enforce a pattern, such as a prefix, for local variables, constants and field symbols.\r\nRegexes are case-insensitive.`,\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 \"Local variable name does not match pattern \" + expected + \": \" + actual :\r\n \"Local 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 ret = [];\r\n if (this.conf.patternKind === undefined) {\r\n this.conf.patternKind = \"required\";\r\n }\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return [];\r\n }\r\n // inside METHOD, FORM, FUNCTION MODULE\r\n for (const node of stru.findAllStructures(Structures.Form)) {\r\n ret.push(...this.checkLocals(node, file));\r\n }\r\n for (const node of stru.findAllStructures(Structures.Method)) {\r\n ret.push(...this.checkLocals(node, file));\r\n }\r\n for (const node of stru.findAllStructures(Structures.FunctionModule)) {\r\n ret.push(...this.checkLocals(node, file));\r\n }\r\n return ret;\r\n }\r\n checkLocals(structure, file) {\r\n let ret = [];\r\n // data, field symbols\r\n for (const dat of structure.findAllStatements(Statements.Data)) {\r\n const parent = structure.findParent(dat);\r\n if (parent && parent.get() instanceof Structures.Data) {\r\n continue; // inside DATA BEGIN OF\r\n }\r\n const found = dat.findFirstExpression(Expressions.DefinitionName);\r\n if (found) {\r\n const token = found.getFirstToken();\r\n ret = ret.concat(this.checkName(token, file, this.conf.expectedData));\r\n }\r\n }\r\n // inline data\r\n for (const dat of structure.findAllExpressions(Expressions.InlineData)) {\r\n const found = dat.findFirstExpression(Expressions.TargetField);\r\n if (found) {\r\n const token = found.getFirstToken();\r\n ret = ret.concat(this.checkName(token, file, this.conf.expectedData));\r\n }\r\n }\r\n // data structures, data begin of, first level\r\n const dataStructures = structure.findAllStructures(Structures.Data);\r\n for (const struc of dataStructures) {\r\n // ignore nested DATA BEGIN\r\n const stat = struc.findFirstStatement(Statements.DataBegin);\r\n const found = stat === null || stat === void 0 ? void 0 : stat.findFirstExpression(Expressions.DefinitionName);\r\n if (found) {\r\n const token = found.getFirstToken();\r\n ret = ret.concat(this.checkName(token, file, this.conf.expectedData));\r\n }\r\n }\r\n for (const fieldsymbol of structure.findAllStatements(Statements.FieldSymbol)) {\r\n const found = fieldsymbol.findFirstExpression(Expressions.FieldSymbol);\r\n if (found) {\r\n const token = found.getFirstToken();\r\n ret = ret.concat(this.checkName(token, file, this.conf.expectedFS));\r\n }\r\n }\r\n // inline field symbols\r\n for (const fieldsymbol of structure.findAllExpressions(Expressions.InlineFS)) {\r\n const found = fieldsymbol.findFirstExpression(Expressions.TargetFieldSymbol);\r\n if (found) {\r\n const token = found.getFirstToken();\r\n ret = ret.concat(this.checkName(token, file, this.conf.expectedFS));\r\n }\r\n }\r\n const constants = structure.findAllStatements(Statements.Constant);\r\n for (const constant of constants) {\r\n const parent = structure.findParent(constant);\r\n if (parent && parent.get() instanceof Structures.Constants) {\r\n continue; // inside DATA BEGIN OF\r\n }\r\n const found = constant.findFirstExpression(Expressions.DefinitionName);\r\n if (found) {\r\n const token = found.getFirstToken();\r\n ret = ret.concat(this.checkName(token, file, this.conf.expectedConstant));\r\n }\r\n }\r\n return ret;\r\n }\r\n checkName(token, file, expected) {\r\n const ret = [];\r\n const regex = new RegExp(expected, \"i\");\r\n const name = token.getStr();\r\n if (name_validator_1.NameValidator.violatesRule(name, regex, this.conf)) {\r\n const message = this.getDescription(expected, name);\r\n const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity);\r\n ret.push(issue);\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.LocalVariableNames = LocalVariableNames;\r\n//# sourceMappingURL=local_variable_names.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/local_variable_names.js?");
|
|
12549
12549
|
|
|
12550
12550
|
/***/ }),
|
|
12551
12551
|
|
|
@@ -12556,7 +12556,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12556
12556
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12557
12557
|
|
|
12558
12558
|
"use strict";
|
|
12559
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MainFileContents = exports.MainFileContentsConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 Objects = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\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 position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nclass MainFileContentsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.MainFileContentsConf = MainFileContentsConf;\r\nclass MainFileContents {\r\n constructor() {\r\n this.conf = new MainFileContentsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"main_file_contents\",\r\n title: \"Main file contents\",\r\n shortDescription: `Checks related to report declarations.`,\r\n extendedInformation: `Does not run if the target version is Cloud\n\n* PROGs must begin with \"REPORT <name>.\" or \"PROGRAM <name>.\n* TYPEs must begin with \"TYPE-POOL <name>.\"\n`,\r\n };\r\n }\r\n getDescription(details) {\r\n return \"Main file must have specific contents: \" + details;\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 initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof _abap_object_1.ABAPObject)\r\n || this.reg.getConfig().getVersion() === version_1.Version.Cloud) {\r\n return [];\r\n }\r\n const main = obj.getMainABAPFile();\r\n if (main === undefined) {\r\n return [];\r\n }\r\n const stru = main.getStructure();\r\n if (stru === undefined) {\r\n return [];\r\n }\r\n if (obj instanceof Objects.Program && obj.isInclude() === false) {\r\n let count = 0;\r\n let first = main.getStatements()[count];\r\n while (first !== undefined && first.get() instanceof _statement_1.Comment) {\r\n count = count + 1;\r\n first = main.getStatements()[count];\r\n }\r\n if (first === undefined || !(first.get() instanceof Statements.Report\r\n || first.get() instanceof Statements.Program)) {\r\n const position = new position_1.Position(1, 1);\r\n const issue = issue_1.Issue.atPosition(main, position, this.getDescription(\"Report must begin with REPORT or PROGRAM\"), this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n const name = first.findFirstExpression(Expressions.ReportName);\r\n if (name === undefined) {\r\n const token = first.getFirstToken();\r\n const issue = issue_1.Issue.atToken(main, token, this.getDescription(\"Add report name to REPORT or PROGRAM statement\"), this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n else if (name.getFirstToken().getStr().toUpperCase() !== obj.getName()) {\r\n const token = name.getFirstToken();\r\n const issue = issue_1.Issue.atToken(main, token, this.getDescription(\"REPORT or PROGRAM name must match filename\"), this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n }\r\n else if (obj instanceof Objects.TypePool) {\r\n let count = 0;\r\n let first = main.getStatements()[count];\r\n while (first !== undefined && first.get() instanceof _statement_1.Comment) {\r\n count = count + 1;\r\n first = main.getStatements()[count];\r\n }\r\n if (first === undefined || !(first.get() instanceof Statements.TypePool)) {\r\n const position = new position_1.Position(1, 1);\r\n const issue = issue_1.Issue.atPosition(main, position, this.getDescription(\"Type pool must begin with TYPE-POOL\"), this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n const name = first.getChildren()[3];\r\n if (name.getFirstToken().getStr().toUpperCase() !== obj.getName()) {\r\n const token = name.getFirstToken();\r\n const issue = issue_1.Issue.atToken(main, token, this.getDescription(\"TYPE-POOL name must match filename\"), this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n }\r\n return [];\r\n }\r\n}\r\nexports.MainFileContents = MainFileContents;\r\n//# sourceMappingURL=main_file_contents.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/main_file_contents.js?");
|
|
12559
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MainFileContents = exports.MainFileContentsConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 Objects = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\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 position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nclass MainFileContentsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.MainFileContentsConf = MainFileContentsConf;\r\nclass MainFileContents {\r\n constructor() {\r\n this.conf = new MainFileContentsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"main_file_contents\",\r\n title: \"Main file contents\",\r\n shortDescription: `Checks related to report declarations.`,\r\n extendedInformation: `Does not run if the target version is Cloud\r\n\r\n* PROGs must begin with \"REPORT <name>.\" or \"PROGRAM <name>.\r\n* TYPEs must begin with \"TYPE-POOL <name>.\"\r\n`,\r\n };\r\n }\r\n getDescription(details) {\r\n return \"Main file must have specific contents: \" + details;\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 initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof _abap_object_1.ABAPObject)\r\n || this.reg.getConfig().getVersion() === version_1.Version.Cloud) {\r\n return [];\r\n }\r\n const main = obj.getMainABAPFile();\r\n if (main === undefined) {\r\n return [];\r\n }\r\n const stru = main.getStructure();\r\n if (stru === undefined) {\r\n return [];\r\n }\r\n if (obj instanceof Objects.Program && obj.isInclude() === false) {\r\n let count = 0;\r\n let first = main.getStatements()[count];\r\n while (first !== undefined && first.get() instanceof _statement_1.Comment) {\r\n count = count + 1;\r\n first = main.getStatements()[count];\r\n }\r\n if (first === undefined || !(first.get() instanceof Statements.Report\r\n || first.get() instanceof Statements.Program)) {\r\n const position = new position_1.Position(1, 1);\r\n const issue = issue_1.Issue.atPosition(main, position, this.getDescription(\"Report must begin with REPORT or PROGRAM\"), this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n const name = first.findFirstExpression(Expressions.ReportName);\r\n if (name === undefined) {\r\n const token = first.getFirstToken();\r\n const issue = issue_1.Issue.atToken(main, token, this.getDescription(\"Add report name to REPORT or PROGRAM statement\"), this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n else if (name.getFirstToken().getStr().toUpperCase() !== obj.getName()) {\r\n const token = name.getFirstToken();\r\n const issue = issue_1.Issue.atToken(main, token, this.getDescription(\"REPORT or PROGRAM name must match filename\"), this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n }\r\n else if (obj instanceof Objects.TypePool) {\r\n let count = 0;\r\n let first = main.getStatements()[count];\r\n while (first !== undefined && first.get() instanceof _statement_1.Comment) {\r\n count = count + 1;\r\n first = main.getStatements()[count];\r\n }\r\n if (first === undefined || !(first.get() instanceof Statements.TypePool)) {\r\n const position = new position_1.Position(1, 1);\r\n const issue = issue_1.Issue.atPosition(main, position, this.getDescription(\"Type pool must begin with TYPE-POOL\"), this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n const name = first.getChildren()[3];\r\n if (name.getFirstToken().getStr().toUpperCase() !== obj.getName()) {\r\n const token = name.getFirstToken();\r\n const issue = issue_1.Issue.atToken(main, token, this.getDescription(\"TYPE-POOL name must match filename\"), this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n }\r\n return [];\r\n }\r\n}\r\nexports.MainFileContents = MainFileContents;\r\n//# sourceMappingURL=main_file_contents.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/main_file_contents.js?");
|
|
12560
12560
|
|
|
12561
12561
|
/***/ }),
|
|
12562
12562
|
|
|
@@ -12567,7 +12567,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12567
12567
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12568
12568
|
|
|
12569
12569
|
"use strict";
|
|
12570
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ManyParentheses = exports.ManyParenthesesConf = 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 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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass ManyParenthesesConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.ManyParenthesesConf = ManyParenthesesConf;\r\nclass ManyParentheses extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ManyParenthesesConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"many_parentheses\",\r\n title: \"Too many parentheses\",\r\n shortDescription: `Searches for expressions where extra parentheses can safely be removed`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],\r\n badExample: `\nIF ( destination IS INITIAL ).\nENDIF.\nIF foo = boo AND ( bar = lar AND moo = loo ).\nENDIF.\n`,\r\n goodExample: `\nIF destination IS INITIAL.\nENDIF.\nIF foo = boo AND bar = lar AND moo = loo.\nENDIF.\n`,\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 const issues = [];\r\n const structure = file.getStructure();\r\n if (structure === undefined) {\r\n return [];\r\n }\r\n for (const cond of structure.findAllExpressionsMulti([Expressions.Cond, Expressions.ComponentCond])) {\r\n issues.push(...this.analyze(file, cond));\r\n }\r\n for (const sub of structure.findAllExpressionsMulti([Expressions.CondSub, Expressions.ComponentCondSub])) {\r\n let cond = [];\r\n if (sub.get() instanceof Expressions.CondSub) {\r\n cond = sub.findDirectExpressions(Expressions.Cond);\r\n }\r\n else {\r\n cond = sub.findDirectExpressions(Expressions.ComponentCond);\r\n }\r\n if (cond.length !== 1) {\r\n continue;\r\n }\r\n if (cond[0].getChildren().length === 1) {\r\n const message = \"Too many parentheses, simple\";\r\n const fixText = sub.getChildren()[1].concatTokens();\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, sub.getFirstToken().getStart(), sub.getLastToken().getEnd(), fixText);\r\n const issue = issue_1.Issue.atToken(file, sub.getFirstToken(), message, this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n }\r\n for (const m of structure.findAllStatements(Statements.Move)) {\r\n issues.push(...this.analyzeMove(file, m));\r\n }\r\n for (const m of structure.findAllStatements(Statements.Select)) {\r\n issues.push(...this.analyzeInto(file, m));\r\n }\r\n return issues;\r\n }\r\n ////////////////////\r\n analyzeInto(file, m) {\r\n const into = m.findFirstExpression(Expressions.SQLIntoStructure);\r\n if (into === undefined) {\r\n return [];\r\n }\r\n const second = into.getAllTokens()[1];\r\n if (second === undefined || second.getStr() !== \"(\") {\r\n return [];\r\n }\r\n const concat = into.concatTokens();\r\n if (concat.endsWith(\")\") === true && concat.includes(\",\") === false) {\r\n const issue = issue_1.Issue.atStatement(file, m, \"Too many parentheses\", this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n return [];\r\n }\r\n analyzeMove(file, m) {\r\n const issues = [];\r\n const children = m.getChildren();\r\n const last = children[children.length - 2];\r\n const lastChildren = last.getChildren();\r\n if (lastChildren.length === 3\r\n && lastChildren[0].getFirstToken().getStr() === \"(\"\r\n && lastChildren[2].getFirstToken().getStr() === \")\") {\r\n const issue = issue_1.Issue.atToken(file, last.getFirstToken(), \"Too many parentheses\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n return issues;\r\n }\r\n analyze(file, cond) {\r\n const issues = [];\r\n let comparator = \"\";\r\n let found = false;\r\n for (const c of cond.getChildren()) {\r\n let current = \"\";\r\n if (c instanceof nodes_1.TokenNode) {\r\n current = c.get().getStr().toUpperCase();\r\n }\r\n else if (c instanceof nodes_1.ExpressionNode\r\n && (c.get() instanceof Expressions.CondSub || c.get() instanceof Expressions.ComponentCondSub)) {\r\n if (c.getFirstToken().getStr().toUpperCase() === \"NOT\") {\r\n return [];\r\n }\r\n let i = c.findDirectExpression(Expressions.Cond);\r\n if (i === undefined) {\r\n i = c.findDirectExpression(Expressions.ComponentCond);\r\n }\r\n if (i === undefined) {\r\n return [];\r\n }\r\n current = this.findComparator(i);\r\n if (current !== \"\") {\r\n found = true; // dont report for the simple case that contains quick fixes\r\n }\r\n }\r\n if (comparator === \"\") {\r\n comparator = current;\r\n }\r\n else if (comparator !== \"\" && current !== \"\" && comparator !== current) {\r\n return [];\r\n }\r\n }\r\n if (comparator !== \"\" && comparator !== \"MIXED\" && found === true) {\r\n const message = \"Too many parentheses, complex\";\r\n const issue = issue_1.Issue.atToken(file, cond.getFirstToken(), message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n return issues;\r\n }\r\n findComparator(cond) {\r\n let comparator = \"\";\r\n const children = cond.getChildren();\r\n for (const c of children) {\r\n if (c instanceof nodes_1.TokenNode) {\r\n const current = c.get().getStr().toUpperCase();\r\n if (comparator === \"\") {\r\n comparator = current;\r\n }\r\n else if (current !== comparator) {\r\n return \"MIXED\";\r\n }\r\n }\r\n }\r\n return comparator;\r\n }\r\n}\r\nexports.ManyParentheses = ManyParentheses;\r\n//# sourceMappingURL=many_parentheses.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/many_parentheses.js?");
|
|
12570
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ManyParentheses = exports.ManyParenthesesConf = 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 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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/index.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass ManyParenthesesConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.ManyParenthesesConf = ManyParenthesesConf;\r\nclass ManyParentheses extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ManyParenthesesConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"many_parentheses\",\r\n title: \"Too many parentheses\",\r\n shortDescription: `Searches for expressions where extra parentheses can safely be removed`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],\r\n badExample: `\r\nIF ( destination IS INITIAL ).\r\nENDIF.\r\nIF foo = boo AND ( bar = lar AND moo = loo ).\r\nENDIF.\r\n`,\r\n goodExample: `\r\nIF destination IS INITIAL.\r\nENDIF.\r\nIF foo = boo AND bar = lar AND moo = loo.\r\nENDIF.\r\n`,\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 const issues = [];\r\n const structure = file.getStructure();\r\n if (structure === undefined) {\r\n return [];\r\n }\r\n for (const cond of structure.findAllExpressionsMulti([Expressions.Cond, Expressions.ComponentCond])) {\r\n issues.push(...this.analyze(file, cond));\r\n }\r\n for (const sub of structure.findAllExpressionsMulti([Expressions.CondSub, Expressions.ComponentCondSub])) {\r\n let cond = [];\r\n if (sub.get() instanceof Expressions.CondSub) {\r\n cond = sub.findDirectExpressions(Expressions.Cond);\r\n }\r\n else {\r\n cond = sub.findDirectExpressions(Expressions.ComponentCond);\r\n }\r\n if (cond.length !== 1) {\r\n continue;\r\n }\r\n if (cond[0].getChildren().length === 1) {\r\n const message = \"Too many parentheses, simple\";\r\n const fixText = sub.getChildren()[1].concatTokens();\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, sub.getFirstToken().getStart(), sub.getLastToken().getEnd(), fixText);\r\n const issue = issue_1.Issue.atToken(file, sub.getFirstToken(), message, this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n }\r\n for (const m of structure.findAllStatements(Statements.Move)) {\r\n issues.push(...this.analyzeMove(file, m));\r\n }\r\n for (const m of structure.findAllStatements(Statements.Select)) {\r\n issues.push(...this.analyzeInto(file, m));\r\n }\r\n return issues;\r\n }\r\n ////////////////////\r\n analyzeInto(file, m) {\r\n const into = m.findFirstExpression(Expressions.SQLIntoStructure);\r\n if (into === undefined) {\r\n return [];\r\n }\r\n const second = into.getAllTokens()[1];\r\n if (second === undefined || second.getStr() !== \"(\") {\r\n return [];\r\n }\r\n const concat = into.concatTokens();\r\n if (concat.endsWith(\")\") === true && concat.includes(\",\") === false) {\r\n const issue = issue_1.Issue.atStatement(file, m, \"Too many parentheses\", this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n return [];\r\n }\r\n analyzeMove(file, m) {\r\n const issues = [];\r\n const children = m.getChildren();\r\n const last = children[children.length - 2];\r\n const lastChildren = last.getChildren();\r\n if (lastChildren.length === 3\r\n && lastChildren[0].getFirstToken().getStr() === \"(\"\r\n && lastChildren[2].getFirstToken().getStr() === \")\") {\r\n const issue = issue_1.Issue.atToken(file, last.getFirstToken(), \"Too many parentheses\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n return issues;\r\n }\r\n analyze(file, cond) {\r\n const issues = [];\r\n let comparator = \"\";\r\n let found = false;\r\n for (const c of cond.getChildren()) {\r\n let current = \"\";\r\n if (c instanceof nodes_1.TokenNode) {\r\n current = c.get().getStr().toUpperCase();\r\n }\r\n else if (c instanceof nodes_1.ExpressionNode\r\n && (c.get() instanceof Expressions.CondSub || c.get() instanceof Expressions.ComponentCondSub)) {\r\n if (c.getFirstToken().getStr().toUpperCase() === \"NOT\") {\r\n return [];\r\n }\r\n let i = c.findDirectExpression(Expressions.Cond);\r\n if (i === undefined) {\r\n i = c.findDirectExpression(Expressions.ComponentCond);\r\n }\r\n if (i === undefined) {\r\n return [];\r\n }\r\n current = this.findComparator(i);\r\n if (current !== \"\") {\r\n found = true; // dont report for the simple case that contains quick fixes\r\n }\r\n }\r\n if (comparator === \"\") {\r\n comparator = current;\r\n }\r\n else if (comparator !== \"\" && current !== \"\" && comparator !== current) {\r\n return [];\r\n }\r\n }\r\n if (comparator !== \"\" && comparator !== \"MIXED\" && found === true) {\r\n const message = \"Too many parentheses, complex\";\r\n const issue = issue_1.Issue.atToken(file, cond.getFirstToken(), message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n return issues;\r\n }\r\n findComparator(cond) {\r\n let comparator = \"\";\r\n const children = cond.getChildren();\r\n for (const c of children) {\r\n if (c instanceof nodes_1.TokenNode) {\r\n const current = c.get().getStr().toUpperCase();\r\n if (comparator === \"\") {\r\n comparator = current;\r\n }\r\n else if (current !== comparator) {\r\n return \"MIXED\";\r\n }\r\n }\r\n }\r\n return comparator;\r\n }\r\n}\r\nexports.ManyParentheses = ManyParentheses;\r\n//# sourceMappingURL=many_parentheses.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/many_parentheses.js?");
|
|
12571
12571
|
|
|
12572
12572
|
/***/ }),
|
|
12573
12573
|
|
|
@@ -12578,7 +12578,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12578
12578
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12579
12579
|
|
|
12580
12580
|
"use strict";
|
|
12581
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MaxOneMethodParameterPerLine = exports.MaxOneMethodParameterPerLineConf = 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 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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass MaxOneMethodParameterPerLineConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.MaxOneMethodParameterPerLineConf = MaxOneMethodParameterPerLineConf;\r\nclass MaxOneMethodParameterPerLine extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new MaxOneMethodParameterPerLineConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"max_one_method_parameter_per_line\",\r\n title: \"Max one method parameter definition per line\",\r\n shortDescription: `Keep max one method parameter description per line`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace],\r\n badExample: `\nMETHODS apps_scope_token\n IMPORTING\n body TYPE bodyapps_scope_token client_id TYPE str.`,\r\n goodExample: `\nMETHODS apps_scope_token\n IMPORTING\n body TYPE bodyapps_scope_token\n client_id TYPE str.`,\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;\r\n const issues = [];\r\n for (const statement of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllStatements(Statements.MethodDef)) || []) {\r\n let prev = undefined;\r\n for (const p of statement.findAllExpressions(Expressions.MethodParam)) {\r\n if (prev === undefined) {\r\n prev = p;\r\n continue;\r\n }\r\n if (prev.getFirstToken().getStart().getRow() === p.getFirstToken().getStart().getRow()) {\r\n const issue = issue_1.Issue.atToken(file, prev.getFirstToken(), this.getMetadata().title, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n prev = p;\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.MaxOneMethodParameterPerLine = MaxOneMethodParameterPerLine;\r\n//# sourceMappingURL=max_one_method_parameter_per_line.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/max_one_method_parameter_per_line.js?");
|
|
12581
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MaxOneMethodParameterPerLine = exports.MaxOneMethodParameterPerLineConf = 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 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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass MaxOneMethodParameterPerLineConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.MaxOneMethodParameterPerLineConf = MaxOneMethodParameterPerLineConf;\r\nclass MaxOneMethodParameterPerLine extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new MaxOneMethodParameterPerLineConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"max_one_method_parameter_per_line\",\r\n title: \"Max one method parameter definition per line\",\r\n shortDescription: `Keep max one method parameter description per line`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Whitespace],\r\n badExample: `\r\nMETHODS apps_scope_token\r\n IMPORTING\r\n body TYPE bodyapps_scope_token client_id TYPE str.`,\r\n goodExample: `\r\nMETHODS apps_scope_token\r\n IMPORTING\r\n body TYPE bodyapps_scope_token\r\n client_id TYPE str.`,\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;\r\n const issues = [];\r\n for (const statement of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllStatements(Statements.MethodDef)) || []) {\r\n let prev = undefined;\r\n for (const p of statement.findAllExpressions(Expressions.MethodParam)) {\r\n if (prev === undefined) {\r\n prev = p;\r\n continue;\r\n }\r\n if (prev.getFirstToken().getStart().getRow() === p.getFirstToken().getStart().getRow()) {\r\n const issue = issue_1.Issue.atToken(file, prev.getFirstToken(), this.getMetadata().title, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n prev = p;\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.MaxOneMethodParameterPerLine = MaxOneMethodParameterPerLine;\r\n//# sourceMappingURL=max_one_method_parameter_per_line.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/max_one_method_parameter_per_line.js?");
|
|
12582
12582
|
|
|
12583
12583
|
/***/ }),
|
|
12584
12584
|
|
|
@@ -12589,7 +12589,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12589
12589
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12590
12590
|
|
|
12591
12591
|
"use strict";
|
|
12592
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MaxOneStatement = exports.MaxOneStatementConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.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 edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass MaxOneStatementConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.MaxOneStatementConf = MaxOneStatementConf;\r\nclass MaxOneStatement extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new MaxOneStatementConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"max_one_statement\",\r\n title: \"Max one statement per line\",\r\n shortDescription: `Checks that each line contains only a single statement.`,\r\n extendedInformation: `Does not report empty statements, use rule empty_statement for detecting empty statements.\n\nDoes not report anything for chained statements.\n\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#no-more-than-one-statement-per-line\nhttps://docs.abapopenchecks.org/checks/11/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n badExample: `WRITE foo. WRITE bar.`,\r\n goodExample: `WRITE foo.\\nWRITE bar.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"Only one statement is allowed per line\";\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 let prev = 0;\r\n let reported = 0;\r\n for (const statement of file.getStatements()) {\r\n const term = statement.getTerminator();\r\n if (statement.get() instanceof _statement_1.Comment\r\n || statement.get() instanceof _statement_1.NativeSQL\r\n || term === \",\") {\r\n continue;\r\n }\r\n const pos = statement.getStart();\r\n if (pos instanceof position_1.VirtualPosition) {\r\n continue;\r\n }\r\n const row = pos.getRow();\r\n if (prev === row && row !== reported && statement.getFirstToken().getStr() !== \".\") {\r\n const fix = edit_helper_1.EditHelper.insertAt(file, pos, \"\\n\");\r\n const issue = issue_1.Issue.atPosition(file, pos, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n reported = row;\r\n }\r\n prev = row;\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.MaxOneStatement = MaxOneStatement;\r\n//# sourceMappingURL=max_one_statement.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/max_one_statement.js?");
|
|
12592
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MaxOneStatement = exports.MaxOneStatementConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.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 edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass MaxOneStatementConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.MaxOneStatementConf = MaxOneStatementConf;\r\nclass MaxOneStatement extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new MaxOneStatementConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"max_one_statement\",\r\n title: \"Max one statement per line\",\r\n shortDescription: `Checks that each line contains only a single statement.`,\r\n extendedInformation: `Does not report empty statements, use rule empty_statement for detecting empty statements.\r\n\r\nDoes not report anything for chained statements.\r\n\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#no-more-than-one-statement-per-line\r\nhttps://docs.abapopenchecks.org/checks/11/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n badExample: `WRITE foo. WRITE bar.`,\r\n goodExample: `WRITE foo.\\nWRITE bar.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"Only one statement is allowed per line\";\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 let prev = 0;\r\n let reported = 0;\r\n for (const statement of file.getStatements()) {\r\n const term = statement.getTerminator();\r\n if (statement.get() instanceof _statement_1.Comment\r\n || statement.get() instanceof _statement_1.NativeSQL\r\n || term === \",\") {\r\n continue;\r\n }\r\n const pos = statement.getStart();\r\n if (pos instanceof position_1.VirtualPosition) {\r\n continue;\r\n }\r\n const row = pos.getRow();\r\n if (prev === row && row !== reported && statement.getFirstToken().getStr() !== \".\") {\r\n const fix = edit_helper_1.EditHelper.insertAt(file, pos, \"\\n\");\r\n const issue = issue_1.Issue.atPosition(file, pos, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n reported = row;\r\n }\r\n prev = row;\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.MaxOneStatement = MaxOneStatement;\r\n//# sourceMappingURL=max_one_statement.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/max_one_statement.js?");
|
|
12593
12593
|
|
|
12594
12594
|
/***/ }),
|
|
12595
12595
|
|
|
@@ -12633,7 +12633,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12633
12633
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12634
12634
|
|
|
12635
12635
|
"use strict";
|
|
12636
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MethodOverwritesBuiltIn = exports.MethodOverwritesBuiltInConf = void 0;\r\nconst __1 = __webpack_require__(/*! .. */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst _builtin_1 = __webpack_require__(/*! ../abap/5_syntax/_builtin */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin.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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass MethodOverwritesBuiltInConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.MethodOverwritesBuiltInConf = MethodOverwritesBuiltInConf;\r\nclass MethodOverwritesBuiltIn extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new MethodOverwritesBuiltInConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"method_overwrites_builtin\",\r\n title: \"Method name overwrites builtin function\",\r\n shortDescription: `Checks Method names that overwrite builtin SAP functions`,\r\n extendedInformation: `https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abenbuilt_in_functions_overview.htm\n\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-obscuring-built-in-functions`,\r\n tags: [_irule_1.RuleTag.Naming, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide],\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 const issues = [];\r\n let methods = [];\r\n for (const classDef of file.getInfo().listClassDefinitions()) {\r\n methods = methods.concat(classDef.methods);\r\n }\r\n for (const intfDef of file.getInfo().listInterfaceDefinitions()) {\r\n methods = methods.concat(intfDef.methods);\r\n }\r\n const builtIn = new _builtin_1.BuiltIn();\r\n for (const method of methods) {\r\n if (builtIn.searchBuiltin(method.name.toUpperCase())) {\r\n const message = `Method name \"${method.name}\" overwrites built-in SAP function name`;\r\n issues.push(__1.Issue.atIdentifier(method.identifier, message, this.getMetadata().key));\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.MethodOverwritesBuiltIn = MethodOverwritesBuiltIn;\r\n//# sourceMappingURL=method_overwrites_builtin.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/method_overwrites_builtin.js?");
|
|
12636
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.MethodOverwritesBuiltIn = exports.MethodOverwritesBuiltInConf = void 0;\r\nconst __1 = __webpack_require__(/*! .. */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst _builtin_1 = __webpack_require__(/*! ../abap/5_syntax/_builtin */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin.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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass MethodOverwritesBuiltInConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.MethodOverwritesBuiltInConf = MethodOverwritesBuiltInConf;\r\nclass MethodOverwritesBuiltIn extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new MethodOverwritesBuiltInConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"method_overwrites_builtin\",\r\n title: \"Method name overwrites builtin function\",\r\n shortDescription: `Checks Method names that overwrite builtin SAP functions`,\r\n extendedInformation: `https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abenbuilt_in_functions_overview.htm\r\n\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-obscuring-built-in-functions`,\r\n tags: [_irule_1.RuleTag.Naming, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide],\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 const issues = [];\r\n let methods = [];\r\n for (const classDef of file.getInfo().listClassDefinitions()) {\r\n methods = methods.concat(classDef.methods);\r\n }\r\n for (const intfDef of file.getInfo().listInterfaceDefinitions()) {\r\n methods = methods.concat(intfDef.methods);\r\n }\r\n const builtIn = new _builtin_1.BuiltIn();\r\n for (const method of methods) {\r\n if (builtIn.searchBuiltin(method.name.toUpperCase())) {\r\n const message = `Method name \"${method.name}\" overwrites built-in SAP function name`;\r\n issues.push(__1.Issue.atIdentifier(method.identifier, message, this.getMetadata().key));\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.MethodOverwritesBuiltIn = MethodOverwritesBuiltIn;\r\n//# sourceMappingURL=method_overwrites_builtin.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/method_overwrites_builtin.js?");
|
|
12637
12637
|
|
|
12638
12638
|
/***/ }),
|
|
12639
12639
|
|
|
@@ -12699,7 +12699,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12699
12699
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12700
12700
|
|
|
12701
12701
|
"use strict";
|
|
12702
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Nesting = exports.NestingConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass NestingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Maximum allowed nesting depth */\r\n this.depth = 5;\r\n }\r\n}\r\nexports.NestingConf = NestingConf;\r\nclass Nesting extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new NestingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"nesting\",\r\n title: \"Check nesting depth\",\r\n shortDescription: `Checks for methods exceeding a maximum nesting depth`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#keep-the-nesting-depth-low\nhttps://docs.abapopenchecks.org/checks/74/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getDescription(max) {\r\n return \"Reduce nesting depth to max \" + max;\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 let depth = 0;\r\n for (const statement of file.getStatements()) {\r\n const type = statement.get();\r\n if (type instanceof Statements.If\r\n || type instanceof Statements.Case\r\n || type instanceof Statements.While\r\n || type instanceof Statements.Loop\r\n || type instanceof Statements.SelectLoop\r\n || type instanceof Statements.Do\r\n || type instanceof Statements.Try) {\r\n depth = depth + 1;\r\n }\r\n else if (type instanceof Statements.EndIf\r\n || type instanceof Statements.EndCase\r\n || type instanceof Statements.EndWhile\r\n || type instanceof Statements.EndLoop\r\n || type instanceof Statements.EndSelect\r\n || type instanceof Statements.EndDo\r\n || type instanceof Statements.EndTry) {\r\n depth = depth - 1;\r\n }\r\n if (depth > this.conf.depth) {\r\n const pos = statement.getFirstToken().getStart();\r\n const issue = issue_1.Issue.atPosition(file, pos, this.getDescription(this.conf.depth.toString()), this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n break; // only one finding per file\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.Nesting = Nesting;\r\n//# sourceMappingURL=nesting.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/nesting.js?");
|
|
12702
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Nesting = exports.NestingConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass NestingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Maximum allowed nesting depth */\r\n this.depth = 5;\r\n }\r\n}\r\nexports.NestingConf = NestingConf;\r\nclass Nesting extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new NestingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"nesting\",\r\n title: \"Check nesting depth\",\r\n shortDescription: `Checks for methods exceeding a maximum nesting depth`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#keep-the-nesting-depth-low\r\nhttps://docs.abapopenchecks.org/checks/74/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getDescription(max) {\r\n return \"Reduce nesting depth to max \" + max;\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 let depth = 0;\r\n for (const statement of file.getStatements()) {\r\n const type = statement.get();\r\n if (type instanceof Statements.If\r\n || type instanceof Statements.Case\r\n || type instanceof Statements.While\r\n || type instanceof Statements.Loop\r\n || type instanceof Statements.SelectLoop\r\n || type instanceof Statements.Do\r\n || type instanceof Statements.Try) {\r\n depth = depth + 1;\r\n }\r\n else if (type instanceof Statements.EndIf\r\n || type instanceof Statements.EndCase\r\n || type instanceof Statements.EndWhile\r\n || type instanceof Statements.EndLoop\r\n || type instanceof Statements.EndSelect\r\n || type instanceof Statements.EndDo\r\n || type instanceof Statements.EndTry) {\r\n depth = depth - 1;\r\n }\r\n if (depth > this.conf.depth) {\r\n const pos = statement.getFirstToken().getStart();\r\n const issue = issue_1.Issue.atPosition(file, pos, this.getDescription(this.conf.depth.toString()), this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n break; // only one finding per file\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.Nesting = Nesting;\r\n//# sourceMappingURL=nesting.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/nesting.js?");
|
|
12703
12703
|
|
|
12704
12704
|
/***/ }),
|
|
12705
12705
|
|
|
@@ -12732,7 +12732,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12732
12732
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12733
12733
|
|
|
12734
12734
|
"use strict";
|
|
12735
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.NoChainedAssignment = exports.NoChainedAssignmentConf = 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 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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass NoChainedAssignmentConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.NoChainedAssignmentConf = NoChainedAssignmentConf;\r\nclass NoChainedAssignment extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new NoChainedAssignmentConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"no_chained_assignment\",\r\n title: \"No chained assignment\",\r\n shortDescription: `Find chained assingments and reports issues`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#dont-chain-assignments`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide],\r\n badExample: `var1 = var2 = var3.`,\r\n goodExample: `var2 = var3.\nvar1 = var2.`,\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 const issues = [];\r\n for (const s of file.getStatements()) {\r\n if (!(s.get() instanceof Statements.Move)) {\r\n continue;\r\n }\r\n if (s.findDirectExpressions(Expressions.Target).length >= 2) {\r\n const message = \"No chained assignment\";\r\n const issue = issue_1.Issue.atStatement(file, s, message, this.getMetadata().key);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.NoChainedAssignment = NoChainedAssignment;\r\n//# sourceMappingURL=no_chained_assignment.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/no_chained_assignment.js?");
|
|
12735
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.NoChainedAssignment = exports.NoChainedAssignmentConf = 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 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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass NoChainedAssignmentConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.NoChainedAssignmentConf = NoChainedAssignmentConf;\r\nclass NoChainedAssignment extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new NoChainedAssignmentConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"no_chained_assignment\",\r\n title: \"No chained assignment\",\r\n shortDescription: `Find chained assingments and reports issues`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#dont-chain-assignments`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide],\r\n badExample: `var1 = var2 = var3.`,\r\n goodExample: `var2 = var3.\r\nvar1 = var2.`,\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 const issues = [];\r\n for (const s of file.getStatements()) {\r\n if (!(s.get() instanceof Statements.Move)) {\r\n continue;\r\n }\r\n if (s.findDirectExpressions(Expressions.Target).length >= 2) {\r\n const message = \"No chained assignment\";\r\n const issue = issue_1.Issue.atStatement(file, s, message, this.getMetadata().key);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.NoChainedAssignment = NoChainedAssignment;\r\n//# sourceMappingURL=no_chained_assignment.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/no_chained_assignment.js?");
|
|
12736
12736
|
|
|
12737
12737
|
/***/ }),
|
|
12738
12738
|
|
|
@@ -12743,7 +12743,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12743
12743
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12744
12744
|
|
|
12745
12745
|
"use strict";
|
|
12746
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.NoExternalFormCalls = exports.NoExternalFormCallsConf = 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 _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 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\nclass NoExternalFormCallsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.NoExternalFormCallsConf = NoExternalFormCallsConf;\r\nclass NoExternalFormCalls extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new NoExternalFormCallsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"no_external_form_calls\",\r\n title: \"No external FORM calls\",\r\n shortDescription: `Detect external form calls`,\r\n badExample: `PERFORM foo IN PROGRAM bar.\n\nPERFORM foo(bar).`,\r\n tags: [_irule_1.RuleTag.SingleFile],\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 const issues = [];\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return issues; // parser error\r\n }\r\n for (const p of stru.findAllStatements(Statements.Perform)) {\r\n if (p.findDirectExpression(Expressions.IncludeName) || p.findDirectTokenByText(\"PROGRAM\")) {\r\n const message = \"No external FORM calls\";\r\n issues.push(issue_1.Issue.atStatement(file, p, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.NoExternalFormCalls = NoExternalFormCalls;\r\n//# sourceMappingURL=no_external_form_calls.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/no_external_form_calls.js?");
|
|
12746
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.NoExternalFormCalls = exports.NoExternalFormCallsConf = 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 _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 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\nclass NoExternalFormCallsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.NoExternalFormCallsConf = NoExternalFormCallsConf;\r\nclass NoExternalFormCalls extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new NoExternalFormCallsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"no_external_form_calls\",\r\n title: \"No external FORM calls\",\r\n shortDescription: `Detect external form calls`,\r\n badExample: `PERFORM foo IN PROGRAM bar.\r\n\r\nPERFORM foo(bar).`,\r\n tags: [_irule_1.RuleTag.SingleFile],\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 const issues = [];\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return issues; // parser error\r\n }\r\n for (const p of stru.findAllStatements(Statements.Perform)) {\r\n if (p.findDirectExpression(Expressions.IncludeName) || p.findDirectTokenByText(\"PROGRAM\")) {\r\n const message = \"No external FORM calls\";\r\n issues.push(issue_1.Issue.atStatement(file, p, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.NoExternalFormCalls = NoExternalFormCalls;\r\n//# sourceMappingURL=no_external_form_calls.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/no_external_form_calls.js?");
|
|
12747
12747
|
|
|
12748
12748
|
/***/ }),
|
|
12749
12749
|
|
|
@@ -12754,7 +12754,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12754
12754
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12755
12755
|
|
|
12756
12756
|
"use strict";
|
|
12757
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.NoInlineInOptionalBranches = exports.NoInlineInOptionalBranchesConf = void 0;\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 Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/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 _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\nclass NoInlineInOptionalBranchesConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.NoInlineInOptionalBranchesConf = NoInlineInOptionalBranchesConf;\r\nclass NoInlineInOptionalBranches extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new NoInlineInOptionalBranchesConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"no_inline_in_optional_branches\",\r\n title: \"Don't declare inline in optional branches\",\r\n shortDescription: `Don't declare inline in optional branches`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#dont-declare-inline-in-optional-branches\n\nConsidered optional branches:\n* inside IF/ELSEIF/ELSE\n* inside LOOP\n* inside WHILE\n* inside CASE/WHEN, CASE TYPE OF\n* inside DO\n* inside SELECT loops\n\nNot considered optional branches:\n* TRY/CATCH/CLEANUP`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\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 const output = [];\r\n const version = this.reg.getConfig().getVersion();\r\n if (version === version_1.Version.v700\r\n || version === version_1.Version.v702\r\n || version === version_1.Version.OpenABAP) {\r\n return [];\r\n }\r\n const struc = file.getStructure();\r\n if (struc === undefined) {\r\n return []; // syntax error\r\n }\r\n const candidates = [\r\n ...struc.findAllStructures(Structures.If),\r\n ...struc.findAllStructures(Structures.Loop),\r\n ...struc.findAllStructures(Structures.While),\r\n ...struc.findAllStructures(Structures.Case),\r\n ...struc.findAllStructures(Structures.CaseType),\r\n ...struc.findAllStructures(Structures.Do),\r\n ...struc.findAllStructures(Structures.Select)\r\n ];\r\n for (const c of candidates) {\r\n const inline = c.findFirstExpression(Expressions.InlineData);\r\n if (inline) {\r\n const message = \"Don't declare inline in optional branches\";\r\n const issue = issue_1.Issue.atToken(file, inline.getFirstToken(), message, this.getMetadata().key, this.getConfig().severity);\r\n output.push(issue);\r\n }\r\n }\r\n return output;\r\n }\r\n}\r\nexports.NoInlineInOptionalBranches = NoInlineInOptionalBranches;\r\n//# sourceMappingURL=no_inline_in_optional_branches.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/no_inline_in_optional_branches.js?");
|
|
12757
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.NoInlineInOptionalBranches = exports.NoInlineInOptionalBranchesConf = void 0;\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 Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/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 _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\nclass NoInlineInOptionalBranchesConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.NoInlineInOptionalBranchesConf = NoInlineInOptionalBranchesConf;\r\nclass NoInlineInOptionalBranches extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new NoInlineInOptionalBranchesConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"no_inline_in_optional_branches\",\r\n title: \"Don't declare inline in optional branches\",\r\n shortDescription: `Don't declare inline in optional branches`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#dont-declare-inline-in-optional-branches\r\n\r\nConsidered optional branches:\r\n* inside IF/ELSEIF/ELSE\r\n* inside LOOP\r\n* inside WHILE\r\n* inside CASE/WHEN, CASE TYPE OF\r\n* inside DO\r\n* inside SELECT loops\r\n\r\nNot considered optional branches:\r\n* TRY/CATCH/CLEANUP`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\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 const output = [];\r\n const version = this.reg.getConfig().getVersion();\r\n if (version === version_1.Version.v700\r\n || version === version_1.Version.v702\r\n || version === version_1.Version.OpenABAP) {\r\n return [];\r\n }\r\n const struc = file.getStructure();\r\n if (struc === undefined) {\r\n return []; // syntax error\r\n }\r\n const candidates = [\r\n ...struc.findAllStructures(Structures.If),\r\n ...struc.findAllStructures(Structures.Loop),\r\n ...struc.findAllStructures(Structures.While),\r\n ...struc.findAllStructures(Structures.Case),\r\n ...struc.findAllStructures(Structures.CaseType),\r\n ...struc.findAllStructures(Structures.Do),\r\n ...struc.findAllStructures(Structures.Select)\r\n ];\r\n for (const c of candidates) {\r\n const inline = c.findFirstExpression(Expressions.InlineData);\r\n if (inline) {\r\n const message = \"Don't declare inline in optional branches\";\r\n const issue = issue_1.Issue.atToken(file, inline.getFirstToken(), message, this.getMetadata().key, this.getConfig().severity);\r\n output.push(issue);\r\n }\r\n }\r\n return output;\r\n }\r\n}\r\nexports.NoInlineInOptionalBranches = NoInlineInOptionalBranches;\r\n//# sourceMappingURL=no_inline_in_optional_branches.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/no_inline_in_optional_branches.js?");
|
|
12758
12758
|
|
|
12759
12759
|
/***/ }),
|
|
12760
12760
|
|
|
@@ -12765,7 +12765,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12765
12765
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12766
12766
|
|
|
12767
12767
|
"use strict";
|
|
12768
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.NoPublicAttributes = exports.NoPublicAttributesConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst visibility_1 = __webpack_require__(/*! ../abap/4_file_information/visibility */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js\");\r\nconst _abap_file_information_1 = __webpack_require__(/*! ../abap/4_file_information/_abap_file_information */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/_abap_file_information.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass NoPublicAttributesConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Allows public attributes, if they are declared as READ-ONLY. */\r\n this.allowReadOnly = false;\r\n /** Option to ignore test classes for this check. */\r\n this.ignoreTestClasses = false;\r\n }\r\n}\r\nexports.NoPublicAttributesConf = NoPublicAttributesConf;\r\nclass NoPublicAttributes extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new NoPublicAttributesConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"no_public_attributes\",\r\n title: \"No public attributes\",\r\n shortDescription: `Checks that classes and interfaces don't contain any public attributes.\nExceptions are excluded from this rule.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#members-private-by-default-protected-only-if-needed`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getDescription(name) {\r\n return \"Public attributes are not allowed, attribute \\\"\" + name + \"\\\"\";\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, obj) {\r\n this.file = file;\r\n const attributes = this.getAllPublicAttributes(obj);\r\n return this.findAllIssues(attributes);\r\n }\r\n getAllPublicAttributes(obj) {\r\n let attributes = [];\r\n attributes = attributes.concat(this.getAllPublicClassAttributes(obj));\r\n attributes = attributes.concat(this.getAllPublicInterfaceAttributes());\r\n return attributes;\r\n }\r\n getAllPublicClassAttributes(obj) {\r\n let attributes = [];\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n for (const classDef of this.file.getInfo().listClassDefinitions()) {\r\n if (ddic.isException(classDef, obj)) {\r\n continue;\r\n }\r\n attributes = attributes.concat(classDef.attributes.filter(a => a.visibility === visibility_1.Visibility.Public));\r\n }\r\n return attributes;\r\n }\r\n getAllPublicInterfaceAttributes() {\r\n let attributes = [];\r\n for (const interfaceDef of this.file.getInfo().listInterfaceDefinitions()) {\r\n attributes = attributes.concat(interfaceDef.attributes.filter(a => a.visibility === visibility_1.Visibility.Public));\r\n }\r\n return attributes;\r\n }\r\n findAllIssues(attributes) {\r\n const issues = [];\r\n for (const attr of attributes) {\r\n if (this.conf.allowReadOnly === true && attr.readOnly) {\r\n continue;\r\n }\r\n else if (attr.level === _abap_file_information_1.AttributeLevel.Constant) {\r\n continue;\r\n }\r\n else if ((this.conf.ignoreTestClasses === true)\r\n && this.file.getFilename().includes(\".testclasses.\")) {\r\n continue;\r\n }\r\n const issue = issue_1.Issue.atIdentifier(attr.identifier, this.getDescription(attr.name), this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.NoPublicAttributes = NoPublicAttributes;\r\n//# sourceMappingURL=no_public_attributes.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/no_public_attributes.js?");
|
|
12768
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.NoPublicAttributes = exports.NoPublicAttributesConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst visibility_1 = __webpack_require__(/*! ../abap/4_file_information/visibility */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js\");\r\nconst _abap_file_information_1 = __webpack_require__(/*! ../abap/4_file_information/_abap_file_information */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/_abap_file_information.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass NoPublicAttributesConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Allows public attributes, if they are declared as READ-ONLY. */\r\n this.allowReadOnly = false;\r\n /** Option to ignore test classes for this check. */\r\n this.ignoreTestClasses = false;\r\n }\r\n}\r\nexports.NoPublicAttributesConf = NoPublicAttributesConf;\r\nclass NoPublicAttributes extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new NoPublicAttributesConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"no_public_attributes\",\r\n title: \"No public attributes\",\r\n shortDescription: `Checks that classes and interfaces don't contain any public attributes.\r\nExceptions are excluded from this rule.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#members-private-by-default-protected-only-if-needed`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getDescription(name) {\r\n return \"Public attributes are not allowed, attribute \\\"\" + name + \"\\\"\";\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, obj) {\r\n this.file = file;\r\n const attributes = this.getAllPublicAttributes(obj);\r\n return this.findAllIssues(attributes);\r\n }\r\n getAllPublicAttributes(obj) {\r\n let attributes = [];\r\n attributes = attributes.concat(this.getAllPublicClassAttributes(obj));\r\n attributes = attributes.concat(this.getAllPublicInterfaceAttributes());\r\n return attributes;\r\n }\r\n getAllPublicClassAttributes(obj) {\r\n let attributes = [];\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n for (const classDef of this.file.getInfo().listClassDefinitions()) {\r\n if (ddic.isException(classDef, obj)) {\r\n continue;\r\n }\r\n attributes = attributes.concat(classDef.attributes.filter(a => a.visibility === visibility_1.Visibility.Public));\r\n }\r\n return attributes;\r\n }\r\n getAllPublicInterfaceAttributes() {\r\n let attributes = [];\r\n for (const interfaceDef of this.file.getInfo().listInterfaceDefinitions()) {\r\n attributes = attributes.concat(interfaceDef.attributes.filter(a => a.visibility === visibility_1.Visibility.Public));\r\n }\r\n return attributes;\r\n }\r\n findAllIssues(attributes) {\r\n const issues = [];\r\n for (const attr of attributes) {\r\n if (this.conf.allowReadOnly === true && attr.readOnly) {\r\n continue;\r\n }\r\n else if (attr.level === _abap_file_information_1.AttributeLevel.Constant) {\r\n continue;\r\n }\r\n else if ((this.conf.ignoreTestClasses === true)\r\n && this.file.getFilename().includes(\".testclasses.\")) {\r\n continue;\r\n }\r\n const issue = issue_1.Issue.atIdentifier(attr.identifier, this.getDescription(attr.name), this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.NoPublicAttributes = NoPublicAttributes;\r\n//# sourceMappingURL=no_public_attributes.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/no_public_attributes.js?");
|
|
12769
12769
|
|
|
12770
12770
|
/***/ }),
|
|
12771
12771
|
|
|
@@ -12776,7 +12776,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12776
12776
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12777
12777
|
|
|
12778
12778
|
"use strict";
|
|
12779
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.NoYodaConditions = exports.NoYodaConditionsConf = 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 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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass NoYodaConditionsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Only report issues where the left side is a constant */\r\n this.onlyConstants = false;\r\n }\r\n}\r\nexports.NoYodaConditionsConf = NoYodaConditionsConf;\r\nclass NoYodaConditions extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new NoYodaConditionsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"no_yoda_conditions\",\r\n title: \"No Yoda conditions\",\r\n shortDescription: `Finds Yoda conditions and reports issues`,\r\n extendedInformation: `https://en.wikipedia.org/wiki/Yoda_conditions\n\nConditions with operators CP, NP, CS, NS, CA, NA, CO, CN are ignored`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `IF 0 <> sy-subrc.\nENDIF.`,\r\n goodExample: `IF sy-subrc <> 0.\nENDIF.`,\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;\r\n const issues = [];\r\n for (const c of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllExpressions(Expressions.Compare)) || []) {\r\n const operator = (_b = c.findDirectExpression(Expressions.CompareOperator)) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase();\r\n if (operator === undefined\r\n || operator === \"CP\"\r\n || operator === \"NP\"\r\n || operator === \"CS\"\r\n || operator === \"NS\"\r\n || operator === \"CA\"\r\n || operator === \"NA\"\r\n || operator === \"CO\"\r\n || operator === \"CN\") {\r\n continue;\r\n }\r\n const sources = c.findDirectExpressions(Expressions.Source);\r\n if (sources.length !== 2) {\r\n continue;\r\n }\r\n if (this.conf.onlyConstants === true) {\r\n if (this.isConstant(sources[0]) === true && this.isConstant(sources[1]) === false) {\r\n const start = sources[0].getFirstToken().getStart();\r\n const end = sources[1].getLastToken().getEnd();\r\n const issue = issue_1.Issue.atRange(file, start, end, \"No Yoda conditions\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n continue;\r\n }\r\n // Scenarios:\r\n // constant COMPARE chain\r\n // constant COMPARE multiple tokens with spaces\r\n // fieldChain COMPARE multiple tokens with spaces\r\n if ((this.withoutSpaces(sources[0]) === false && this.withoutSpaces(sources[1]) === true) || ((this.isConstant(sources[0]) === true && this.isFieldChain(sources[1]) === true))) {\r\n const start = sources[0].getFirstToken().getStart();\r\n const end = sources[1].getLastToken().getEnd();\r\n const issue = issue_1.Issue.atRange(file, start, end, \"No Yoda conditions\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n isConstant(node) {\r\n var _a;\r\n if (node.getChildren().length > 1) {\r\n return false;\r\n }\r\n return ((_a = node.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.Constant;\r\n }\r\n isFieldChain(node) {\r\n var _a;\r\n if (node.getChildren().length > 1) {\r\n return false;\r\n }\r\n return ((_a = node.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.FieldChain;\r\n }\r\n withoutSpaces(node) {\r\n return node.concatTokensWithoutStringsAndComments().includes(\" \");\r\n }\r\n}\r\nexports.NoYodaConditions = NoYodaConditions;\r\n//# sourceMappingURL=no_yoda_conditions.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/no_yoda_conditions.js?");
|
|
12779
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.NoYodaConditions = exports.NoYodaConditionsConf = 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 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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass NoYodaConditionsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Only report issues where the left side is a constant */\r\n this.onlyConstants = false;\r\n }\r\n}\r\nexports.NoYodaConditionsConf = NoYodaConditionsConf;\r\nclass NoYodaConditions extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new NoYodaConditionsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"no_yoda_conditions\",\r\n title: \"No Yoda conditions\",\r\n shortDescription: `Finds Yoda conditions and reports issues`,\r\n extendedInformation: `https://en.wikipedia.org/wiki/Yoda_conditions\r\n\r\nConditions with operators CP, NP, CS, NS, CA, NA, CO, CN are ignored`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `IF 0 <> sy-subrc.\r\nENDIF.`,\r\n goodExample: `IF sy-subrc <> 0.\r\nENDIF.`,\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;\r\n const issues = [];\r\n for (const c of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllExpressions(Expressions.Compare)) || []) {\r\n const operator = (_b = c.findDirectExpression(Expressions.CompareOperator)) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase();\r\n if (operator === undefined\r\n || operator === \"CP\"\r\n || operator === \"NP\"\r\n || operator === \"CS\"\r\n || operator === \"NS\"\r\n || operator === \"CA\"\r\n || operator === \"NA\"\r\n || operator === \"CO\"\r\n || operator === \"CN\") {\r\n continue;\r\n }\r\n const sources = c.findDirectExpressions(Expressions.Source);\r\n if (sources.length !== 2) {\r\n continue;\r\n }\r\n if (this.conf.onlyConstants === true) {\r\n if (this.isConstant(sources[0]) === true && this.isConstant(sources[1]) === false) {\r\n const start = sources[0].getFirstToken().getStart();\r\n const end = sources[1].getLastToken().getEnd();\r\n const issue = issue_1.Issue.atRange(file, start, end, \"No Yoda conditions\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n continue;\r\n }\r\n // Scenarios:\r\n // constant COMPARE chain\r\n // constant COMPARE multiple tokens with spaces\r\n // fieldChain COMPARE multiple tokens with spaces\r\n if ((this.withoutSpaces(sources[0]) === false && this.withoutSpaces(sources[1]) === true) || ((this.isConstant(sources[0]) === true && this.isFieldChain(sources[1]) === true))) {\r\n const start = sources[0].getFirstToken().getStart();\r\n const end = sources[1].getLastToken().getEnd();\r\n const issue = issue_1.Issue.atRange(file, start, end, \"No Yoda conditions\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n isConstant(node) {\r\n var _a;\r\n if (node.getChildren().length > 1) {\r\n return false;\r\n }\r\n return ((_a = node.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.Constant;\r\n }\r\n isFieldChain(node) {\r\n var _a;\r\n if (node.getChildren().length > 1) {\r\n return false;\r\n }\r\n return ((_a = node.getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.FieldChain;\r\n }\r\n withoutSpaces(node) {\r\n return node.concatTokensWithoutStringsAndComments().includes(\" \");\r\n }\r\n}\r\nexports.NoYodaConditions = NoYodaConditions;\r\n//# sourceMappingURL=no_yoda_conditions.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/no_yoda_conditions.js?");
|
|
12780
12780
|
|
|
12781
12781
|
/***/ }),
|
|
12782
12782
|
|
|
@@ -12787,7 +12787,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12787
12787
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12788
12788
|
|
|
12789
12789
|
"use strict";
|
|
12790
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.NROBConsistency = exports.NROBConsistencyConf = void 0;\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Objects = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/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\nclass NROBConsistencyConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.NROBConsistencyConf = NROBConsistencyConf;\r\nclass NROBConsistency {\r\n constructor() {\r\n this.conf = new NROBConsistencyConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"nrob_consistency\",\r\n title: \"Number range consistency\",\r\n shortDescription: `Consistency checks for number ranges`,\r\n extendedInformation: `Issue reported if percentage warning is over 50%\n\nIssue reported if the referenced domain is not found(taking error namespace into account)`,\r\n tags: [_irule_1.RuleTag.SingleFile],\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 initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof Objects.NumberRange)) {\r\n return [];\r\n }\r\n const issues = [];\r\n const id = obj.getIdentifier();\r\n if (id === undefined) {\r\n return [];\r\n }\r\n if (obj.getPercentage() || 0 > 50) {\r\n const message = \"Percentage more than 50\";\r\n issues.push(issue_1.Issue.atIdentifier(id, message, this.getMetadata().key, this.getConfig().severity));\r\n }\r\n const domain = obj.getDomain();\r\n if (domain\r\n && this.reg.getObject(\"DOMA\", domain) === undefined\r\n && this.reg.inErrorNamespace(domain) === true) {\r\n const message = \"Domain \" + domain + \" not found\";\r\n issues.push(issue_1.Issue.atIdentifier(id, message, this.getMetadata().key, this.getConfig().severity));\r\n }\r\n return [];\r\n }\r\n}\r\nexports.NROBConsistency = NROBConsistency;\r\n//# sourceMappingURL=nrob_consistency.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/nrob_consistency.js?");
|
|
12790
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.NROBConsistency = exports.NROBConsistencyConf = void 0;\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Objects = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/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\nclass NROBConsistencyConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.NROBConsistencyConf = NROBConsistencyConf;\r\nclass NROBConsistency {\r\n constructor() {\r\n this.conf = new NROBConsistencyConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"nrob_consistency\",\r\n title: \"Number range consistency\",\r\n shortDescription: `Consistency checks for number ranges`,\r\n extendedInformation: `Issue reported if percentage warning is over 50%\r\n\r\nIssue reported if the referenced domain is not found(taking error namespace into account)`,\r\n tags: [_irule_1.RuleTag.SingleFile],\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 initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof Objects.NumberRange)) {\r\n return [];\r\n }\r\n const issues = [];\r\n const id = obj.getIdentifier();\r\n if (id === undefined) {\r\n return [];\r\n }\r\n if (obj.getPercentage() || 0 > 50) {\r\n const message = \"Percentage more than 50\";\r\n issues.push(issue_1.Issue.atIdentifier(id, message, this.getMetadata().key, this.getConfig().severity));\r\n }\r\n const domain = obj.getDomain();\r\n if (domain\r\n && this.reg.getObject(\"DOMA\", domain) === undefined\r\n && this.reg.inErrorNamespace(domain) === true) {\r\n const message = \"Domain \" + domain + \" not found\";\r\n issues.push(issue_1.Issue.atIdentifier(id, message, this.getMetadata().key, this.getConfig().severity));\r\n }\r\n return [];\r\n }\r\n}\r\nexports.NROBConsistency = NROBConsistency;\r\n//# sourceMappingURL=nrob_consistency.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/nrob_consistency.js?");
|
|
12791
12791
|
|
|
12792
12792
|
/***/ }),
|
|
12793
12793
|
|
|
@@ -12809,7 +12809,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12809
12809
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12810
12810
|
|
|
12811
12811
|
"use strict";
|
|
12812
|
-
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 /** Check for FORM DEFINITION */\r\n this.formDefinition = true;\r\n /** Check for FORM IMPLEMENTATION */\r\n this.formImplementation = 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 (this.conf.formDefinition && sta instanceof Statements.FormDefinition) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"FORM DEFINITION\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n if (this.conf.formImplementation && sta instanceof Statements.Form) {\r\n if (staNode.findDirectTokenByText(\"IMPLEMENTATION\")) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"FORM IMPLEMENTATION\", 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?");
|
|
12812
|
+
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 /** Check for FORM DEFINITION */\r\n this.formDefinition = true;\r\n /** Check for FORM IMPLEMENTATION */\r\n this.formImplementation = 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: `\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-functional-to-procedural-language-constructs\r\n\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#avoid-obsolete-language-elements\r\n\r\nSET EXTENDED CHECK: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapset_extended_check.htm\r\n\r\nIS REQUESTED: https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenlogexp_requested.htm\r\n\r\nWITH HEADER LINE: https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abapdata_header_line.htm\r\n\r\nFIELD-SYMBOLS STRUCTURE: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapfield-symbols_obsolete_typing.htm\r\n\r\nTYPE-POOLS: from 702, https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abennews-71-program_load.htm\r\n\r\nLOAD addition: from 702, https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abennews-71-program_load.htm\r\n\r\nCOMMUICATION: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapcommunication.htm\r\n\r\nOCCURS: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapdata_occurs.htm\r\n\r\nPARAMETER: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abapparameter.htm\r\n\r\nRANGES: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abapranges.htm\r\n\r\nPACK: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abappack.htm\r\n\r\nMOVE: https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapmove_obs.htm\r\n\r\nSELECT without INTO: https://help.sap.com/doc/abapdocu_731_index_htm/7.31/en-US/abapselect_obsolete.htm\r\nSELECT COUNT(*) is considered okay\r\n\r\nFREE MEMORY: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abapfree_mem_id_obsolete.htm\r\n\r\nSORT BY FS: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abapsort_itab_obsolete.htm\r\n\r\nCALL TRANSFORMATION OBJECTS: https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abapcall_transformation_objects.htm\r\n\r\nPOSIX REGEX: https://help.sap.com/doc/abapdocu_755_index_htm/7.55/en-US/index.htm\r\n\r\nOCCURENCES: check for OCCURENCES vs OCCURRENCES\r\n\r\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 (this.conf.formDefinition && sta instanceof Statements.FormDefinition) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"FORM DEFINITION\", this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n if (this.conf.formImplementation && sta instanceof Statements.Form) {\r\n if (staNode.findDirectTokenByText(\"IMPLEMENTATION\")) {\r\n const issue = issue_1.Issue.atStatement(file, staNode, \"FORM IMPLEMENTATION\", 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?");
|
|
12813
12813
|
|
|
12814
12814
|
/***/ }),
|
|
12815
12815
|
|
|
@@ -12820,7 +12820,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12820
12820
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12821
12821
|
|
|
12822
12822
|
"use strict";
|
|
12823
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.OmitParameterName = exports.OmitParameterNameConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.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 _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst method_definition_1 = __webpack_require__(/*! ../abap/types/method_definition */ \"./node_modules/@abaplint/core/build/src/abap/types/method_definition.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst _builtin_1 = __webpack_require__(/*! ../abap/5_syntax/_builtin */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin.js\");\r\nclass OmitParameterNameConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.OmitParameterNameConf = OmitParameterNameConf;\r\nclass OmitParameterName {\r\n constructor() {\r\n this.conf = new OmitParameterNameConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"omit_parameter_name\",\r\n title: \"Omit parameter name\",\r\n shortDescription: `Omit the parameter name in single parameter calls`,\r\n extendedInformation: `\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#omit-the-parameter-name-in-single-parameter-calls\n\nEXPORTING must already be omitted for this rule to take effect, https://rules.abaplint.org/exporting/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix],\r\n badExample: `method( param = 2 ).`,\r\n goodExample: `method( 2 ).`,\r\n };\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\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 run(obj) {\r\n var _a, _b;\r\n const issues = [];\r\n if (!(obj instanceof _abap_object_1.ABAPObject) || obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n const spaghetti = new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti;\r\n for (const file of obj.getABAPFiles()) {\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n continue;\r\n }\r\n for (const c of stru.findAllExpressions(Expressions.MethodCall)) {\r\n if (c.findFirstExpression(Expressions.MethodParameters)) {\r\n continue;\r\n }\r\n // hmm, this will break for nested method calls?\r\n const parameters = c.findAllExpressions(Expressions.ParameterS);\r\n if (parameters.length > 1 || parameters.length === 0) {\r\n continue;\r\n }\r\n const name = c.findDirectExpression(Expressions.MethodName);\r\n if (name === undefined) {\r\n continue;\r\n }\r\n const param = c.findDirectExpression(Expressions.MethodCallParam);\r\n if (param === undefined) {\r\n continue;\r\n }\r\n const ref = this.findMethodReference(name.getFirstToken(), spaghetti, file.getFilename());\r\n if (ref === undefined) {\r\n continue;\r\n }\r\n const i = ref.getDefaultImporting();\r\n if (i === undefined) {\r\n continue;\r\n }\r\n const p = (_a = parameters[0].findDirectExpression(Expressions.ParameterName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\r\n if ((p === null || p === void 0 ? void 0 : p.getStr().toUpperCase()) === i.toUpperCase()) {\r\n const message = \"Omit default parameter name \\\"\" + i + \"\\\"\";\r\n const end = (_b = parameters[0].findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStart();\r\n if (end) {\r\n const fix = edit_helper_1.EditHelper.deleteRange(file, p.getStart(), end);\r\n issues.push(issue_1.Issue.atRange(file, p.getStart(), end, message, this.getMetadata().key, this.getConfig().severity, fix));\r\n }\r\n else {\r\n issues.push(issue_1.Issue.atToken(file, name.getFirstToken(), message, this.getMetadata().key, this.getConfig().severity));\r\n }\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n ///////////////////\r\n findMethodReference(token, spaghetti, filename) {\r\n const scope = spaghetti.lookupPosition(token.getStart(), filename);\r\n if (scope === undefined) {\r\n return undefined;\r\n }\r\n for (const r of scope.getData().references) {\r\n if (r.referenceType !== _reference_1.ReferenceType.MethodReference\r\n && r.referenceType !== _reference_1.ReferenceType.BuiltinMethodReference) {\r\n continue;\r\n }\r\n else if (r.position.getStart().equals(token.getStart())) {\r\n if (r.resolved instanceof _builtin_1.BuiltInMethod) {\r\n return r.resolved;\r\n }\r\n else if (r.resolved instanceof method_definition_1.MethodDefinition) {\r\n return r.resolved.getParameters();\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.OmitParameterName = OmitParameterName;\r\n//# sourceMappingURL=omit_parameter_name.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/omit_parameter_name.js?");
|
|
12823
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.OmitParameterName = exports.OmitParameterNameConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.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 _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst method_definition_1 = __webpack_require__(/*! ../abap/types/method_definition */ \"./node_modules/@abaplint/core/build/src/abap/types/method_definition.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst _builtin_1 = __webpack_require__(/*! ../abap/5_syntax/_builtin */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_builtin.js\");\r\nclass OmitParameterNameConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.OmitParameterNameConf = OmitParameterNameConf;\r\nclass OmitParameterName {\r\n constructor() {\r\n this.conf = new OmitParameterNameConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"omit_parameter_name\",\r\n title: \"Omit parameter name\",\r\n shortDescription: `Omit the parameter name in single parameter calls`,\r\n extendedInformation: `\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#omit-the-parameter-name-in-single-parameter-calls\r\n\r\nEXPORTING must already be omitted for this rule to take effect, https://rules.abaplint.org/exporting/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix],\r\n badExample: `method( param = 2 ).`,\r\n goodExample: `method( 2 ).`,\r\n };\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\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 run(obj) {\r\n var _a, _b;\r\n const issues = [];\r\n if (!(obj instanceof _abap_object_1.ABAPObject) || obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n const spaghetti = new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti;\r\n for (const file of obj.getABAPFiles()) {\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n continue;\r\n }\r\n for (const c of stru.findAllExpressions(Expressions.MethodCall)) {\r\n if (c.findFirstExpression(Expressions.MethodParameters)) {\r\n continue;\r\n }\r\n // hmm, this will break for nested method calls?\r\n const parameters = c.findAllExpressions(Expressions.ParameterS);\r\n if (parameters.length > 1 || parameters.length === 0) {\r\n continue;\r\n }\r\n const name = c.findDirectExpression(Expressions.MethodName);\r\n if (name === undefined) {\r\n continue;\r\n }\r\n const param = c.findDirectExpression(Expressions.MethodCallParam);\r\n if (param === undefined) {\r\n continue;\r\n }\r\n const ref = this.findMethodReference(name.getFirstToken(), spaghetti, file.getFilename());\r\n if (ref === undefined) {\r\n continue;\r\n }\r\n const i = ref.getDefaultImporting();\r\n if (i === undefined) {\r\n continue;\r\n }\r\n const p = (_a = parameters[0].findDirectExpression(Expressions.ParameterName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();\r\n if ((p === null || p === void 0 ? void 0 : p.getStr().toUpperCase()) === i.toUpperCase()) {\r\n const message = \"Omit default parameter name \\\"\" + i + \"\\\"\";\r\n const end = (_b = parameters[0].findDirectExpression(Expressions.Source)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStart();\r\n if (end) {\r\n const fix = edit_helper_1.EditHelper.deleteRange(file, p.getStart(), end);\r\n issues.push(issue_1.Issue.atRange(file, p.getStart(), end, message, this.getMetadata().key, this.getConfig().severity, fix));\r\n }\r\n else {\r\n issues.push(issue_1.Issue.atToken(file, name.getFirstToken(), message, this.getMetadata().key, this.getConfig().severity));\r\n }\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n ///////////////////\r\n findMethodReference(token, spaghetti, filename) {\r\n const scope = spaghetti.lookupPosition(token.getStart(), filename);\r\n if (scope === undefined) {\r\n return undefined;\r\n }\r\n for (const r of scope.getData().references) {\r\n if (r.referenceType !== _reference_1.ReferenceType.MethodReference\r\n && r.referenceType !== _reference_1.ReferenceType.BuiltinMethodReference) {\r\n continue;\r\n }\r\n else if (r.position.getStart().equals(token.getStart())) {\r\n if (r.resolved instanceof _builtin_1.BuiltInMethod) {\r\n return r.resolved;\r\n }\r\n else if (r.resolved instanceof method_definition_1.MethodDefinition) {\r\n return r.resolved.getParameters();\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.OmitParameterName = OmitParameterName;\r\n//# sourceMappingURL=omit_parameter_name.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/omit_parameter_name.js?");
|
|
12824
12824
|
|
|
12825
12825
|
/***/ }),
|
|
12826
12826
|
|
|
@@ -12842,7 +12842,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12842
12842
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12843
12843
|
|
|
12844
12844
|
"use strict";
|
|
12845
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.OmitReceiving = exports.OmitReceivingConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nclass OmitReceivingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.OmitReceivingConf = OmitReceivingConf;\r\nclass OmitReceiving extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new OmitReceivingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"omit_receiving\",\r\n title: \"Omit RECEIVING\",\r\n shortDescription: `Omit RECEIVING`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#omit-receiving`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n badExample: `\n upload_pack(\n EXPORTING\n io_client = lo_client\n iv_url = iv_url\n iv_deepen_level = iv_deepen_level\n it_hashes = lt_hashes\n RECEIVING\n rt_objects = et_objects ).`,\r\n goodExample: `\n et_objects = upload_pack(\n io_client = lo_client\n iv_url = iv_url\n iv_deepen_level = iv_deepen_level\n it_hashes = lt_hashes ).`,\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;\r\n const issues = [];\r\n for (const e of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllExpressions(Expressions.MethodCallParam)) || []) {\r\n const p = e.findDirectExpression(Expressions.MethodParameters);\r\n if (p === undefined) {\r\n continue;\r\n }\r\n const r = p.findDirectTokenByText(\"RECEIVING\");\r\n if (r === undefined) {\r\n continue;\r\n }\r\n const ex = p.findDirectTokenByText(\"EXCEPTIONS\");\r\n if (ex !== undefined) {\r\n continue;\r\n }\r\n issues.push(issue_1.Issue.atToken(file, r, \"Omit RECEIVING\", this.getMetadata().key, this.getConfig().severity));\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.OmitReceiving = OmitReceiving;\r\n//# sourceMappingURL=omit_receiving.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/omit_receiving.js?");
|
|
12845
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.OmitReceiving = exports.OmitReceivingConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nclass OmitReceivingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.OmitReceivingConf = OmitReceivingConf;\r\nclass OmitReceiving extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new OmitReceivingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"omit_receiving\",\r\n title: \"Omit RECEIVING\",\r\n shortDescription: `Omit RECEIVING`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#omit-receiving`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n badExample: `\r\n upload_pack(\r\n EXPORTING\r\n io_client = lo_client\r\n iv_url = iv_url\r\n iv_deepen_level = iv_deepen_level\r\n it_hashes = lt_hashes\r\n RECEIVING\r\n rt_objects = et_objects ).`,\r\n goodExample: `\r\n et_objects = upload_pack(\r\n io_client = lo_client\r\n iv_url = iv_url\r\n iv_deepen_level = iv_deepen_level\r\n it_hashes = lt_hashes ).`,\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;\r\n const issues = [];\r\n for (const e of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllExpressions(Expressions.MethodCallParam)) || []) {\r\n const p = e.findDirectExpression(Expressions.MethodParameters);\r\n if (p === undefined) {\r\n continue;\r\n }\r\n const r = p.findDirectTokenByText(\"RECEIVING\");\r\n if (r === undefined) {\r\n continue;\r\n }\r\n const ex = p.findDirectTokenByText(\"EXCEPTIONS\");\r\n if (ex !== undefined) {\r\n continue;\r\n }\r\n issues.push(issue_1.Issue.atToken(file, r, \"Omit RECEIVING\", this.getMetadata().key, this.getConfig().severity));\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.OmitReceiving = OmitReceiving;\r\n//# sourceMappingURL=omit_receiving.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/omit_receiving.js?");
|
|
12846
12846
|
|
|
12847
12847
|
/***/ }),
|
|
12848
12848
|
|
|
@@ -12853,7 +12853,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12853
12853
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12854
12854
|
|
|
12855
12855
|
"use strict";
|
|
12856
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Parser702Chaining = exports.Parser702ChainingConf = 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 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 _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\nclass Parser702ChainingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.Parser702ChainingConf = Parser702ChainingConf;\r\nclass Parser702Chaining extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new Parser702ChainingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"parser_702_chaining\",\r\n title: \"Parser Error, bad chanining on 702\",\r\n shortDescription: `ABAP on 702 does not allow for method chaining with IMPORTING/EXPORTING/CHANGING keywords,\nthis rule finds these and reports errors.\nOnly active on target version 702 and below.`,\r\n tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.SingleFile],\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 const issues = [];\r\n if (this.reg.getConfig().getVersion() !== version_1.Version.v702\r\n && this.reg.getConfig().getVersion() !== version_1.Version.v700) {\r\n return [];\r\n }\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return [];\r\n }\r\n for (const chain of stru.findAllExpressions(Expressions.MethodCallChain)) {\r\n const calls = chain.findDirectExpressions(Expressions.MethodCall);\r\n if (calls.length < 2) {\r\n continue;\r\n }\r\n for (const call of calls) {\r\n const callParam = call.findDirectExpression(Expressions.MethodCallParam);\r\n if (callParam === undefined) {\r\n continue;\r\n }\r\n const param = callParam.findDirectExpression(Expressions.MethodParameters);\r\n if (param === undefined) {\r\n continue;\r\n }\r\n if (param.findDirectTokenByText(\"IMPORTING\")\r\n || param.findDirectTokenByText(\"CHANGING\")\r\n || param.findDirectTokenByText(\"EXCEPTIONS\")) {\r\n const message = \"This kind of method chaining not possible in 702\";\r\n const issue = issue_1.Issue.atPosition(file, param.getFirstToken().getStart(), message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.Parser702Chaining = Parser702Chaining;\r\n//# sourceMappingURL=parser_702_chaining.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/parser_702_chaining.js?");
|
|
12856
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Parser702Chaining = exports.Parser702ChainingConf = 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 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 _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\nclass Parser702ChainingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.Parser702ChainingConf = Parser702ChainingConf;\r\nclass Parser702Chaining extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new Parser702ChainingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"parser_702_chaining\",\r\n title: \"Parser Error, bad chanining on 702\",\r\n shortDescription: `ABAP on 702 does not allow for method chaining with IMPORTING/EXPORTING/CHANGING keywords,\r\nthis rule finds these and reports errors.\r\nOnly active on target version 702 and below.`,\r\n tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.SingleFile],\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 const issues = [];\r\n if (this.reg.getConfig().getVersion() !== version_1.Version.v702\r\n && this.reg.getConfig().getVersion() !== version_1.Version.v700) {\r\n return [];\r\n }\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return [];\r\n }\r\n for (const chain of stru.findAllExpressions(Expressions.MethodCallChain)) {\r\n const calls = chain.findDirectExpressions(Expressions.MethodCall);\r\n if (calls.length < 2) {\r\n continue;\r\n }\r\n for (const call of calls) {\r\n const callParam = call.findDirectExpression(Expressions.MethodCallParam);\r\n if (callParam === undefined) {\r\n continue;\r\n }\r\n const param = callParam.findDirectExpression(Expressions.MethodParameters);\r\n if (param === undefined) {\r\n continue;\r\n }\r\n if (param.findDirectTokenByText(\"IMPORTING\")\r\n || param.findDirectTokenByText(\"CHANGING\")\r\n || param.findDirectTokenByText(\"EXCEPTIONS\")) {\r\n const message = \"This kind of method chaining not possible in 702\";\r\n const issue = issue_1.Issue.atPosition(file, param.getFirstToken().getStart(), message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.Parser702Chaining = Parser702Chaining;\r\n//# sourceMappingURL=parser_702_chaining.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/parser_702_chaining.js?");
|
|
12857
12857
|
|
|
12858
12858
|
/***/ }),
|
|
12859
12859
|
|
|
@@ -12864,7 +12864,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12864
12864
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12865
12865
|
|
|
12866
12866
|
"use strict";
|
|
12867
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ParserError = exports.ParserErrorConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.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 statement_parser_1 = __webpack_require__(/*! ../abap/2_statements/statement_parser */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statement_parser.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 _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nclass ParserErrorConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.ParserErrorConf = ParserErrorConf;\r\nclass ParserError {\r\n constructor() {\r\n this.conf = new ParserErrorConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"parser_error\",\r\n title: \"Parser error\",\r\n shortDescription: `Checks for syntax not recognized by abaplint.\n\nSee recognized syntax at https://syntax.abaplint.org`,\r\n tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\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 run(obj) {\r\n const issues = [];\r\n issues.push(...obj.getParsingIssues());\r\n if (obj instanceof _abap_object_1.ABAPObject) {\r\n for (const file of obj.getABAPFiles()) {\r\n for (const statement of file.getStatements()) {\r\n if (!(statement.get() instanceof _statement_1.Unknown)) {\r\n continue;\r\n }\r\n if (statement.getTokens().length > statement_parser_1.STATEMENT_MAX_TOKENS) {\r\n const message = \"Statement too long, refactor statement\";\r\n const issue = issue_1.Issue.atToken(file, statement.getTokens()[0], message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n else {\r\n const tok = statement.getFirstToken();\r\n const message = \"Statement does not exist in ABAP\" + this.reg.getConfig().getVersion() + \"(or a parser error), \\\"\" + tok.getStr() + \"\\\"\";\r\n const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.reg.getConfig().getVersion() === version_1.Version.v700) {\r\n for (const statement of file.getStatements()) {\r\n if (statement.getPragmas().length > 0) {\r\n const message = \"Pragmas not allowed in v700\";\r\n const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.ParserError = ParserError;\r\n//# sourceMappingURL=parser_error.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/parser_error.js?");
|
|
12867
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ParserError = exports.ParserErrorConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.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 statement_parser_1 = __webpack_require__(/*! ../abap/2_statements/statement_parser */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statement_parser.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 _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nclass ParserErrorConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.ParserErrorConf = ParserErrorConf;\r\nclass ParserError {\r\n constructor() {\r\n this.conf = new ParserErrorConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"parser_error\",\r\n title: \"Parser error\",\r\n shortDescription: `Checks for syntax not recognized by abaplint.\r\n\r\nSee recognized syntax at https://syntax.abaplint.org`,\r\n tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\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 run(obj) {\r\n const issues = [];\r\n issues.push(...obj.getParsingIssues());\r\n if (obj instanceof _abap_object_1.ABAPObject) {\r\n for (const file of obj.getABAPFiles()) {\r\n for (const statement of file.getStatements()) {\r\n if (!(statement.get() instanceof _statement_1.Unknown)) {\r\n continue;\r\n }\r\n if (statement.getTokens().length > statement_parser_1.STATEMENT_MAX_TOKENS) {\r\n const message = \"Statement too long, refactor statement\";\r\n const issue = issue_1.Issue.atToken(file, statement.getTokens()[0], message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n else {\r\n const tok = statement.getFirstToken();\r\n const message = \"Statement does not exist in ABAP\" + this.reg.getConfig().getVersion() + \"(or a parser error), \\\"\" + tok.getStr() + \"\\\"\";\r\n const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n if (this.reg.getConfig().getVersion() === version_1.Version.v700) {\r\n for (const statement of file.getStatements()) {\r\n if (statement.getPragmas().length > 0) {\r\n const message = \"Pragmas not allowed in v700\";\r\n const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.ParserError = ParserError;\r\n//# sourceMappingURL=parser_error.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/parser_error.js?");
|
|
12868
12868
|
|
|
12869
12869
|
/***/ }),
|
|
12870
12870
|
|
|
@@ -12875,7 +12875,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12875
12875
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12876
12876
|
|
|
12877
12877
|
"use strict";
|
|
12878
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ParserMissingSpace = exports.ParserMissingSpaceConf = 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 issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\n// todo: this rule needs refactoring\r\nclass ParserMissingSpaceConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.ParserMissingSpaceConf = ParserMissingSpaceConf;\r\nclass ParserMissingSpace extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ParserMissingSpaceConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"parser_missing_space\",\r\n title: \"Parser Error, missing space\",\r\n shortDescription: `In special cases the ABAP language allows for not having spaces before or after string literals.\nThis rule makes sure the spaces are consistently required across the language.`,\r\n tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.Whitespace, _irule_1.RuleTag.SingleFile],\r\n badExample: `IF ( foo = 'bar').`,\r\n goodExample: `IF ( foo = 'bar' ).`,\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 const issues = [];\r\n let start = new position_1.Position(0, 0);\r\n for (const statement of file.getStatements()) {\r\n const missing = this.missingSpace(statement);\r\n if (missing) {\r\n const message = \"Missing space between string or character literal and parentheses\";\r\n start = missing;\r\n const issue = issue_1.Issue.atPosition(file, start, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n missingSpace(statement) {\r\n const found = statement.findAllExpressionsMulti([Expressions.CondSub, Expressions.SQLCond,\r\n Expressions.ValueBodyLine, Expressions.NewObject, Expressions.Cond,\r\n Expressions.ComponentCond, Expressions.ComponentCondSub, Expressions.MethodCallParam], true);\r\n let pos = undefined;\r\n for (const f of found) {\r\n const type = f.get();\r\n if (type instanceof Expressions.Cond) {\r\n pos = this.checkCond(f);\r\n }\r\n else if (type instanceof Expressions.CondSub) {\r\n pos = this.checkCondSub(f);\r\n }\r\n else if (type instanceof Expressions.ComponentCond) {\r\n pos = this.checkComponentCond(f);\r\n }\r\n else if (type instanceof Expressions.ComponentCondSub) {\r\n pos = this.checkComponentCondSub(f);\r\n }\r\n else if (type instanceof Expressions.SQLCond) {\r\n pos = this.checkSQLCond(f);\r\n }\r\n else if (type instanceof Expressions.ValueBodyLine) {\r\n pos = this.checkValueBodyLine(f);\r\n }\r\n else if (type instanceof Expressions.NewObject) {\r\n pos = this.checkNewObject(f);\r\n }\r\n else if (type instanceof Expressions.MethodCallParam) {\r\n pos = this.checkMethodCallParam(f);\r\n }\r\n if (pos) {\r\n return pos;\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkSQLCond(cond) {\r\n const children = cond.getChildren();\r\n for (let i = 0; i < children.length; i++) {\r\n if (children[i].get() instanceof Expressions.SQLCond) {\r\n const current = children[i];\r\n const prev = children[i - 1].getLastToken();\r\n const next = children[i + 1].getFirstToken();\r\n if (prev.getStr() === \"(\"\r\n && prev.getRow() === current.getFirstToken().getRow()\r\n && prev.getCol() + 1 === current.getFirstToken().getStart().getCol()) {\r\n return current.getFirstToken().getStart();\r\n }\r\n if (next.getStr() === \")\"\r\n && next.getRow() === current.getLastToken().getRow()\r\n && next.getCol() === current.getLastToken().getEnd().getCol()) {\r\n return current.getLastToken().getEnd();\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkNewObject(cond) {\r\n const children = cond.getChildren();\r\n {\r\n const first = children[children.length - 2].getLastToken();\r\n const second = children[children.length - 1].getFirstToken();\r\n if (first.getRow() === second.getRow()\r\n && first.getEnd().getCol() === second.getStart().getCol()) {\r\n return second.getStart();\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkCondSub(cond) {\r\n const children = cond.getChildren();\r\n for (let i = 0; i < children.length; i++) {\r\n if (children[i].get() instanceof Expressions.Cond) {\r\n const current = children[i];\r\n const prev = children[i - 1].getLastToken();\r\n const next = children[i + 1].getFirstToken();\r\n if (prev.getStr() === \"(\"\r\n && prev.getRow() === current.getFirstToken().getRow()\r\n && prev.getCol() + 1 === current.getFirstToken().getStart().getCol()) {\r\n return current.getFirstToken().getStart();\r\n }\r\n if (next.getStr() === \")\"\r\n && next.getRow() === current.getLastToken().getRow()\r\n && next.getCol() === current.getLastToken().getEnd().getCol()) {\r\n return current.getLastToken().getEnd();\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkComponentCondSub(cond) {\r\n const children = cond.getChildren();\r\n for (let i = 0; i < children.length; i++) {\r\n if (children[i].get() instanceof Expressions.ComponentCond) {\r\n const current = children[i];\r\n const prev = children[i - 1].getLastToken();\r\n const next = children[i + 1].getFirstToken();\r\n if (prev.getStr() === \"(\"\r\n && prev.getRow() === current.getFirstToken().getRow()\r\n && prev.getCol() + 1 === current.getFirstToken().getStart().getCol()) {\r\n return current.getFirstToken().getStart();\r\n }\r\n if (next.getStr() === \")\"\r\n && next.getRow() === current.getLastToken().getRow()\r\n && next.getCol() === current.getLastToken().getEnd().getCol()) {\r\n return current.getLastToken().getEnd();\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkComponentCond(cond) {\r\n const children = cond.getAllTokens();\r\n for (let i = 0; i < children.length - 1; i++) {\r\n const current = children[i];\r\n const next = children[i + 1];\r\n if (next.getStr().startsWith(\"'\")\r\n && next.getRow() === current.getRow()\r\n && next.getCol() === current.getEnd().getCol()) {\r\n return current.getEnd();\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkValueBodyLine(vb) {\r\n var _a, _b;\r\n const children = vb.getChildren();\r\n for (let i = 0; i < children.length; i++) {\r\n const current = children[i];\r\n if (current instanceof nodes_1.TokenNode) {\r\n const prev = (_a = children[i - 1]) === null || _a === void 0 ? void 0 : _a.getLastToken();\r\n const next = (_b = children[i + 1]) === null || _b === void 0 ? void 0 : _b.getFirstToken();\r\n if (current.getFirstToken().getStr() === \"(\"\r\n && next\r\n && next.getRow() === current.getLastToken().getRow()\r\n && next.getCol() === current.getLastToken().getEnd().getCol()) {\r\n return current.getFirstToken().getStart();\r\n }\r\n if (current.getFirstToken().getStr() === \")\"\r\n && prev\r\n && prev.getRow() === current.getFirstToken().getRow()\r\n && prev.getEnd().getCol() === current.getFirstToken().getStart().getCol()) {\r\n return current.getLastToken().getEnd();\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkCond(cond) {\r\n const children = cond.getAllTokens();\r\n for (let i = 0; i < children.length - 1; i++) {\r\n const current = children[i];\r\n const next = children[i + 1];\r\n if (next.getStr().startsWith(\"'\")\r\n && next.getRow() === current.getRow()\r\n && next.getCol() === current.getEnd().getCol()) {\r\n return current.getEnd();\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkMethodCallParam(call) {\r\n const children = call.getChildren();\r\n {\r\n const first = children[0].getFirstToken();\r\n const second = children[1].getFirstToken();\r\n if (first.getRow() === second.getRow()\r\n && first.getCol() + 1 === second.getStart().getCol()) {\r\n return second.getStart();\r\n }\r\n }\r\n {\r\n const first = children[children.length - 2].getLastToken();\r\n const second = children[children.length - 1].getFirstToken();\r\n if (first.getRow() === second.getRow()\r\n && first.getEnd().getCol() === second.getStart().getCol()) {\r\n return second.getStart();\r\n }\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.ParserMissingSpace = ParserMissingSpace;\r\n//# sourceMappingURL=parser_missing_space.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/parser_missing_space.js?");
|
|
12878
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.ParserMissingSpace = exports.ParserMissingSpaceConf = 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 issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ \"./node_modules/@abaplint/core/build/src/rules/_abap_rule.js\");\r\nconst nodes_1 = __webpack_require__(/*! ../abap/nodes */ \"./node_modules/@abaplint/core/build/src/abap/nodes/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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\n// todo: this rule needs refactoring\r\nclass ParserMissingSpaceConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.ParserMissingSpaceConf = ParserMissingSpaceConf;\r\nclass ParserMissingSpace extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new ParserMissingSpaceConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"parser_missing_space\",\r\n title: \"Parser Error, missing space\",\r\n shortDescription: `In special cases the ABAP language allows for not having spaces before or after string literals.\r\nThis rule makes sure the spaces are consistently required across the language.`,\r\n tags: [_irule_1.RuleTag.Syntax, _irule_1.RuleTag.Whitespace, _irule_1.RuleTag.SingleFile],\r\n badExample: `IF ( foo = 'bar').`,\r\n goodExample: `IF ( foo = 'bar' ).`,\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 const issues = [];\r\n let start = new position_1.Position(0, 0);\r\n for (const statement of file.getStatements()) {\r\n const missing = this.missingSpace(statement);\r\n if (missing) {\r\n const message = \"Missing space between string or character literal and parentheses\";\r\n start = missing;\r\n const issue = issue_1.Issue.atPosition(file, start, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n missingSpace(statement) {\r\n const found = statement.findAllExpressionsMulti([Expressions.CondSub, Expressions.SQLCond,\r\n Expressions.ValueBodyLine, Expressions.NewObject, Expressions.Cond,\r\n Expressions.ComponentCond, Expressions.ComponentCondSub, Expressions.MethodCallParam], true);\r\n let pos = undefined;\r\n for (const f of found) {\r\n const type = f.get();\r\n if (type instanceof Expressions.Cond) {\r\n pos = this.checkCond(f);\r\n }\r\n else if (type instanceof Expressions.CondSub) {\r\n pos = this.checkCondSub(f);\r\n }\r\n else if (type instanceof Expressions.ComponentCond) {\r\n pos = this.checkComponentCond(f);\r\n }\r\n else if (type instanceof Expressions.ComponentCondSub) {\r\n pos = this.checkComponentCondSub(f);\r\n }\r\n else if (type instanceof Expressions.SQLCond) {\r\n pos = this.checkSQLCond(f);\r\n }\r\n else if (type instanceof Expressions.ValueBodyLine) {\r\n pos = this.checkValueBodyLine(f);\r\n }\r\n else if (type instanceof Expressions.NewObject) {\r\n pos = this.checkNewObject(f);\r\n }\r\n else if (type instanceof Expressions.MethodCallParam) {\r\n pos = this.checkMethodCallParam(f);\r\n }\r\n if (pos) {\r\n return pos;\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkSQLCond(cond) {\r\n const children = cond.getChildren();\r\n for (let i = 0; i < children.length; i++) {\r\n if (children[i].get() instanceof Expressions.SQLCond) {\r\n const current = children[i];\r\n const prev = children[i - 1].getLastToken();\r\n const next = children[i + 1].getFirstToken();\r\n if (prev.getStr() === \"(\"\r\n && prev.getRow() === current.getFirstToken().getRow()\r\n && prev.getCol() + 1 === current.getFirstToken().getStart().getCol()) {\r\n return current.getFirstToken().getStart();\r\n }\r\n if (next.getStr() === \")\"\r\n && next.getRow() === current.getLastToken().getRow()\r\n && next.getCol() === current.getLastToken().getEnd().getCol()) {\r\n return current.getLastToken().getEnd();\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkNewObject(cond) {\r\n const children = cond.getChildren();\r\n {\r\n const first = children[children.length - 2].getLastToken();\r\n const second = children[children.length - 1].getFirstToken();\r\n if (first.getRow() === second.getRow()\r\n && first.getEnd().getCol() === second.getStart().getCol()) {\r\n return second.getStart();\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkCondSub(cond) {\r\n const children = cond.getChildren();\r\n for (let i = 0; i < children.length; i++) {\r\n if (children[i].get() instanceof Expressions.Cond) {\r\n const current = children[i];\r\n const prev = children[i - 1].getLastToken();\r\n const next = children[i + 1].getFirstToken();\r\n if (prev.getStr() === \"(\"\r\n && prev.getRow() === current.getFirstToken().getRow()\r\n && prev.getCol() + 1 === current.getFirstToken().getStart().getCol()) {\r\n return current.getFirstToken().getStart();\r\n }\r\n if (next.getStr() === \")\"\r\n && next.getRow() === current.getLastToken().getRow()\r\n && next.getCol() === current.getLastToken().getEnd().getCol()) {\r\n return current.getLastToken().getEnd();\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkComponentCondSub(cond) {\r\n const children = cond.getChildren();\r\n for (let i = 0; i < children.length; i++) {\r\n if (children[i].get() instanceof Expressions.ComponentCond) {\r\n const current = children[i];\r\n const prev = children[i - 1].getLastToken();\r\n const next = children[i + 1].getFirstToken();\r\n if (prev.getStr() === \"(\"\r\n && prev.getRow() === current.getFirstToken().getRow()\r\n && prev.getCol() + 1 === current.getFirstToken().getStart().getCol()) {\r\n return current.getFirstToken().getStart();\r\n }\r\n if (next.getStr() === \")\"\r\n && next.getRow() === current.getLastToken().getRow()\r\n && next.getCol() === current.getLastToken().getEnd().getCol()) {\r\n return current.getLastToken().getEnd();\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkComponentCond(cond) {\r\n const children = cond.getAllTokens();\r\n for (let i = 0; i < children.length - 1; i++) {\r\n const current = children[i];\r\n const next = children[i + 1];\r\n if (next.getStr().startsWith(\"'\")\r\n && next.getRow() === current.getRow()\r\n && next.getCol() === current.getEnd().getCol()) {\r\n return current.getEnd();\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkValueBodyLine(vb) {\r\n var _a, _b;\r\n const children = vb.getChildren();\r\n for (let i = 0; i < children.length; i++) {\r\n const current = children[i];\r\n if (current instanceof nodes_1.TokenNode) {\r\n const prev = (_a = children[i - 1]) === null || _a === void 0 ? void 0 : _a.getLastToken();\r\n const next = (_b = children[i + 1]) === null || _b === void 0 ? void 0 : _b.getFirstToken();\r\n if (current.getFirstToken().getStr() === \"(\"\r\n && next\r\n && next.getRow() === current.getLastToken().getRow()\r\n && next.getCol() === current.getLastToken().getEnd().getCol()) {\r\n return current.getFirstToken().getStart();\r\n }\r\n if (current.getFirstToken().getStr() === \")\"\r\n && prev\r\n && prev.getRow() === current.getFirstToken().getRow()\r\n && prev.getEnd().getCol() === current.getFirstToken().getStart().getCol()) {\r\n return current.getLastToken().getEnd();\r\n }\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkCond(cond) {\r\n const children = cond.getAllTokens();\r\n for (let i = 0; i < children.length - 1; i++) {\r\n const current = children[i];\r\n const next = children[i + 1];\r\n if (next.getStr().startsWith(\"'\")\r\n && next.getRow() === current.getRow()\r\n && next.getCol() === current.getEnd().getCol()) {\r\n return current.getEnd();\r\n }\r\n }\r\n return undefined;\r\n }\r\n checkMethodCallParam(call) {\r\n const children = call.getChildren();\r\n {\r\n const first = children[0].getFirstToken();\r\n const second = children[1].getFirstToken();\r\n if (first.getRow() === second.getRow()\r\n && first.getCol() + 1 === second.getStart().getCol()) {\r\n return second.getStart();\r\n }\r\n }\r\n {\r\n const first = children[children.length - 2].getLastToken();\r\n const second = children[children.length - 1].getFirstToken();\r\n if (first.getRow() === second.getRow()\r\n && first.getEnd().getCol() === second.getStart().getCol()) {\r\n return second.getStart();\r\n }\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.ParserMissingSpace = ParserMissingSpace;\r\n//# sourceMappingURL=parser_missing_space.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/parser_missing_space.js?");
|
|
12879
12879
|
|
|
12880
12880
|
/***/ }),
|
|
12881
12881
|
|
|
@@ -12908,7 +12908,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12908
12908
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12909
12909
|
|
|
12910
12910
|
"use strict";
|
|
12911
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.PreferInline = exports.PreferInlineConf = 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 _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 version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.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 _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass PreferInlineConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.PreferInlineConf = PreferInlineConf;\r\nclass PreferInline {\r\n constructor() {\r\n this.conf = new PreferInlineConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"prefer_inline\",\r\n title: \"Prefer Inline Declarations\",\r\n shortDescription: `Prefer inline to up-front declarations.`,\r\n extendedInformation: `EXPERIMENTAL\n\nActivates if language version is v740sp02 or above.\n\nVariables must be local(METHOD or FORM).\n\nNo generic or void typed variables. No syntax errors.\n\nFirst position used must be a full/pure write.\n\nMove statment is not a cast(?=)\n\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-inline-to-up-front-declarations`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Upport, _irule_1.RuleTag.Experimental, _irule_1.RuleTag.Quickfix],\r\n badExample: `DATA foo TYPE i.\nfoo = 2.\nDATA percentage TYPE decfloat34.\npercentage = ( comment_number / abs_statement_number ) * 100.`,\r\n goodExample: `DATA(foo) = 2.\nDATA(percentage) = CONV decfloat34( comment_number / abs_statement_number ) * 100.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n run(obj) {\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n if (this.reg.getConfig().getVersion() < version_1.Version.v740sp02 && this.reg.getConfig().getVersion() !== version_1.Version.Cloud) {\r\n return [];\r\n }\r\n else if (!(obj instanceof _abap_object_1.ABAPObject)) {\r\n return [];\r\n }\r\n const run = new syntax_1.SyntaxLogic(this.reg, obj).run();\r\n if (run.issues.length > 0) {\r\n return [];\r\n }\r\n const scopes = this.findScopeCandidates(run.spaghetti.getTop());\r\n const ret = [];\r\n for (const s of scopes) {\r\n ret.push(...this.analyzeScope(s, obj));\r\n }\r\n return ret;\r\n }\r\n ///////////////////////////\r\n analyzeScope(node, obj) {\r\n var _a, _b;\r\n const ret = [];\r\n const vars = node.getData().vars;\r\n for (const name in vars) {\r\n const identifier = vars[name];\r\n if (this.isLocalDefinition(node, identifier) === false\r\n || identifier.getMeta().includes(\"inline\" /* IdentifierMeta.InlineDefinition */)\r\n || identifier.getMeta().includes(\"form_parameter\" /* IdentifierMeta.FormParameter */)) {\r\n continue;\r\n }\r\n else if (identifier.getType().isGeneric() === true) {\r\n continue;\r\n }\r\n else if (identifier.getType().containsVoid() === true) {\r\n continue;\r\n }\r\n const write = this.firstUseIsWrite(node, identifier);\r\n if (write === undefined) {\r\n continue;\r\n }\r\n // check that it is a pure write, eg not sub component assignment\r\n const next = this.findNextToken(write, obj);\r\n if (next === undefined) {\r\n continue;\r\n }\r\n else if ((next === null || next === void 0 ? void 0 : next.getStart().equals(write.position.getEnd())) && next.getStr() !== \".\" && next.getStr() !== \",\") {\r\n continue;\r\n }\r\n const file = obj.getABAPFileByName(identifier.getFilename());\r\n const writeStatement = edit_helper_1.EditHelper.findStatement(next, file);\r\n const statementType = writeStatement === null || writeStatement === void 0 ? void 0 : writeStatement.get();\r\n if (statementType === undefined) {\r\n continue;\r\n }\r\n // for now only allow some specific target statements, todo refactor\r\n if (!(statementType instanceof Statements.Move\r\n || statementType instanceof Statements.Catch\r\n || statementType instanceof Statements.ReadTable\r\n || statementType instanceof Statements.Loop)\r\n || ((_a = writeStatement === null || writeStatement === void 0 ? void 0 : writeStatement.concatTokens()) === null || _a === void 0 ? void 0 : _a.includes(\"?=\"))\r\n || ((_b = writeStatement === null || writeStatement === void 0 ? void 0 : writeStatement.concatTokens()) === null || _b === void 0 ? void 0 : _b.includes(\" #(\"))) {\r\n continue;\r\n }\r\n const statement = edit_helper_1.EditHelper.findStatement(identifier.getToken(), file);\r\n const concat = statement === null || statement === void 0 ? void 0 : statement.concatTokens().toUpperCase();\r\n if (concat === null || concat === void 0 ? void 0 : concat.includes(\"BEGIN OF\")) {\r\n continue;\r\n }\r\n let fix = undefined;\r\n if (file && statement) {\r\n const fix1 = edit_helper_1.EditHelper.deleteStatement(file, statement);\r\n const name = identifier.getName();\r\n const replace = name.startsWith(\"<\") ? \"FIELD-SYMBOL(\" + name + \")\" : \"DATA(\" + name + \")\";\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(file, write.position.getStart(), write.position.getEnd(), replace);\r\n fix = edit_helper_1.EditHelper.merge(fix1, fix2);\r\n }\r\n const message = this.getMetadata().title + \", \" + name;\r\n ret.push(issue_1.Issue.atIdentifier(identifier, message, this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n return ret;\r\n }\r\n ////////////////////////\r\n findNextToken(ref, obj) {\r\n const file = obj.getABAPFileByName(ref.resolved.getFilename());\r\n if (file === undefined) {\r\n return undefined;\r\n }\r\n for (const t of file.getTokens()) {\r\n if (t.getStart().isAfter(ref.position.getEnd())) {\r\n return t;\r\n }\r\n }\r\n return undefined;\r\n }\r\n firstUseIsWrite(node, identifier) {\r\n // assumption: variables are local, so only the current scope must be searched\r\n var _a, _b, _c;\r\n for (const r of node.getData().references) {\r\n if (r.referenceType === _reference_1.ReferenceType.TypeReference\r\n && ((_a = r.resolved) === null || _a === void 0 ? void 0 : _a.getStart().equals(identifier.getStart())) === true) {\r\n return undefined;\r\n }\r\n }\r\n let firstRead = undefined;\r\n for (const r of node.getData().references) {\r\n if (r.referenceType !== _reference_1.ReferenceType.DataReadReference\r\n || ((_b = r.resolved) === null || _b === void 0 ? void 0 : _b.getStart().equals(identifier.getStart())) === false) {\r\n continue;\r\n }\r\n if (r.resolved) {\r\n firstRead = { position: r.position, resolved: r.resolved };\r\n break;\r\n }\r\n }\r\n let firstWrite = undefined;\r\n for (const w of node.getData().references) {\r\n if (w.referenceType !== _reference_1.ReferenceType.DataWriteReference\r\n || ((_c = w.resolved) === null || _c === void 0 ? void 0 : _c.getStart().equals(identifier.getStart())) === false) {\r\n continue;\r\n }\r\n if (w.resolved) {\r\n firstWrite = { position: w.position, resolved: w.resolved };\r\n break;\r\n }\r\n }\r\n if (firstRead === undefined) {\r\n return firstWrite;\r\n }\r\n else if (firstWrite === undefined) {\r\n return undefined;\r\n }\r\n else if (firstWrite.position.getStart().getRow() === firstRead.position.getStart().getRow()) {\r\n // if the same statement both reads and write the same variable\r\n // note that currently just the line number is compared, this is not correct, it should check if its the same statement\r\n return undefined;\r\n }\r\n else if (firstWrite.position.getStart().isBefore(firstRead.position.getStart())) {\r\n return firstWrite;\r\n }\r\n return undefined;\r\n }\r\n isLocalDefinition(node, identifier) {\r\n const { start, end } = node.calcCoverage();\r\n if (identifier.getStart().isAfter(start) && identifier.getStart().isBefore(end)) {\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n findScopeCandidates(node) {\r\n if (node.getIdentifier().stype === _scope_type_1.ScopeType.Form\r\n || node.getIdentifier().stype === _scope_type_1.ScopeType.Method) {\r\n return [node];\r\n }\r\n let ret = [];\r\n for (const c of node.getChildren()) {\r\n ret = ret.concat(this.findScopeCandidates(c));\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.PreferInline = PreferInline;\r\n//# sourceMappingURL=prefer_inline.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/prefer_inline.js?");
|
|
12911
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.PreferInline = exports.PreferInlineConf = 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 _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 version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.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 _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass PreferInlineConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.PreferInlineConf = PreferInlineConf;\r\nclass PreferInline {\r\n constructor() {\r\n this.conf = new PreferInlineConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"prefer_inline\",\r\n title: \"Prefer Inline Declarations\",\r\n shortDescription: `Prefer inline to up-front declarations.`,\r\n extendedInformation: `EXPERIMENTAL\r\n\r\nActivates if language version is v740sp02 or above.\r\n\r\nVariables must be local(METHOD or FORM).\r\n\r\nNo generic or void typed variables. No syntax errors.\r\n\r\nFirst position used must be a full/pure write.\r\n\r\nMove statment is not a cast(?=)\r\n\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-inline-to-up-front-declarations`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Upport, _irule_1.RuleTag.Experimental, _irule_1.RuleTag.Quickfix],\r\n badExample: `DATA foo TYPE i.\r\nfoo = 2.\r\nDATA percentage TYPE decfloat34.\r\npercentage = ( comment_number / abs_statement_number ) * 100.`,\r\n goodExample: `DATA(foo) = 2.\r\nDATA(percentage) = CONV decfloat34( comment_number / abs_statement_number ) * 100.`,\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n run(obj) {\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n if (this.reg.getConfig().getVersion() < version_1.Version.v740sp02 && this.reg.getConfig().getVersion() !== version_1.Version.Cloud) {\r\n return [];\r\n }\r\n else if (!(obj instanceof _abap_object_1.ABAPObject)) {\r\n return [];\r\n }\r\n const run = new syntax_1.SyntaxLogic(this.reg, obj).run();\r\n if (run.issues.length > 0) {\r\n return [];\r\n }\r\n const scopes = this.findScopeCandidates(run.spaghetti.getTop());\r\n const ret = [];\r\n for (const s of scopes) {\r\n ret.push(...this.analyzeScope(s, obj));\r\n }\r\n return ret;\r\n }\r\n ///////////////////////////\r\n analyzeScope(node, obj) {\r\n var _a, _b;\r\n const ret = [];\r\n const vars = node.getData().vars;\r\n for (const name in vars) {\r\n const identifier = vars[name];\r\n if (this.isLocalDefinition(node, identifier) === false\r\n || identifier.getMeta().includes(\"inline\" /* IdentifierMeta.InlineDefinition */)\r\n || identifier.getMeta().includes(\"form_parameter\" /* IdentifierMeta.FormParameter */)) {\r\n continue;\r\n }\r\n else if (identifier.getType().isGeneric() === true) {\r\n continue;\r\n }\r\n else if (identifier.getType().containsVoid() === true) {\r\n continue;\r\n }\r\n const write = this.firstUseIsWrite(node, identifier);\r\n if (write === undefined) {\r\n continue;\r\n }\r\n // check that it is a pure write, eg not sub component assignment\r\n const next = this.findNextToken(write, obj);\r\n if (next === undefined) {\r\n continue;\r\n }\r\n else if ((next === null || next === void 0 ? void 0 : next.getStart().equals(write.position.getEnd())) && next.getStr() !== \".\" && next.getStr() !== \",\") {\r\n continue;\r\n }\r\n const file = obj.getABAPFileByName(identifier.getFilename());\r\n const writeStatement = edit_helper_1.EditHelper.findStatement(next, file);\r\n const statementType = writeStatement === null || writeStatement === void 0 ? void 0 : writeStatement.get();\r\n if (statementType === undefined) {\r\n continue;\r\n }\r\n // for now only allow some specific target statements, todo refactor\r\n if (!(statementType instanceof Statements.Move\r\n || statementType instanceof Statements.Catch\r\n || statementType instanceof Statements.ReadTable\r\n || statementType instanceof Statements.Loop)\r\n || ((_a = writeStatement === null || writeStatement === void 0 ? void 0 : writeStatement.concatTokens()) === null || _a === void 0 ? void 0 : _a.includes(\"?=\"))\r\n || ((_b = writeStatement === null || writeStatement === void 0 ? void 0 : writeStatement.concatTokens()) === null || _b === void 0 ? void 0 : _b.includes(\" #(\"))) {\r\n continue;\r\n }\r\n const statement = edit_helper_1.EditHelper.findStatement(identifier.getToken(), file);\r\n const concat = statement === null || statement === void 0 ? void 0 : statement.concatTokens().toUpperCase();\r\n if (concat === null || concat === void 0 ? void 0 : concat.includes(\"BEGIN OF\")) {\r\n continue;\r\n }\r\n let fix = undefined;\r\n if (file && statement) {\r\n const fix1 = edit_helper_1.EditHelper.deleteStatement(file, statement);\r\n const name = identifier.getName();\r\n const replace = name.startsWith(\"<\") ? \"FIELD-SYMBOL(\" + name + \")\" : \"DATA(\" + name + \")\";\r\n const fix2 = edit_helper_1.EditHelper.replaceRange(file, write.position.getStart(), write.position.getEnd(), replace);\r\n fix = edit_helper_1.EditHelper.merge(fix1, fix2);\r\n }\r\n const message = this.getMetadata().title + \", \" + name;\r\n ret.push(issue_1.Issue.atIdentifier(identifier, message, this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n return ret;\r\n }\r\n ////////////////////////\r\n findNextToken(ref, obj) {\r\n const file = obj.getABAPFileByName(ref.resolved.getFilename());\r\n if (file === undefined) {\r\n return undefined;\r\n }\r\n for (const t of file.getTokens()) {\r\n if (t.getStart().isAfter(ref.position.getEnd())) {\r\n return t;\r\n }\r\n }\r\n return undefined;\r\n }\r\n firstUseIsWrite(node, identifier) {\r\n // assumption: variables are local, so only the current scope must be searched\r\n var _a, _b, _c;\r\n for (const r of node.getData().references) {\r\n if (r.referenceType === _reference_1.ReferenceType.TypeReference\r\n && ((_a = r.resolved) === null || _a === void 0 ? void 0 : _a.getStart().equals(identifier.getStart())) === true) {\r\n return undefined;\r\n }\r\n }\r\n let firstRead = undefined;\r\n for (const r of node.getData().references) {\r\n if (r.referenceType !== _reference_1.ReferenceType.DataReadReference\r\n || ((_b = r.resolved) === null || _b === void 0 ? void 0 : _b.getStart().equals(identifier.getStart())) === false) {\r\n continue;\r\n }\r\n if (r.resolved) {\r\n firstRead = { position: r.position, resolved: r.resolved };\r\n break;\r\n }\r\n }\r\n let firstWrite = undefined;\r\n for (const w of node.getData().references) {\r\n if (w.referenceType !== _reference_1.ReferenceType.DataWriteReference\r\n || ((_c = w.resolved) === null || _c === void 0 ? void 0 : _c.getStart().equals(identifier.getStart())) === false) {\r\n continue;\r\n }\r\n if (w.resolved) {\r\n firstWrite = { position: w.position, resolved: w.resolved };\r\n break;\r\n }\r\n }\r\n if (firstRead === undefined) {\r\n return firstWrite;\r\n }\r\n else if (firstWrite === undefined) {\r\n return undefined;\r\n }\r\n else if (firstWrite.position.getStart().getRow() === firstRead.position.getStart().getRow()) {\r\n // if the same statement both reads and write the same variable\r\n // note that currently just the line number is compared, this is not correct, it should check if its the same statement\r\n return undefined;\r\n }\r\n else if (firstWrite.position.getStart().isBefore(firstRead.position.getStart())) {\r\n return firstWrite;\r\n }\r\n return undefined;\r\n }\r\n isLocalDefinition(node, identifier) {\r\n const { start, end } = node.calcCoverage();\r\n if (identifier.getStart().isAfter(start) && identifier.getStart().isBefore(end)) {\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n findScopeCandidates(node) {\r\n if (node.getIdentifier().stype === _scope_type_1.ScopeType.Form\r\n || node.getIdentifier().stype === _scope_type_1.ScopeType.Method) {\r\n return [node];\r\n }\r\n let ret = [];\r\n for (const c of node.getChildren()) {\r\n ret = ret.concat(this.findScopeCandidates(c));\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.PreferInline = PreferInline;\r\n//# sourceMappingURL=prefer_inline.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/prefer_inline.js?");
|
|
12912
12912
|
|
|
12913
12913
|
/***/ }),
|
|
12914
12914
|
|
|
@@ -12919,7 +12919,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12919
12919
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12920
12920
|
|
|
12921
12921
|
"use strict";
|
|
12922
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.PreferIsNot = exports.PreferIsNotConf = void 0;\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 Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/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 edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass PreferIsNotConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.PreferIsNotConf = PreferIsNotConf;\r\nclass PreferIsNot extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new PreferIsNotConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"prefer_is_not\",\r\n title: \"Prefer IS NOT to NOT IS\",\r\n shortDescription: `Prefer IS NOT to NOT IS`,\r\n extendedInformation: `\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-is-not-to-not-is\n\n\"if not is_valid( ).\" examples are skipped`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n goodExample: `IF variable IS NOT INITIAL.\nIF variable NP 'TODO*'.\nIF variable <> 42.`,\r\n badExample: `IF NOT variable IS INITIAL.\nIF NOT variable CP 'TODO*'.\nIF NOT variable = 42.`,\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 const issues = [];\r\n for (const s of file.getStatements()) {\r\n for (const c of s.findAllExpressions(Expressions.Compare)) {\r\n if (c.concatTokens().toUpperCase().startsWith(\"NOT \") === false) {\r\n continue;\r\n }\r\n else if (c.getChildren().length === 2 && c.getChildren()[1].get() instanceof Expressions.MethodCallChain) {\r\n continue;\r\n }\r\n const message = \"Prefer IS NOT to NOT IS\";\r\n const fix = this.getFix(file, c);\r\n issues.push(issue_1.Issue.atToken(file, c.getFirstToken(), message, this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n }\r\n return issues;\r\n }\r\n getFix(file, c) {\r\n let insertFix;\r\n if (c.getChildren()[2].getFirstToken().getStr().toUpperCase() === \"IS\") {\r\n const tokenPositionBeforeDelete = c.getChildren()[2].getLastToken().getEnd();\r\n const tokenPosition = new position_1.Position(tokenPositionBeforeDelete.getRow(), tokenPositionBeforeDelete.getCol() + 1);\r\n insertFix = edit_helper_1.EditHelper.insertAt(file, tokenPosition, \"NOT \");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr().toUpperCase() === \"IN\" || c.getChildren()[2].getFirstToken().getStr().toUpperCase() === \"BETWEEN\") {\r\n const tokenPositionBeforeDelete = c.getChildren()[1].getLastToken().getEnd();\r\n const tokenPosition = new position_1.Position(tokenPositionBeforeDelete.getRow(), tokenPositionBeforeDelete.getCol() + 1);\r\n insertFix = edit_helper_1.EditHelper.insertAt(file, tokenPosition, \"NOT \");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr() === \"=\") {\r\n insertFix = edit_helper_1.EditHelper.replaceToken(file, c.getChildren()[2].getLastToken(), \"<>\");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr() === \"<>\") {\r\n insertFix = edit_helper_1.EditHelper.replaceToken(file, c.getChildren()[2].getLastToken(), \"=\");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr() === \"<\") {\r\n insertFix = edit_helper_1.EditHelper.replaceToken(file, c.getChildren()[2].getLastToken(), \">\");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr() === \">\") {\r\n insertFix = edit_helper_1.EditHelper.replaceToken(file, c.getChildren()[2].getLastToken(), \"<\");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr() === \"<=\") {\r\n insertFix = edit_helper_1.EditHelper.replaceToken(file, c.getChildren()[2].getLastToken(), \">=\");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr() === \">=\") {\r\n insertFix = edit_helper_1.EditHelper.replaceToken(file, c.getChildren()[2].getLastToken(), \"<=\");\r\n }\r\n else {\r\n return;\r\n }\r\n const endCol = c.getChildren()[0].getFirstToken().getEnd().getCol() + 1;\r\n const endPosition = new position_1.Position(c.getChildren()[0].getFirstToken().getEnd().getRow(), endCol);\r\n const deleteFix = edit_helper_1.EditHelper.deleteRange(file, c.getChildren()[0].getFirstToken().getStart(), endPosition);\r\n const finalFix = edit_helper_1.EditHelper.merge(insertFix, deleteFix);\r\n return finalFix;\r\n }\r\n}\r\nexports.PreferIsNot = PreferIsNot;\r\n//# sourceMappingURL=prefer_is_not.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/prefer_is_not.js?");
|
|
12922
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.PreferIsNot = exports.PreferIsNotConf = void 0;\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 Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/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 edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass PreferIsNotConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.PreferIsNotConf = PreferIsNotConf;\r\nclass PreferIsNot extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new PreferIsNotConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"prefer_is_not\",\r\n title: \"Prefer IS NOT to NOT IS\",\r\n shortDescription: `Prefer IS NOT to NOT IS`,\r\n extendedInformation: `\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-is-not-to-not-is\r\n\r\n\"if not is_valid( ).\" examples are skipped`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n goodExample: `IF variable IS NOT INITIAL.\r\nIF variable NP 'TODO*'.\r\nIF variable <> 42.`,\r\n badExample: `IF NOT variable IS INITIAL.\r\nIF NOT variable CP 'TODO*'.\r\nIF NOT variable = 42.`,\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 const issues = [];\r\n for (const s of file.getStatements()) {\r\n for (const c of s.findAllExpressions(Expressions.Compare)) {\r\n if (c.concatTokens().toUpperCase().startsWith(\"NOT \") === false) {\r\n continue;\r\n }\r\n else if (c.getChildren().length === 2 && c.getChildren()[1].get() instanceof Expressions.MethodCallChain) {\r\n continue;\r\n }\r\n const message = \"Prefer IS NOT to NOT IS\";\r\n const fix = this.getFix(file, c);\r\n issues.push(issue_1.Issue.atToken(file, c.getFirstToken(), message, this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n }\r\n return issues;\r\n }\r\n getFix(file, c) {\r\n let insertFix;\r\n if (c.getChildren()[2].getFirstToken().getStr().toUpperCase() === \"IS\") {\r\n const tokenPositionBeforeDelete = c.getChildren()[2].getLastToken().getEnd();\r\n const tokenPosition = new position_1.Position(tokenPositionBeforeDelete.getRow(), tokenPositionBeforeDelete.getCol() + 1);\r\n insertFix = edit_helper_1.EditHelper.insertAt(file, tokenPosition, \"NOT \");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr().toUpperCase() === \"IN\" || c.getChildren()[2].getFirstToken().getStr().toUpperCase() === \"BETWEEN\") {\r\n const tokenPositionBeforeDelete = c.getChildren()[1].getLastToken().getEnd();\r\n const tokenPosition = new position_1.Position(tokenPositionBeforeDelete.getRow(), tokenPositionBeforeDelete.getCol() + 1);\r\n insertFix = edit_helper_1.EditHelper.insertAt(file, tokenPosition, \"NOT \");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr() === \"=\") {\r\n insertFix = edit_helper_1.EditHelper.replaceToken(file, c.getChildren()[2].getLastToken(), \"<>\");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr() === \"<>\") {\r\n insertFix = edit_helper_1.EditHelper.replaceToken(file, c.getChildren()[2].getLastToken(), \"=\");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr() === \"<\") {\r\n insertFix = edit_helper_1.EditHelper.replaceToken(file, c.getChildren()[2].getLastToken(), \">\");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr() === \">\") {\r\n insertFix = edit_helper_1.EditHelper.replaceToken(file, c.getChildren()[2].getLastToken(), \"<\");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr() === \"<=\") {\r\n insertFix = edit_helper_1.EditHelper.replaceToken(file, c.getChildren()[2].getLastToken(), \">=\");\r\n }\r\n else if (c.getChildren()[2].getFirstToken().getStr() === \">=\") {\r\n insertFix = edit_helper_1.EditHelper.replaceToken(file, c.getChildren()[2].getLastToken(), \"<=\");\r\n }\r\n else {\r\n return;\r\n }\r\n const endCol = c.getChildren()[0].getFirstToken().getEnd().getCol() + 1;\r\n const endPosition = new position_1.Position(c.getChildren()[0].getFirstToken().getEnd().getRow(), endCol);\r\n const deleteFix = edit_helper_1.EditHelper.deleteRange(file, c.getChildren()[0].getFirstToken().getStart(), endPosition);\r\n const finalFix = edit_helper_1.EditHelper.merge(insertFix, deleteFix);\r\n return finalFix;\r\n }\r\n}\r\nexports.PreferIsNot = PreferIsNot;\r\n//# sourceMappingURL=prefer_is_not.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/prefer_is_not.js?");
|
|
12923
12923
|
|
|
12924
12924
|
/***/ }),
|
|
12925
12925
|
|
|
@@ -12930,7 +12930,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12930
12930
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12931
12931
|
|
|
12932
12932
|
"use strict";
|
|
12933
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.PreferRaiseExceptionNew = exports.PreferRaiseExceptionNewConf = void 0;\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 edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst __1 = __webpack_require__(/*! .. */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nclass PreferRaiseExceptionNewConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.PreferRaiseExceptionNewConf = PreferRaiseExceptionNewConf;\r\nclass PreferRaiseExceptionNew extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new PreferRaiseExceptionNewConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"prefer_raise_exception_new\",\r\n title: \"Prefer RAISE EXCEPTION NEW to RAISE EXCEPTION TYPE\",\r\n shortDescription: `Prefer RAISE EXCEPTION NEW to RAISE EXCEPTION TYPE`,\r\n extendedInformation: `\n https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-raise-exception-new-to-raise-exception-type`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],\r\n goodExample: `RAISE EXCEPTION NEW cx_generation_error( previous = exception ).`,\r\n badExample: `RAISE EXCEPTION TYPE cx_generation_error\n EXPORTING\n previous = exception.`,\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 if (this.reg.getConfig().getVersion() < __1.Version.v752) {\r\n return [];\r\n }\r\n const issues = [];\r\n for (const statement of file.getStatements()) {\r\n if (statement.get() instanceof __1.Statements.Raise) {\r\n const concat = statement.concatTokens().toUpperCase();\r\n if (concat.includes(\" MESSAGE\")) {\r\n continue;\r\n }\r\n if (concat.startsWith(\"RAISE EXCEPTION TYPE \")) {\r\n const message = \"Prefer RAISE EXCEPTION NEW to RAISE EXCEPTION TYPE\";\r\n const fix = this.getFix(file, statement, concat.includes(\" EXPORTING\") ? true : false);\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n getFix(file, statement, withExporting) {\r\n const children = statement.getChildren();\r\n let contentFix = undefined;\r\n if (withExporting) {\r\n const fixText = \"( \" + children[5].concatTokens() + \" ).\";\r\n contentFix = edit_helper_1.EditHelper.replaceRange(file, children[3].getLastToken().getEnd(), statement.getEnd(), fixText);\r\n }\r\n else {\r\n contentFix = edit_helper_1.EditHelper.replaceRange(file, children[3].getLastToken().getEnd(), statement.getEnd(), \"( ).\");\r\n }\r\n const replaceType = edit_helper_1.EditHelper.replaceToken(file, children[2].getFirstToken(), \"NEW\");\r\n return edit_helper_1.EditHelper.merge(contentFix, replaceType);\r\n }\r\n}\r\nexports.PreferRaiseExceptionNew = PreferRaiseExceptionNew;\r\n//# sourceMappingURL=prefer_raise_exception_new.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/prefer_raise_exception_new.js?");
|
|
12933
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.PreferRaiseExceptionNew = exports.PreferRaiseExceptionNewConf = void 0;\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 edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst __1 = __webpack_require__(/*! .. */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nclass PreferRaiseExceptionNewConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.PreferRaiseExceptionNewConf = PreferRaiseExceptionNewConf;\r\nclass PreferRaiseExceptionNew extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new PreferRaiseExceptionNewConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"prefer_raise_exception_new\",\r\n title: \"Prefer RAISE EXCEPTION NEW to RAISE EXCEPTION TYPE\",\r\n shortDescription: `Prefer RAISE EXCEPTION NEW to RAISE EXCEPTION TYPE`,\r\n extendedInformation: `\r\n https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-raise-exception-new-to-raise-exception-type`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],\r\n goodExample: `RAISE EXCEPTION NEW cx_generation_error( previous = exception ).`,\r\n badExample: `RAISE EXCEPTION TYPE cx_generation_error\r\n EXPORTING\r\n previous = exception.`,\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 if (this.reg.getConfig().getVersion() < __1.Version.v752) {\r\n return [];\r\n }\r\n const issues = [];\r\n for (const statement of file.getStatements()) {\r\n if (statement.get() instanceof __1.Statements.Raise) {\r\n const concat = statement.concatTokens().toUpperCase();\r\n if (concat.includes(\" MESSAGE\")) {\r\n continue;\r\n }\r\n if (concat.startsWith(\"RAISE EXCEPTION TYPE \")) {\r\n const message = \"Prefer RAISE EXCEPTION NEW to RAISE EXCEPTION TYPE\";\r\n const fix = this.getFix(file, statement, concat.includes(\" EXPORTING\") ? true : false);\r\n issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n getFix(file, statement, withExporting) {\r\n const children = statement.getChildren();\r\n let contentFix = undefined;\r\n if (withExporting) {\r\n const fixText = \"( \" + children[5].concatTokens() + \" ).\";\r\n contentFix = edit_helper_1.EditHelper.replaceRange(file, children[3].getLastToken().getEnd(), statement.getEnd(), fixText);\r\n }\r\n else {\r\n contentFix = edit_helper_1.EditHelper.replaceRange(file, children[3].getLastToken().getEnd(), statement.getEnd(), \"( ).\");\r\n }\r\n const replaceType = edit_helper_1.EditHelper.replaceToken(file, children[2].getFirstToken(), \"NEW\");\r\n return edit_helper_1.EditHelper.merge(contentFix, replaceType);\r\n }\r\n}\r\nexports.PreferRaiseExceptionNew = PreferRaiseExceptionNew;\r\n//# sourceMappingURL=prefer_raise_exception_new.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/prefer_raise_exception_new.js?");
|
|
12934
12934
|
|
|
12935
12935
|
/***/ }),
|
|
12936
12936
|
|
|
@@ -12941,7 +12941,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12941
12941
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12942
12942
|
|
|
12943
12943
|
"use strict";
|
|
12944
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.PreferReturningToExporting = exports.PreferReturningToExportingConf = void 0;\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 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 _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass PreferReturningToExportingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.PreferReturningToExportingConf = PreferReturningToExportingConf;\r\nclass PreferReturningToExporting extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new PreferReturningToExportingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"prefer_returning_to_exporting\",\r\n title: \"Prefer RETURNING to EXPORTING\",\r\n shortDescription: `Prefer RETURNING to EXPORTING. Generic types cannot be RETURNING.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-returning-to-exporting\nhttps://docs.abapopenchecks.org/checks/44/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\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 const ret = [];\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return [];\r\n }\r\n for (const def of stru.findAllStatements(Statements.MethodDef)) {\r\n if (def.findFirstExpression(Expressions.MethodDefChanging)) {\r\n continue;\r\n }\r\n const exporting = def.findFirstExpression(Expressions.MethodDefExporting);\r\n if (exporting === undefined) {\r\n continue;\r\n }\r\n const returning = def.findFirstExpression(Expressions.MethodDefReturning);\r\n if (returning !== undefined) {\r\n continue;\r\n }\r\n const params = exporting.findDirectExpressions(Expressions.MethodParam);\r\n if (params.length !== 1) {\r\n continue;\r\n }\r\n const concat = params[0].concatTokens().toUpperCase();\r\n if (concat.endsWith(\"TYPE ANY\")\r\n || concat.endsWith(\"TYPE ANY TABLE\")\r\n || concat.endsWith(\"TYPE C\")\r\n || concat.endsWith(\"TYPE CLIKE\")\r\n || concat.endsWith(\"TYPE CSEQUENCE\")\r\n || concat.endsWith(\"TYPE DATA\")\r\n || concat.endsWith(\"TYPE DECFLOAT\")\r\n || concat.endsWith(\"TYPE HASHED TABLE\")\r\n || concat.endsWith(\"TYPE INDEX TABLE\")\r\n || concat.endsWith(\"TYPE N\")\r\n || concat.endsWith(\"TYPE NUMERIC\")\r\n || concat.endsWith(\"TYPE OBJECT\")\r\n || concat.endsWith(\"TYPE P\")\r\n || concat.endsWith(\"TYPE SIMPLE\")\r\n || concat.endsWith(\"TYPE SORTED TABLE\")\r\n || concat.endsWith(\"TYPE STANDARD TABLE\")\r\n || concat.endsWith(\"TYPE TABLE\")\r\n || concat.endsWith(\"TYPE X\")\r\n || concat.endsWith(\"TYPE XSEQUENCE\")) {\r\n continue;\r\n }\r\n const token = params[0].getFirstToken();\r\n const issue = issue_1.Issue.atToken(file, token, \"Prefer RETURNING to EXPORTING\", this.getMetadata().key, this.conf.severity);\r\n ret.push(issue);\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.PreferReturningToExporting = PreferReturningToExporting;\r\n//# sourceMappingURL=prefer_returning_to_exporting.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/prefer_returning_to_exporting.js?");
|
|
12944
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.PreferReturningToExporting = exports.PreferReturningToExportingConf = void 0;\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 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 _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ \"./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass PreferReturningToExportingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.PreferReturningToExportingConf = PreferReturningToExportingConf;\r\nclass PreferReturningToExporting extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new PreferReturningToExportingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"prefer_returning_to_exporting\",\r\n title: \"Prefer RETURNING to EXPORTING\",\r\n shortDescription: `Prefer RETURNING to EXPORTING. Generic types cannot be RETURNING.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-returning-to-exporting\r\nhttps://docs.abapopenchecks.org/checks/44/`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\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 const ret = [];\r\n const stru = file.getStructure();\r\n if (stru === undefined) {\r\n return [];\r\n }\r\n for (const def of stru.findAllStatements(Statements.MethodDef)) {\r\n if (def.findFirstExpression(Expressions.MethodDefChanging)) {\r\n continue;\r\n }\r\n const exporting = def.findFirstExpression(Expressions.MethodDefExporting);\r\n if (exporting === undefined) {\r\n continue;\r\n }\r\n const returning = def.findFirstExpression(Expressions.MethodDefReturning);\r\n if (returning !== undefined) {\r\n continue;\r\n }\r\n const params = exporting.findDirectExpressions(Expressions.MethodParam);\r\n if (params.length !== 1) {\r\n continue;\r\n }\r\n const concat = params[0].concatTokens().toUpperCase();\r\n if (concat.endsWith(\"TYPE ANY\")\r\n || concat.endsWith(\"TYPE ANY TABLE\")\r\n || concat.endsWith(\"TYPE C\")\r\n || concat.endsWith(\"TYPE CLIKE\")\r\n || concat.endsWith(\"TYPE CSEQUENCE\")\r\n || concat.endsWith(\"TYPE DATA\")\r\n || concat.endsWith(\"TYPE DECFLOAT\")\r\n || concat.endsWith(\"TYPE HASHED TABLE\")\r\n || concat.endsWith(\"TYPE INDEX TABLE\")\r\n || concat.endsWith(\"TYPE N\")\r\n || concat.endsWith(\"TYPE NUMERIC\")\r\n || concat.endsWith(\"TYPE OBJECT\")\r\n || concat.endsWith(\"TYPE P\")\r\n || concat.endsWith(\"TYPE SIMPLE\")\r\n || concat.endsWith(\"TYPE SORTED TABLE\")\r\n || concat.endsWith(\"TYPE STANDARD TABLE\")\r\n || concat.endsWith(\"TYPE TABLE\")\r\n || concat.endsWith(\"TYPE X\")\r\n || concat.endsWith(\"TYPE XSEQUENCE\")) {\r\n continue;\r\n }\r\n const token = params[0].getFirstToken();\r\n const issue = issue_1.Issue.atToken(file, token, \"Prefer RETURNING to EXPORTING\", this.getMetadata().key, this.conf.severity);\r\n ret.push(issue);\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.PreferReturningToExporting = PreferReturningToExporting;\r\n//# sourceMappingURL=prefer_returning_to_exporting.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/prefer_returning_to_exporting.js?");
|
|
12945
12945
|
|
|
12946
12946
|
/***/ }),
|
|
12947
12947
|
|
|
@@ -12952,7 +12952,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12952
12952
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12953
12953
|
|
|
12954
12954
|
"use strict";
|
|
12955
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.PreferXsdbool = exports.PreferXsdboolConf = void 0;\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 Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/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 _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\nclass PreferXsdboolConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.PreferXsdboolConf = PreferXsdboolConf;\r\nclass PreferXsdbool extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new PreferXsdboolConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"prefer_xsdbool\",\r\n title: \"Prefer xsdbool over boolc\",\r\n shortDescription: `Prefer xsdbool over boolc`,\r\n extendedInformation: `Activates if language version is v740sp08 or above.\n\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-xsdbool-to-set-boolean-variables`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Upport, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n badExample: `DATA(sdf) = boolc( 1 = 2 ).`,\r\n goodExample: `DATA(sdf) = xsdbool( 1 = 2 ).`,\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;\r\n const issues = [];\r\n if (this.reg.getConfig().getVersion() < version_1.Version.v740sp08 && this.reg.getConfig().getVersion() !== version_1.Version.Cloud) {\r\n return [];\r\n }\r\n for (const s of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllExpressions(Expressions.Source)) || []) {\r\n if (s.concatTokens().toUpperCase().startsWith(\"BOOLC( \") === false) {\r\n continue;\r\n }\r\n const token = s.getFirstToken();\r\n const message = \"Prefer xsdbool over boolc\";\r\n const fix = edit_helper_1.EditHelper.replaceToken(file, token, \"xsdbool\");\r\n issues.push(issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.PreferXsdbool = PreferXsdbool;\r\n//# sourceMappingURL=prefer_xsdbool.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/prefer_xsdbool.js?");
|
|
12955
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.PreferXsdbool = exports.PreferXsdboolConf = void 0;\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 Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/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 _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\nclass PreferXsdboolConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.PreferXsdboolConf = PreferXsdboolConf;\r\nclass PreferXsdbool extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new PreferXsdboolConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"prefer_xsdbool\",\r\n title: \"Prefer xsdbool over boolc\",\r\n shortDescription: `Prefer xsdbool over boolc`,\r\n extendedInformation: `Activates if language version is v740sp08 or above.\r\n\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-xsdbool-to-set-boolean-variables`,\r\n tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Upport, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n badExample: `DATA(sdf) = boolc( 1 = 2 ).`,\r\n goodExample: `DATA(sdf) = xsdbool( 1 = 2 ).`,\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;\r\n const issues = [];\r\n if (this.reg.getConfig().getVersion() < version_1.Version.v740sp08 && this.reg.getConfig().getVersion() !== version_1.Version.Cloud) {\r\n return [];\r\n }\r\n for (const s of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllExpressions(Expressions.Source)) || []) {\r\n if (s.concatTokens().toUpperCase().startsWith(\"BOOLC( \") === false) {\r\n continue;\r\n }\r\n const token = s.getFirstToken();\r\n const message = \"Prefer xsdbool over boolc\";\r\n const fix = edit_helper_1.EditHelper.replaceToken(file, token, \"xsdbool\");\r\n issues.push(issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.PreferXsdbool = PreferXsdbool;\r\n//# sourceMappingURL=prefer_xsdbool.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/prefer_xsdbool.js?");
|
|
12956
12956
|
|
|
12957
12957
|
/***/ }),
|
|
12958
12958
|
|
|
@@ -13007,7 +13007,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
13007
13007
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13008
13008
|
|
|
13009
13009
|
"use strict";
|
|
13010
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.RemoveDescriptions = exports.RemoveDescriptionsConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst fast_xml_parser_1 = __webpack_require__(/*! fast-xml-parser */ \"./node_modules/fast-xml-parser/src/fxp.js\");\r\nconst Objects = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/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 position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nconst xml_utils_1 = __webpack_require__(/*! ../xml_utils */ \"./node_modules/@abaplint/core/build/src/xml_utils.js\");\r\nclass RemoveDescriptionsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Ignore global exception classes */\r\n this.ignoreExceptions = false;\r\n /** Ignore global workflow classes */\r\n this.ignoreWorkflow = true;\r\n }\r\n}\r\nexports.RemoveDescriptionsConf = RemoveDescriptionsConf;\r\nclass RemoveDescriptions {\r\n constructor() {\r\n this.conf = new RemoveDescriptionsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"remove_descriptions\",\r\n title: \"Remove descriptions\",\r\n shortDescription: `Ensures you have no descriptions in metadata of methods, parameters, etc.\n\nClass descriptions are required, see rule description_empty.\n\nConsider using ABAP Doc for documentation.`,\r\n tags: [],\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 initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n // plan is omitting knowledge about descriptions in abaplint, so this rule must parse the XML\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n if (obj instanceof Objects.Class) {\r\n let def;\r\n try {\r\n def = obj.getClassDefinition();\r\n }\r\n catch (_a) {\r\n return [];\r\n }\r\n if (def === undefined) {\r\n return [];\r\n }\r\n else if (this.conf.ignoreExceptions && ddic.isException(def, obj)) {\r\n return [];\r\n }\r\n else if (this.conf.ignoreWorkflow === true && def.interfaces.find(e => e.name.toUpperCase() === \"IF_WORKFLOW\")) {\r\n return [];\r\n }\r\n return this.checkClass(obj);\r\n }\r\n else if (obj instanceof Objects.Interface) {\r\n return this.checkInterface(obj);\r\n }\r\n return [];\r\n }\r\n //////////////\r\n checkInterface(obj) {\r\n const xml = obj.getXML();\r\n if (xml === undefined) {\r\n return [];\r\n }\r\n const file = obj.getXMLFile();\r\n if (file === undefined) {\r\n return [];\r\n }\r\n return this.checkXML(xml, file);\r\n }\r\n checkClass(obj) {\r\n const xml = obj.getXML();\r\n if (xml === undefined) {\r\n return [];\r\n }\r\n const file = obj.getXMLFile();\r\n if (file === undefined) {\r\n return [];\r\n }\r\n return this.checkXML(xml, file);\r\n }\r\n checkXML(xml, file) {\r\n const parsed = new fast_xml_parser_1.XMLParser({ parseTagValue: false, ignoreAttributes: true, trimValues: false }).parse(xml);\r\n if (parsed === undefined || parsed.abapGit[\"asx:abap\"][\"asx:values\"] === undefined) {\r\n return [];\r\n }\r\n const desc = parsed.abapGit[\"asx:abap\"][\"asx:values\"].DESCRIPTIONS;\r\n if (desc === undefined) {\r\n return [];\r\n }\r\n const reported = {}; // there might be multiple translations\r\n const ret = [];\r\n for (const d of (0, xml_utils_1.xmlToArray)(desc.SEOCOMPOTX)) {\r\n const message = \"Remove description for \" + d.CMPNAME;\r\n if (reported[d.CMPNAME] !== undefined) {\r\n continue;\r\n }\r\n const position = new position_1.Position(1, 1);\r\n const issue = issue_1.Issue.atPosition(file, position, message, this.getMetadata().key, this.conf.severity);\r\n ret.push(issue);\r\n reported[d.CMPNAME] = true;\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.RemoveDescriptions = RemoveDescriptions;\r\n//# sourceMappingURL=remove_descriptions.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/remove_descriptions.js?");
|
|
13010
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.RemoveDescriptions = exports.RemoveDescriptionsConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst fast_xml_parser_1 = __webpack_require__(/*! fast-xml-parser */ \"./node_modules/fast-xml-parser/src/fxp.js\");\r\nconst Objects = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/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 position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nconst xml_utils_1 = __webpack_require__(/*! ../xml_utils */ \"./node_modules/@abaplint/core/build/src/xml_utils.js\");\r\nclass RemoveDescriptionsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** Ignore global exception classes */\r\n this.ignoreExceptions = false;\r\n /** Ignore global workflow classes */\r\n this.ignoreWorkflow = true;\r\n }\r\n}\r\nexports.RemoveDescriptionsConf = RemoveDescriptionsConf;\r\nclass RemoveDescriptions {\r\n constructor() {\r\n this.conf = new RemoveDescriptionsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"remove_descriptions\",\r\n title: \"Remove descriptions\",\r\n shortDescription: `Ensures you have no descriptions in metadata of methods, parameters, etc.\r\n\r\nClass descriptions are required, see rule description_empty.\r\n\r\nConsider using ABAP Doc for documentation.`,\r\n tags: [],\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 initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n // plan is omitting knowledge about descriptions in abaplint, so this rule must parse the XML\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n if (obj instanceof Objects.Class) {\r\n let def;\r\n try {\r\n def = obj.getClassDefinition();\r\n }\r\n catch (_a) {\r\n return [];\r\n }\r\n if (def === undefined) {\r\n return [];\r\n }\r\n else if (this.conf.ignoreExceptions && ddic.isException(def, obj)) {\r\n return [];\r\n }\r\n else if (this.conf.ignoreWorkflow === true && def.interfaces.find(e => e.name.toUpperCase() === \"IF_WORKFLOW\")) {\r\n return [];\r\n }\r\n return this.checkClass(obj);\r\n }\r\n else if (obj instanceof Objects.Interface) {\r\n return this.checkInterface(obj);\r\n }\r\n return [];\r\n }\r\n //////////////\r\n checkInterface(obj) {\r\n const xml = obj.getXML();\r\n if (xml === undefined) {\r\n return [];\r\n }\r\n const file = obj.getXMLFile();\r\n if (file === undefined) {\r\n return [];\r\n }\r\n return this.checkXML(xml, file);\r\n }\r\n checkClass(obj) {\r\n const xml = obj.getXML();\r\n if (xml === undefined) {\r\n return [];\r\n }\r\n const file = obj.getXMLFile();\r\n if (file === undefined) {\r\n return [];\r\n }\r\n return this.checkXML(xml, file);\r\n }\r\n checkXML(xml, file) {\r\n const parsed = new fast_xml_parser_1.XMLParser({ parseTagValue: false, ignoreAttributes: true, trimValues: false }).parse(xml);\r\n if (parsed === undefined || parsed.abapGit[\"asx:abap\"][\"asx:values\"] === undefined) {\r\n return [];\r\n }\r\n const desc = parsed.abapGit[\"asx:abap\"][\"asx:values\"].DESCRIPTIONS;\r\n if (desc === undefined) {\r\n return [];\r\n }\r\n const reported = {}; // there might be multiple translations\r\n const ret = [];\r\n for (const d of (0, xml_utils_1.xmlToArray)(desc.SEOCOMPOTX)) {\r\n const message = \"Remove description for \" + d.CMPNAME;\r\n if (reported[d.CMPNAME] !== undefined) {\r\n continue;\r\n }\r\n const position = new position_1.Position(1, 1);\r\n const issue = issue_1.Issue.atPosition(file, position, message, this.getMetadata().key, this.conf.severity);\r\n ret.push(issue);\r\n reported[d.CMPNAME] = true;\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.RemoveDescriptions = RemoveDescriptions;\r\n//# sourceMappingURL=remove_descriptions.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/remove_descriptions.js?");
|
|
13011
13011
|
|
|
13012
13012
|
/***/ }),
|
|
13013
13013
|
|
|
@@ -13018,7 +13018,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
13018
13018
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13019
13019
|
|
|
13020
13020
|
"use strict";
|
|
13021
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.RFCErrorHandling = exports.RFCErrorHandlingConf = void 0;\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 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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass RFCErrorHandlingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.RFCErrorHandlingConf = RFCErrorHandlingConf;\r\nclass RFCErrorHandling extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new RFCErrorHandlingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"rfc_error_handling\",\r\n title: \"RFC error handling\",\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n shortDescription: `Checks that exceptions 'system_failure' and 'communication_failure' are handled in RFC calls`,\r\n extendedInformation: `https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenrfc_exception.htm`,\r\n badExample: `\nCALL FUNCTION 'ZRFC'\n DESTINATION lv_rfc.`,\r\n goodExample: `\nCALL FUNCTION 'ZRFC'\n DESTINATION lv_rfc\n EXCEPTIONS\n system_failure = 1 MESSAGE msg\n communication_failure = 2 MESSAGE msg\n resource_failure = 3\n OTHERS = 4.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"RFC error handling: At least one unhandled exception from SYSTEM_FAILURE, COMMUNICATION_FAILURE, RESOURCE_FAILURE\";\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 output = [];\r\n for (const stat of file.getStatements()) {\r\n const token = stat.getFirstToken();\r\n if (!(stat.get() instanceof Statements.CallFunction)) {\r\n continue;\r\n }\r\n if (!stat.findFirstExpression(Expressions.Destination)) {\r\n continue;\r\n }\r\n const list = stat.findFirstExpression(Expressions.ParameterListExceptions);\r\n if (list === undefined) {\r\n const issue = issue_1.Issue.atToken(file, token, this.getMessage(), this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n continue;\r\n }\r\n const parameters = list.findAllExpressions(Expressions.ParameterName);\r\n const names = [];\r\n for (const par of parameters) {\r\n names.push(par.getFirstToken().getStr().toUpperCase());\r\n }\r\n if (names.indexOf(\"SYSTEM_FAILURE\") < 0\r\n || names.indexOf(\"COMMUNICATION_FAILURE\") < 0\r\n || names.indexOf(\"RESOURCE_FAILURE\") < 0) {\r\n const issue = issue_1.Issue.atToken(file, token, this.getMessage(), this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n continue;\r\n }\r\n }\r\n return output;\r\n }\r\n}\r\nexports.RFCErrorHandling = RFCErrorHandling;\r\n//# sourceMappingURL=rfc_error_handling.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/rfc_error_handling.js?");
|
|
13021
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.RFCErrorHandling = exports.RFCErrorHandlingConf = void 0;\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 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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass RFCErrorHandlingConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.RFCErrorHandlingConf = RFCErrorHandlingConf;\r\nclass RFCErrorHandling extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new RFCErrorHandlingConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"rfc_error_handling\",\r\n title: \"RFC error handling\",\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n shortDescription: `Checks that exceptions 'system_failure' and 'communication_failure' are handled in RFC calls`,\r\n extendedInformation: `https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenrfc_exception.htm`,\r\n badExample: `\r\nCALL FUNCTION 'ZRFC'\r\n DESTINATION lv_rfc.`,\r\n goodExample: `\r\nCALL FUNCTION 'ZRFC'\r\n DESTINATION lv_rfc\r\n EXCEPTIONS\r\n system_failure = 1 MESSAGE msg\r\n communication_failure = 2 MESSAGE msg\r\n resource_failure = 3\r\n OTHERS = 4.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"RFC error handling: At least one unhandled exception from SYSTEM_FAILURE, COMMUNICATION_FAILURE, RESOURCE_FAILURE\";\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 output = [];\r\n for (const stat of file.getStatements()) {\r\n const token = stat.getFirstToken();\r\n if (!(stat.get() instanceof Statements.CallFunction)) {\r\n continue;\r\n }\r\n if (!stat.findFirstExpression(Expressions.Destination)) {\r\n continue;\r\n }\r\n const list = stat.findFirstExpression(Expressions.ParameterListExceptions);\r\n if (list === undefined) {\r\n const issue = issue_1.Issue.atToken(file, token, this.getMessage(), this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n continue;\r\n }\r\n const parameters = list.findAllExpressions(Expressions.ParameterName);\r\n const names = [];\r\n for (const par of parameters) {\r\n names.push(par.getFirstToken().getStr().toUpperCase());\r\n }\r\n if (names.indexOf(\"SYSTEM_FAILURE\") < 0\r\n || names.indexOf(\"COMMUNICATION_FAILURE\") < 0\r\n || names.indexOf(\"RESOURCE_FAILURE\") < 0) {\r\n const issue = issue_1.Issue.atToken(file, token, this.getMessage(), this.getMetadata().key, this.conf.severity);\r\n output.push(issue);\r\n continue;\r\n }\r\n }\r\n return output;\r\n }\r\n}\r\nexports.RFCErrorHandling = RFCErrorHandling;\r\n//# sourceMappingURL=rfc_error_handling.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/rfc_error_handling.js?");
|
|
13022
13022
|
|
|
13023
13023
|
/***/ }),
|
|
13024
13024
|
|
|
@@ -13029,7 +13029,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
13029
13029
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13030
13030
|
|
|
13031
13031
|
"use strict";
|
|
13032
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SelectAddOrderBy = exports.SelectAddOrderByConf = 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 _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 syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst basic_1 = __webpack_require__(/*! ../abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nclass SelectAddOrderByConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.SelectAddOrderByConf = SelectAddOrderByConf;\r\nclass SelectAddOrderBy {\r\n constructor() {\r\n this.conf = new SelectAddOrderByConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"select_add_order_by\",\r\n title: \"SELECT add ORDER BY\",\r\n shortDescription: `SELECTs add ORDER BY clause`,\r\n extendedInformation: `\nThis will make sure that the SELECT statement returns results in the same sequence on different databases\n\nadd ORDER BY PRIMARY KEY if in doubt\n\nIf the target is a sorted/hashed table, no issue is reported`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n run(obj) {\r\n var _a;\r\n const issues = [];\r\n if (!(obj instanceof _abap_object_1.ABAPObject) || obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n const spaghetti = new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti;\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 const selects = stru.findAllStatements(Statements.Select);\r\n selects.push(...stru.findAllStatements(Statements.SelectLoop));\r\n for (const s of selects) {\r\n const c = s.concatTokens().toUpperCase();\r\n if (c.startsWith(\"SELECT SINGLE \")) {\r\n continue;\r\n }\r\n // skip COUNT(*)\r\n const list = s.findAllExpressions(Expressions.SQLField);\r\n if (list.length === 1 && ((_a = list[0].getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.SQLAggregation) {\r\n continue;\r\n }\r\n else if (s.findFirstExpression(Expressions.SQLOrderBy)) {\r\n continue;\r\n }\r\n if (this.isTargetSortedOrHashed(s, spaghetti, file)) {\r\n continue;\r\n }\r\n issues.push(issue_1.Issue.atStatement(file, s, \"Add ORDER BY\", this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n return issues;\r\n }\r\n isTargetSortedOrHashed(s, spaghetti, file) {\r\n var _a, _b;\r\n const target = (_a = s.findFirstExpression(Expressions.SQLIntoTable)) === null || _a === void 0 ? void 0 : _a.findFirstExpression(Expressions.Target);\r\n if (target) {\r\n const start = target.getFirstToken().getStart();\r\n const scope = spaghetti.lookupPosition(start, file.getFilename());\r\n let type = (_b = scope === null || scope === void 0 ? void 0 : scope.findWriteReference(start)) === null || _b === void 0 ? void 0 : _b.getType();\r\n const children = target.getChildren();\r\n if (type instanceof basic_1.StructureType && children.length >= 3 && children[1].concatTokens() === \"-\") {\r\n const found = type.getComponentByName(children[2].concatTokens());\r\n if (found === undefined) {\r\n return false;\r\n }\r\n type = found;\r\n }\r\n if (type instanceof basic_1.TableType\r\n && ((type === null || type === void 0 ? void 0 : type.getAccessType()) === basic_1.TableAccessType.sorted || (type === null || type === void 0 ? void 0 : type.getAccessType()) === basic_1.TableAccessType.hashed)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\nexports.SelectAddOrderBy = SelectAddOrderBy;\r\n//# sourceMappingURL=select_add_order_by.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/select_add_order_by.js?");
|
|
13032
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SelectAddOrderBy = exports.SelectAddOrderByConf = 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 _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 syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst basic_1 = __webpack_require__(/*! ../abap/types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nclass SelectAddOrderByConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.SelectAddOrderByConf = SelectAddOrderByConf;\r\nclass SelectAddOrderBy {\r\n constructor() {\r\n this.conf = new SelectAddOrderByConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"select_add_order_by\",\r\n title: \"SELECT add ORDER BY\",\r\n shortDescription: `SELECTs add ORDER BY clause`,\r\n extendedInformation: `\r\nThis will make sure that the SELECT statement returns results in the same sequence on different databases\r\n\r\nadd ORDER BY PRIMARY KEY if in doubt\r\n\r\nIf the target is a sorted/hashed table, no issue is reported`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getConfig() {\r\n return this.conf;\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n setConfig(conf) {\r\n this.conf = conf;\r\n }\r\n run(obj) {\r\n var _a;\r\n const issues = [];\r\n if (!(obj instanceof _abap_object_1.ABAPObject) || obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n const spaghetti = new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti;\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 const selects = stru.findAllStatements(Statements.Select);\r\n selects.push(...stru.findAllStatements(Statements.SelectLoop));\r\n for (const s of selects) {\r\n const c = s.concatTokens().toUpperCase();\r\n if (c.startsWith(\"SELECT SINGLE \")) {\r\n continue;\r\n }\r\n // skip COUNT(*)\r\n const list = s.findAllExpressions(Expressions.SQLField);\r\n if (list.length === 1 && ((_a = list[0].getFirstChild()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.SQLAggregation) {\r\n continue;\r\n }\r\n else if (s.findFirstExpression(Expressions.SQLOrderBy)) {\r\n continue;\r\n }\r\n if (this.isTargetSortedOrHashed(s, spaghetti, file)) {\r\n continue;\r\n }\r\n issues.push(issue_1.Issue.atStatement(file, s, \"Add ORDER BY\", this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n return issues;\r\n }\r\n isTargetSortedOrHashed(s, spaghetti, file) {\r\n var _a, _b;\r\n const target = (_a = s.findFirstExpression(Expressions.SQLIntoTable)) === null || _a === void 0 ? void 0 : _a.findFirstExpression(Expressions.Target);\r\n if (target) {\r\n const start = target.getFirstToken().getStart();\r\n const scope = spaghetti.lookupPosition(start, file.getFilename());\r\n let type = (_b = scope === null || scope === void 0 ? void 0 : scope.findWriteReference(start)) === null || _b === void 0 ? void 0 : _b.getType();\r\n const children = target.getChildren();\r\n if (type instanceof basic_1.StructureType && children.length >= 3 && children[1].concatTokens() === \"-\") {\r\n const found = type.getComponentByName(children[2].concatTokens());\r\n if (found === undefined) {\r\n return false;\r\n }\r\n type = found;\r\n }\r\n if (type instanceof basic_1.TableType\r\n && ((type === null || type === void 0 ? void 0 : type.getAccessType()) === basic_1.TableAccessType.sorted || (type === null || type === void 0 ? void 0 : type.getAccessType()) === basic_1.TableAccessType.hashed)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\nexports.SelectAddOrderBy = SelectAddOrderBy;\r\n//# sourceMappingURL=select_add_order_by.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/select_add_order_by.js?");
|
|
13033
13033
|
|
|
13034
13034
|
/***/ }),
|
|
13035
13035
|
|
|
@@ -13040,7 +13040,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
13040
13040
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13041
13041
|
|
|
13042
13042
|
"use strict";
|
|
13043
|
-
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?");
|
|
13043
|
+
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\r\n\r\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\r\n INTO @DATA(structure) UP TO 1 ROWS ORDER BY field3 DESCENDING.\r\nENDSELECT.`,\r\n goodExample: `SELECT field1, field2 FROM table UP TO 1 ROWS\r\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?");
|
|
13044
13044
|
|
|
13045
13045
|
/***/ }),
|
|
13046
13046
|
|
|
@@ -13084,7 +13084,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
13084
13084
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13085
13085
|
|
|
13086
13086
|
"use strict";
|
|
13087
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SICFConsistency = exports.SICFConsistencyConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass SICFConsistencyConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** skip specific names, case insensitive\r\n * @uniqueItems true\r\n */\r\n this.skipNames = [];\r\n }\r\n}\r\nexports.SICFConsistencyConf = SICFConsistencyConf;\r\nclass SICFConsistency {\r\n constructor() {\r\n this.conf = new SICFConsistencyConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"sicf_consistency\",\r\n title: \"SICF consistency\",\r\n shortDescription: `Checks the validity of ICF services`,\r\n extendedInformation: `* Class defined in handler must exist\n* Class must not have any syntax errors\n* Class must implement interface IF_HTTP_EXTENSION`,\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 if (this.conf.skipNames === undefined) {\r\n this.conf.skipNames = [];\r\n }\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n const issues = [];\r\n if (!(obj instanceof objects_1.ICFService)) {\r\n return [];\r\n }\r\n const handlers = obj.getHandlerList();\r\n if (handlers === undefined) {\r\n return [];\r\n }\r\n for (const h of handlers) {\r\n const clas = this.reg.getObject(\"CLAS\", h);\r\n if (clas === undefined) {\r\n if (this.conf.skipNames && this.conf.skipNames.some((a) => a.toUpperCase() === h.toUpperCase())) {\r\n continue;\r\n }\r\n const pattern = new RegExp(this.reg.getConfig().getSyntaxSetttings().errorNamespace, \"i\");\r\n if (pattern.test(h) === true) {\r\n const message = \"Handler class \" + h + \" not found\";\r\n const issue = issue_1.Issue.atPosition(obj.getFiles()[0], new position_1.Position(1, 1), message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n continue;\r\n }\r\n const def = clas.getClassDefinition();\r\n if (def === undefined) {\r\n const message = \"Syntax error in class \" + h;\r\n const issue = issue_1.Issue.atPosition(obj.getFiles()[0], new position_1.Position(1, 1), message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n continue;\r\n }\r\n const implementing = this.findImplementing(def);\r\n if (implementing.findIndex((i) => { return i.name.toUpperCase() === \"IF_HTTP_EXTENSION\"; }) < 0) {\r\n const message = \"Handler class \" + h + \" must implement IF_HTTP_EXTENSION\";\r\n const issue = issue_1.Issue.atPosition(obj.getFiles()[0], new position_1.Position(1, 1), message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n continue;\r\n }\r\n }\r\n return issues;\r\n }\r\n ///////////////////////////\r\n findImplementing(def) {\r\n let ret = def.interfaces;\r\n let superName = def.superClassName;\r\n while (superName !== undefined) {\r\n const clas = this.reg.getObject(\"CLAS\", superName);\r\n if (clas === undefined) {\r\n break;\r\n }\r\n const superDef = clas.getClassDefinition();\r\n if (superDef === undefined) {\r\n break;\r\n }\r\n ret = ret.concat(superDef.interfaces);\r\n superName = superDef.superClassName;\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.SICFConsistency = SICFConsistency;\r\n//# sourceMappingURL=sicf_consistency.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/sicf_consistency.js?");
|
|
13087
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SICFConsistency = exports.SICFConsistencyConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass SICFConsistencyConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** skip specific names, case insensitive\r\n * @uniqueItems true\r\n */\r\n this.skipNames = [];\r\n }\r\n}\r\nexports.SICFConsistencyConf = SICFConsistencyConf;\r\nclass SICFConsistency {\r\n constructor() {\r\n this.conf = new SICFConsistencyConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"sicf_consistency\",\r\n title: \"SICF consistency\",\r\n shortDescription: `Checks the validity of ICF services`,\r\n extendedInformation: `* Class defined in handler must exist\r\n* Class must not have any syntax errors\r\n* Class must implement interface IF_HTTP_EXTENSION`,\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 if (this.conf.skipNames === undefined) {\r\n this.conf.skipNames = [];\r\n }\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n const issues = [];\r\n if (!(obj instanceof objects_1.ICFService)) {\r\n return [];\r\n }\r\n const handlers = obj.getHandlerList();\r\n if (handlers === undefined) {\r\n return [];\r\n }\r\n for (const h of handlers) {\r\n const clas = this.reg.getObject(\"CLAS\", h);\r\n if (clas === undefined) {\r\n if (this.conf.skipNames && this.conf.skipNames.some((a) => a.toUpperCase() === h.toUpperCase())) {\r\n continue;\r\n }\r\n const pattern = new RegExp(this.reg.getConfig().getSyntaxSetttings().errorNamespace, \"i\");\r\n if (pattern.test(h) === true) {\r\n const message = \"Handler class \" + h + \" not found\";\r\n const issue = issue_1.Issue.atPosition(obj.getFiles()[0], new position_1.Position(1, 1), message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n continue;\r\n }\r\n const def = clas.getClassDefinition();\r\n if (def === undefined) {\r\n const message = \"Syntax error in class \" + h;\r\n const issue = issue_1.Issue.atPosition(obj.getFiles()[0], new position_1.Position(1, 1), message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n continue;\r\n }\r\n const implementing = this.findImplementing(def);\r\n if (implementing.findIndex((i) => { return i.name.toUpperCase() === \"IF_HTTP_EXTENSION\"; }) < 0) {\r\n const message = \"Handler class \" + h + \" must implement IF_HTTP_EXTENSION\";\r\n const issue = issue_1.Issue.atPosition(obj.getFiles()[0], new position_1.Position(1, 1), message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n continue;\r\n }\r\n }\r\n return issues;\r\n }\r\n ///////////////////////////\r\n findImplementing(def) {\r\n let ret = def.interfaces;\r\n let superName = def.superClassName;\r\n while (superName !== undefined) {\r\n const clas = this.reg.getObject(\"CLAS\", superName);\r\n if (clas === undefined) {\r\n break;\r\n }\r\n const superDef = clas.getClassDefinition();\r\n if (superDef === undefined) {\r\n break;\r\n }\r\n ret = ret.concat(superDef.interfaces);\r\n superName = superDef.superClassName;\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.SICFConsistency = SICFConsistency;\r\n//# sourceMappingURL=sicf_consistency.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/sicf_consistency.js?");
|
|
13088
13088
|
|
|
13089
13089
|
/***/ }),
|
|
13090
13090
|
|
|
@@ -13117,7 +13117,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
13117
13117
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13118
13118
|
|
|
13119
13119
|
"use strict";
|
|
13120
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SpaceBeforeDot = exports.SpaceBeforeDotConf = void 0;\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 Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nclass SpaceBeforeDotConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n this.ignoreGlobalDefinition = true;\r\n this.ignoreExceptions = true;\r\n }\r\n}\r\nexports.SpaceBeforeDotConf = SpaceBeforeDotConf;\r\nclass SpaceBeforeDot extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new SpaceBeforeDotConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"space_before_dot\",\r\n title: \"Space before dot\",\r\n shortDescription: `Checks for extra spaces before dots at the ends of statements`,\r\n extendedInformation: `\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#be-consistent\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#condense-your-code`,\r\n tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n badExample: `WRITE bar .`,\r\n goodExample: `WRITE bar.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"Remove space before \\\",\\\" or \\\".\\\"\";\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, obj) {\r\n const issues = [];\r\n let prev = undefined;\r\n let startRow = 0;\r\n if (file.getStructure() === undefined) {\r\n // some parser error exists in file\r\n return [];\r\n }\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n if (this.conf.ignoreGlobalDefinition) {\r\n const structure = file.getStructure();\r\n if (obj instanceof objects_1.Class && structure !== undefined) {\r\n const endclass = structure.findFirstStatement(Statements.EndClass);\r\n if (endclass !== undefined) {\r\n startRow = endclass.getFirstToken().getRow();\r\n }\r\n const definition = obj.getClassDefinition();\r\n if (definition !== undefined && this.conf.ignoreExceptions && ddic.isException(definition, obj)) {\r\n return [];\r\n }\r\n }\r\n else if (obj instanceof objects_1.Interface && structure !== undefined) {\r\n const endinterface = structure.findFirstStatement(Statements.EndInterface);\r\n if (endinterface !== undefined) {\r\n startRow = endinterface.getFirstToken().getRow();\r\n }\r\n }\r\n }\r\n for (const t of file.getTokens()) {\r\n if (t.getRow() < startRow) {\r\n continue;\r\n }\r\n if (prev !== undefined && t instanceof tokens_1.Punctuation && prev.getCol() + prev.getStr().length < t.getCol()) {\r\n const start = new position_1.Position(t.getStart().getRow(), prev.getEnd().getCol());\r\n const end = new position_1.Position(t.getStart().getRow(), t.getStart().getCol());\r\n const fix = edit_helper_1.EditHelper.deleteRange(file, start, end);\r\n const issue = issue_1.Issue.atRange(file, start, end, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n prev = t;\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.SpaceBeforeDot = SpaceBeforeDot;\r\n//# sourceMappingURL=space_before_dot.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/space_before_dot.js?");
|
|
13120
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SpaceBeforeDot = exports.SpaceBeforeDotConf = void 0;\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 Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ \"./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/index.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst ddic_1 = __webpack_require__(/*! ../ddic */ \"./node_modules/@abaplint/core/build/src/ddic.js\");\r\nclass SpaceBeforeDotConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n this.ignoreGlobalDefinition = true;\r\n this.ignoreExceptions = true;\r\n }\r\n}\r\nexports.SpaceBeforeDotConf = SpaceBeforeDotConf;\r\nclass SpaceBeforeDot extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new SpaceBeforeDotConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"space_before_dot\",\r\n title: \"Space before dot\",\r\n shortDescription: `Checks for extra spaces before dots at the ends of statements`,\r\n extendedInformation: `\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#be-consistent\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#condense-your-code`,\r\n tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n badExample: `WRITE bar .`,\r\n goodExample: `WRITE bar.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"Remove space before \\\",\\\" or \\\".\\\"\";\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, obj) {\r\n const issues = [];\r\n let prev = undefined;\r\n let startRow = 0;\r\n if (file.getStructure() === undefined) {\r\n // some parser error exists in file\r\n return [];\r\n }\r\n const ddic = new ddic_1.DDIC(this.reg);\r\n if (this.conf.ignoreGlobalDefinition) {\r\n const structure = file.getStructure();\r\n if (obj instanceof objects_1.Class && structure !== undefined) {\r\n const endclass = structure.findFirstStatement(Statements.EndClass);\r\n if (endclass !== undefined) {\r\n startRow = endclass.getFirstToken().getRow();\r\n }\r\n const definition = obj.getClassDefinition();\r\n if (definition !== undefined && this.conf.ignoreExceptions && ddic.isException(definition, obj)) {\r\n return [];\r\n }\r\n }\r\n else if (obj instanceof objects_1.Interface && structure !== undefined) {\r\n const endinterface = structure.findFirstStatement(Statements.EndInterface);\r\n if (endinterface !== undefined) {\r\n startRow = endinterface.getFirstToken().getRow();\r\n }\r\n }\r\n }\r\n for (const t of file.getTokens()) {\r\n if (t.getRow() < startRow) {\r\n continue;\r\n }\r\n if (prev !== undefined && t instanceof tokens_1.Punctuation && prev.getCol() + prev.getStr().length < t.getCol()) {\r\n const start = new position_1.Position(t.getStart().getRow(), prev.getEnd().getCol());\r\n const end = new position_1.Position(t.getStart().getRow(), t.getStart().getCol());\r\n const fix = edit_helper_1.EditHelper.deleteRange(file, start, end);\r\n const issue = issue_1.Issue.atRange(file, start, end, this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n prev = t;\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.SpaceBeforeDot = SpaceBeforeDot;\r\n//# sourceMappingURL=space_before_dot.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/space_before_dot.js?");
|
|
13121
13121
|
|
|
13122
13122
|
/***/ }),
|
|
13123
13123
|
|
|
@@ -13139,7 +13139,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
13139
13139
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13140
13140
|
|
|
13141
13141
|
"use strict";
|
|
13142
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.StartAtTab = exports.StartAtTabConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.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 _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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass StartAtTabConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.StartAtTabConf = StartAtTabConf;\r\nclass StartAtTab extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new StartAtTabConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"start_at_tab\",\r\n title: \"Start at tab\",\r\n shortDescription: `Checks that statements start at tabstops.`,\r\n extendedInformation: `Reports max 100 issues per file\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#indent-and-snap-to-tab`,\r\n tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n badExample: ` WRITE a.`,\r\n goodExample: ` WRITE a.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"Start statement at tab position\";\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 let inType = false;\r\n let previous = undefined;\r\n const raw = file.getRawRows();\r\n for (const statement of file.getStatements()) {\r\n if (statement.get() instanceof _statement_1.Comment) {\r\n continue;\r\n }\r\n else if (statement.get() instanceof statements_1.TypeBegin) {\r\n inType = true;\r\n }\r\n else if (statement.get() instanceof statements_1.TypeEnd) {\r\n inType = false;\r\n }\r\n else if (inType) {\r\n continue;\r\n }\r\n const pos = statement.getStart();\r\n if (previous !== undefined && pos.getRow() === previous.getRow()) {\r\n continue;\r\n }\r\n // just skip rows that contains tabs, this will be reported by the contains_tab rule\r\n if ((pos.getCol() - 1) % 2 !== 0 && raw[pos.getRow() - 1].includes(\"\\t\") === false) {\r\n const issue = issue_1.Issue.atPosition(file, pos, this.getMessage(), this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n if (issues.length >= 100) {\r\n return issues; // only max 100 issues perfile\r\n }\r\n }\r\n previous = pos;\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.StartAtTab = StartAtTab;\r\n//# sourceMappingURL=start_at_tab.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/start_at_tab.js?");
|
|
13142
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.StartAtTab = exports.StartAtTabConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.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 _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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass StartAtTabConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.StartAtTabConf = StartAtTabConf;\r\nclass StartAtTab extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new StartAtTabConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"start_at_tab\",\r\n title: \"Start at tab\",\r\n shortDescription: `Checks that statements start at tabstops.`,\r\n extendedInformation: `Reports max 100 issues per file\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#indent-and-snap-to-tab`,\r\n tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n badExample: ` WRITE a.`,\r\n goodExample: ` WRITE a.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"Start statement at tab position\";\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 let inType = false;\r\n let previous = undefined;\r\n const raw = file.getRawRows();\r\n for (const statement of file.getStatements()) {\r\n if (statement.get() instanceof _statement_1.Comment) {\r\n continue;\r\n }\r\n else if (statement.get() instanceof statements_1.TypeBegin) {\r\n inType = true;\r\n }\r\n else if (statement.get() instanceof statements_1.TypeEnd) {\r\n inType = false;\r\n }\r\n else if (inType) {\r\n continue;\r\n }\r\n const pos = statement.getStart();\r\n if (previous !== undefined && pos.getRow() === previous.getRow()) {\r\n continue;\r\n }\r\n // just skip rows that contains tabs, this will be reported by the contains_tab rule\r\n if ((pos.getCol() - 1) % 2 !== 0 && raw[pos.getRow() - 1].includes(\"\\t\") === false) {\r\n const issue = issue_1.Issue.atPosition(file, pos, this.getMessage(), this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n if (issues.length >= 100) {\r\n return issues; // only max 100 issues perfile\r\n }\r\n }\r\n previous = pos;\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.StartAtTab = StartAtTab;\r\n//# sourceMappingURL=start_at_tab.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/start_at_tab.js?");
|
|
13143
13143
|
|
|
13144
13144
|
/***/ }),
|
|
13145
13145
|
|
|
@@ -13183,7 +13183,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
13183
13183
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13184
13184
|
|
|
13185
13185
|
"use strict";
|
|
13186
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SyModification = exports.SyModificationConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass SyModificationConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.SyModificationConf = SyModificationConf;\r\nclass SyModification extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new SyModificationConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"sy_modification\",\r\n title: \"Modification of SY fields\",\r\n shortDescription: `Finds modification of sy fields`,\r\n extendedInformation: `https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abensystem_fields.htm\n\nChanges to SY-TVAR* fields are not reported`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `\nsy-uname = 2.\nsy = sy.`,\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, obj) {\r\n var _a;\r\n const issues = [];\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n for (const t of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllExpressions(Expressions.Target)) || []) {\r\n const firstChild = t.getChildren()[0];\r\n if (firstChild.get() instanceof Expressions.TargetField\r\n && firstChild.getFirstToken().getStr().toUpperCase() === \"SY\") {\r\n if (t.concatTokens().toUpperCase().startsWith(\"SY-TVAR\")) {\r\n continue;\r\n }\r\n const message = \"Modification of SY field\";\r\n const issue = issue_1.Issue.atToken(file, firstChild.getFirstToken(), message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.SyModification = SyModification;\r\n//# sourceMappingURL=sy_modification.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/sy_modification.js?");
|
|
13186
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.SyModification = exports.SyModificationConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\r\nconst Expressions = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass SyModificationConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.SyModificationConf = SyModificationConf;\r\nclass SyModification extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new SyModificationConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"sy_modification\",\r\n title: \"Modification of SY fields\",\r\n shortDescription: `Finds modification of sy fields`,\r\n extendedInformation: `https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abensystem_fields.htm\r\n\r\nChanges to SY-TVAR* fields are not reported`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `\r\nsy-uname = 2.\r\nsy = sy.`,\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, obj) {\r\n var _a;\r\n const issues = [];\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n for (const t of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllExpressions(Expressions.Target)) || []) {\r\n const firstChild = t.getChildren()[0];\r\n if (firstChild.get() instanceof Expressions.TargetField\r\n && firstChild.getFirstToken().getStr().toUpperCase() === \"SY\") {\r\n if (t.concatTokens().toUpperCase().startsWith(\"SY-TVAR\")) {\r\n continue;\r\n }\r\n const message = \"Modification of SY field\";\r\n const issue = issue_1.Issue.atToken(file, firstChild.getFirstToken(), message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.SyModification = SyModification;\r\n//# sourceMappingURL=sy_modification.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/sy_modification.js?");
|
|
13187
13187
|
|
|
13188
13188
|
/***/ }),
|
|
13189
13189
|
|
|
@@ -13194,7 +13194,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
13194
13194
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13195
13195
|
|
|
13196
13196
|
"use strict";
|
|
13197
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.TABLEnhancementCategory = exports.TABLEnhancementCategoryConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass TABLEnhancementCategoryConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.TABLEnhancementCategoryConf = TABLEnhancementCategoryConf;\r\nclass TABLEnhancementCategory {\r\n constructor() {\r\n this.conf = new TABLEnhancementCategoryConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"tabl_enhancement_category\",\r\n title: \"TABL enhancement category must be set\",\r\n shortDescription: `Checks that tables do not have the enhancement category 'not classified'.`,\r\n extendedInformation: `SAP note 3063227 changes the default to 'Cannot be enhanced'.\n\nYou may use standard report RS_DDIC_CLASSIFICATION_FINAL for adjustment.`,\r\n tags: [],\r\n };\r\n }\r\n getDescription(name) {\r\n return \"TABL enhancement category not classified in \" + name;\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 initialize(_reg) {\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof objects_1.Table)) {\r\n return [];\r\n }\r\n if (obj.getEnhancementCategory() === objects_1.EnhancementCategory.NotClassified) {\r\n const position = new position_1.Position(1, 1);\r\n const issue = issue_1.Issue.atPosition(obj.getFiles()[0], position, this.getDescription(obj.getName()), this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n return [];\r\n }\r\n}\r\nexports.TABLEnhancementCategory = TABLEnhancementCategory;\r\n//# sourceMappingURL=tabl_enhancement_category.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/tabl_enhancement_category.js?");
|
|
13197
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.TABLEnhancementCategory = exports.TABLEnhancementCategoryConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst position_1 = __webpack_require__(/*! ../position */ \"./node_modules/@abaplint/core/build/src/position.js\");\r\nclass TABLEnhancementCategoryConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.TABLEnhancementCategoryConf = TABLEnhancementCategoryConf;\r\nclass TABLEnhancementCategory {\r\n constructor() {\r\n this.conf = new TABLEnhancementCategoryConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"tabl_enhancement_category\",\r\n title: \"TABL enhancement category must be set\",\r\n shortDescription: `Checks that tables do not have the enhancement category 'not classified'.`,\r\n extendedInformation: `SAP note 3063227 changes the default to 'Cannot be enhanced'.\r\n\r\nYou may use standard report RS_DDIC_CLASSIFICATION_FINAL for adjustment.`,\r\n tags: [],\r\n };\r\n }\r\n getDescription(name) {\r\n return \"TABL enhancement category not classified in \" + name;\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 initialize(_reg) {\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof objects_1.Table)) {\r\n return [];\r\n }\r\n if (obj.getEnhancementCategory() === objects_1.EnhancementCategory.NotClassified) {\r\n const position = new position_1.Position(1, 1);\r\n const issue = issue_1.Issue.atPosition(obj.getFiles()[0], position, this.getDescription(obj.getName()), this.getMetadata().key, this.conf.severity);\r\n return [issue];\r\n }\r\n return [];\r\n }\r\n}\r\nexports.TABLEnhancementCategory = TABLEnhancementCategory;\r\n//# sourceMappingURL=tabl_enhancement_category.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/tabl_enhancement_category.js?");
|
|
13198
13198
|
|
|
13199
13199
|
/***/ }),
|
|
13200
13200
|
|
|
@@ -13271,7 +13271,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
13271
13271
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13272
13272
|
|
|
13273
13273
|
"use strict";
|
|
13274
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UnnecessaryPragma = exports.UnnecessaryPragmaConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\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 _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 _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass UnnecessaryPragmaConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.UnnecessaryPragmaConf = UnnecessaryPragmaConf;\r\nclass UnnecessaryPragma extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new UnnecessaryPragmaConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"unnecessary_pragma\",\r\n title: \"Unnecessary Pragma\",\r\n shortDescription: `Finds pragmas which can be removed`,\r\n extendedInformation: `* NO_HANDLER with handler\n\n* NEEDED without definition\n\n* NO_TEXT without texts\n\n* SUBRC_OK where sy-subrc is checked`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `TRY.\n ...\n CATCH zcx_abapgit_exception ##NO_HANDLER.\n RETURN. \" it has a handler\nENDTRY.\nMESSAGE w125(zbar) WITH c_foo INTO message ##NEEDED ##NO_TEXT.\nSELECT SINGLE * FROM tadir INTO @DATA(sdfs) ##SUBRC_OK.\nIF sy-subrc <> 0.\nENDIF.`,\r\n goodExample: `TRY.\n ...\n CATCH zcx_abapgit_exception.\n RETURN.\nENDTRY.\nMESSAGE w125(zbar) WITH c_foo INTO message.\nSELECT SINGLE * FROM tadir INTO @DATA(sdfs).\nIF sy-subrc <> 0.\nENDIF.`,\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 const issues = [];\r\n let noHandler = false;\r\n const statements = file.getStatements();\r\n for (let i = 0; i < statements.length; i++) {\r\n const statement = statements[i];\r\n const nextStatement = statements[i + 1];\r\n if (statement.get() instanceof Statements.EndTry) {\r\n noHandler = false;\r\n }\r\n else if (statement.get() instanceof _statement_1.Comment) {\r\n continue;\r\n }\r\n else if (noHandler === true && !(statement.get() instanceof Statements.Catch)) {\r\n const message = \"NO_HANDLER pragma or pseudo comment can be removed\";\r\n const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n noHandler = false;\r\n }\r\n else {\r\n noHandler = this.containsNoHandler(statement, statements[i + 1]);\r\n }\r\n issues.push(...this.checkText(statement, file));\r\n issues.push(...this.checkNeeded(statement, file));\r\n issues.push(...this.checkSubrc(statement, nextStatement, file));\r\n }\r\n return issues;\r\n }\r\n checkText(statement, file) {\r\n const p = statement.getPragmas().find(t => t.getStr().toUpperCase() === \"##NO_TEXT\");\r\n if (p === undefined) {\r\n return [];\r\n }\r\n if (statement.findFirstExpression(Expressions.ConstantString) === undefined\r\n && statement.findFirstExpression(Expressions.StringTemplate) === undefined) {\r\n const message = \"There is no text, NO_TEXT can be removed\";\r\n return [issue_1.Issue.atToken(file, p, message, this.getMetadata().key, this.getConfig().severity)];\r\n }\r\n return [];\r\n }\r\n checkSubrc(statement, next, file) {\r\n const p = statement.getPragmas().find(t => t.getStr().toUpperCase() === \"##SUBRC_OK\");\r\n if (p === undefined) {\r\n return [];\r\n }\r\n const concat = next.concatTokens().toUpperCase();\r\n if (concat.includes(\" SY-SUBRC\")) {\r\n const message = \"SUBRC_OK can be removed as sy-subrc is checked\";\r\n return [issue_1.Issue.atToken(file, p, message, this.getMetadata().key, this.getConfig().severity)];\r\n }\r\n return [];\r\n }\r\n checkNeeded(statement, file) {\r\n const p = statement.getPragmas().find(t => t.getStr().toUpperCase() === \"##NEEDED\");\r\n if (p === undefined) {\r\n return [];\r\n }\r\n if (statement.findFirstExpression(Expressions.InlineData) === undefined\r\n && !(statement.get() instanceof Statements.Parameter)\r\n && !(statement.get() instanceof Statements.Data)\r\n && !(statement.get() instanceof Statements.DataEnd)\r\n && !(statement.get() instanceof Statements.Type)\r\n && !(statement.get() instanceof Statements.Form)\r\n && !(statement.get() instanceof Statements.TypeEnd)\r\n && !(statement.get() instanceof Statements.Constant)\r\n && !(statement.get() instanceof Statements.ConstantEnd)\r\n && !(statement.get() instanceof Statements.TypeEnum)\r\n && !(statement.get() instanceof Statements.TypeEnumEnd)\r\n && !(statement.get() instanceof Statements.MethodImplementation)\r\n && !(statement.get() instanceof Statements.MethodDef)\r\n && statement.findFirstExpression(Expressions.InlineFS) === undefined) {\r\n const message = \"There is no data definition, NEEDED can be removed\";\r\n return [issue_1.Issue.atToken(file, p, message, this.getMetadata().key, this.getConfig().severity)];\r\n }\r\n return [];\r\n }\r\n containsNoHandler(statement, next) {\r\n for (const t of statement.getPragmas()) {\r\n if (t.getStr().toUpperCase() === \"##NO_HANDLER\") {\r\n return true;\r\n }\r\n }\r\n if (next\r\n && next.get() instanceof _statement_1.Comment\r\n && next.concatTokens().toUpperCase().includes(\"#EC NO_HANDLER\")) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n}\r\nexports.UnnecessaryPragma = UnnecessaryPragma;\r\n//# sourceMappingURL=unnecessary_pragma.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/unnecessary_pragma.js?");
|
|
13274
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UnnecessaryPragma = exports.UnnecessaryPragmaConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\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 _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 _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass UnnecessaryPragmaConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.UnnecessaryPragmaConf = UnnecessaryPragmaConf;\r\nclass UnnecessaryPragma extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new UnnecessaryPragmaConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"unnecessary_pragma\",\r\n title: \"Unnecessary Pragma\",\r\n shortDescription: `Finds pragmas which can be removed`,\r\n extendedInformation: `* NO_HANDLER with handler\r\n\r\n* NEEDED without definition\r\n\r\n* NO_TEXT without texts\r\n\r\n* SUBRC_OK where sy-subrc is checked`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `TRY.\r\n ...\r\n CATCH zcx_abapgit_exception ##NO_HANDLER.\r\n RETURN. \" it has a handler\r\nENDTRY.\r\nMESSAGE w125(zbar) WITH c_foo INTO message ##NEEDED ##NO_TEXT.\r\nSELECT SINGLE * FROM tadir INTO @DATA(sdfs) ##SUBRC_OK.\r\nIF sy-subrc <> 0.\r\nENDIF.`,\r\n goodExample: `TRY.\r\n ...\r\n CATCH zcx_abapgit_exception.\r\n RETURN.\r\nENDTRY.\r\nMESSAGE w125(zbar) WITH c_foo INTO message.\r\nSELECT SINGLE * FROM tadir INTO @DATA(sdfs).\r\nIF sy-subrc <> 0.\r\nENDIF.`,\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 const issues = [];\r\n let noHandler = false;\r\n const statements = file.getStatements();\r\n for (let i = 0; i < statements.length; i++) {\r\n const statement = statements[i];\r\n const nextStatement = statements[i + 1];\r\n if (statement.get() instanceof Statements.EndTry) {\r\n noHandler = false;\r\n }\r\n else if (statement.get() instanceof _statement_1.Comment) {\r\n continue;\r\n }\r\n else if (noHandler === true && !(statement.get() instanceof Statements.Catch)) {\r\n const message = \"NO_HANDLER pragma or pseudo comment can be removed\";\r\n const issue = issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n noHandler = false;\r\n }\r\n else {\r\n noHandler = this.containsNoHandler(statement, statements[i + 1]);\r\n }\r\n issues.push(...this.checkText(statement, file));\r\n issues.push(...this.checkNeeded(statement, file));\r\n issues.push(...this.checkSubrc(statement, nextStatement, file));\r\n }\r\n return issues;\r\n }\r\n checkText(statement, file) {\r\n const p = statement.getPragmas().find(t => t.getStr().toUpperCase() === \"##NO_TEXT\");\r\n if (p === undefined) {\r\n return [];\r\n }\r\n if (statement.findFirstExpression(Expressions.ConstantString) === undefined\r\n && statement.findFirstExpression(Expressions.StringTemplate) === undefined) {\r\n const message = \"There is no text, NO_TEXT can be removed\";\r\n return [issue_1.Issue.atToken(file, p, message, this.getMetadata().key, this.getConfig().severity)];\r\n }\r\n return [];\r\n }\r\n checkSubrc(statement, next, file) {\r\n const p = statement.getPragmas().find(t => t.getStr().toUpperCase() === \"##SUBRC_OK\");\r\n if (p === undefined) {\r\n return [];\r\n }\r\n const concat = next.concatTokens().toUpperCase();\r\n if (concat.includes(\" SY-SUBRC\")) {\r\n const message = \"SUBRC_OK can be removed as sy-subrc is checked\";\r\n return [issue_1.Issue.atToken(file, p, message, this.getMetadata().key, this.getConfig().severity)];\r\n }\r\n return [];\r\n }\r\n checkNeeded(statement, file) {\r\n const p = statement.getPragmas().find(t => t.getStr().toUpperCase() === \"##NEEDED\");\r\n if (p === undefined) {\r\n return [];\r\n }\r\n if (statement.findFirstExpression(Expressions.InlineData) === undefined\r\n && !(statement.get() instanceof Statements.Parameter)\r\n && !(statement.get() instanceof Statements.Data)\r\n && !(statement.get() instanceof Statements.DataEnd)\r\n && !(statement.get() instanceof Statements.Type)\r\n && !(statement.get() instanceof Statements.Form)\r\n && !(statement.get() instanceof Statements.TypeEnd)\r\n && !(statement.get() instanceof Statements.Constant)\r\n && !(statement.get() instanceof Statements.ConstantEnd)\r\n && !(statement.get() instanceof Statements.TypeEnum)\r\n && !(statement.get() instanceof Statements.TypeEnumEnd)\r\n && !(statement.get() instanceof Statements.MethodImplementation)\r\n && !(statement.get() instanceof Statements.MethodDef)\r\n && statement.findFirstExpression(Expressions.InlineFS) === undefined) {\r\n const message = \"There is no data definition, NEEDED can be removed\";\r\n return [issue_1.Issue.atToken(file, p, message, this.getMetadata().key, this.getConfig().severity)];\r\n }\r\n return [];\r\n }\r\n containsNoHandler(statement, next) {\r\n for (const t of statement.getPragmas()) {\r\n if (t.getStr().toUpperCase() === \"##NO_HANDLER\") {\r\n return true;\r\n }\r\n }\r\n if (next\r\n && next.get() instanceof _statement_1.Comment\r\n && next.concatTokens().toUpperCase().includes(\"#EC NO_HANDLER\")) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n}\r\nexports.UnnecessaryPragma = UnnecessaryPragma;\r\n//# sourceMappingURL=unnecessary_pragma.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/unnecessary_pragma.js?");
|
|
13275
13275
|
|
|
13276
13276
|
/***/ }),
|
|
13277
13277
|
|
|
@@ -13282,7 +13282,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
13282
13282
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13283
13283
|
|
|
13284
13284
|
"use strict";
|
|
13285
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UnnecessaryReturn = exports.UnnecessaryReturnConf = void 0;\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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass UnnecessaryReturnConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.UnnecessaryReturnConf = UnnecessaryReturnConf;\r\nclass UnnecessaryReturn extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new UnnecessaryReturnConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"unnecessary_return\",\r\n title: \"Unnecessary Return\",\r\n shortDescription: `Finds unnecessary RETURN statements`,\r\n extendedInformation: `Finds unnecessary RETURN statements`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],\r\n badExample: `METHOD hello.\n ...\n RETURN.\nENDMETHOD.`,\r\n goodExample: `METHOD hello.\n ...\nENDMETHOD.`,\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 const issues = [];\r\n const structure = file.getStructure();\r\n if (structure === undefined) {\r\n return [];\r\n }\r\n const statements = file.getStatements();\r\n for (let i = 0; i < statements.length - 1; i++) {\r\n const node = statements[i];\r\n const next = statements[i + 1];\r\n if (node.get() instanceof Statements.Return\r\n && (next.get() instanceof Statements.EndMethod\r\n || next.get() instanceof Statements.EndForm\r\n || next.get() instanceof Statements.EndFunction)) {\r\n const message = \"Unnecessary RETURN\";\r\n const fix = edit_helper_1.EditHelper.deleteStatement(file, node);\r\n issues.push(issue_1.Issue.atStatement(file, node, message, this.getMetadata().key, this.getConfig().severity, fix));\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.UnnecessaryReturn = UnnecessaryReturn;\r\n//# sourceMappingURL=unnecessary_return.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/unnecessary_return.js?");
|
|
13285
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UnnecessaryReturn = exports.UnnecessaryReturnConf = void 0;\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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass UnnecessaryReturnConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.UnnecessaryReturnConf = UnnecessaryReturnConf;\r\nclass UnnecessaryReturn extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new UnnecessaryReturnConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"unnecessary_return\",\r\n title: \"Unnecessary Return\",\r\n shortDescription: `Finds unnecessary RETURN statements`,\r\n extendedInformation: `Finds unnecessary RETURN statements`,\r\n tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],\r\n badExample: `METHOD hello.\r\n ...\r\n RETURN.\r\nENDMETHOD.`,\r\n goodExample: `METHOD hello.\r\n ...\r\nENDMETHOD.`,\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 const issues = [];\r\n const structure = file.getStructure();\r\n if (structure === undefined) {\r\n return [];\r\n }\r\n const statements = file.getStatements();\r\n for (let i = 0; i < statements.length - 1; i++) {\r\n const node = statements[i];\r\n const next = statements[i + 1];\r\n if (node.get() instanceof Statements.Return\r\n && (next.get() instanceof Statements.EndMethod\r\n || next.get() instanceof Statements.EndForm\r\n || next.get() instanceof Statements.EndFunction)) {\r\n const message = \"Unnecessary RETURN\";\r\n const fix = edit_helper_1.EditHelper.deleteStatement(file, node);\r\n issues.push(issue_1.Issue.atStatement(file, node, message, this.getMetadata().key, this.getConfig().severity, fix));\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.UnnecessaryReturn = UnnecessaryReturn;\r\n//# sourceMappingURL=unnecessary_return.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/unnecessary_return.js?");
|
|
13286
13286
|
|
|
13287
13287
|
/***/ }),
|
|
13288
13288
|
|
|
@@ -13326,7 +13326,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
13326
13326
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13327
13327
|
|
|
13328
13328
|
"use strict";
|
|
13329
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UnusedMethods = exports.UnusedMethodsConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst visibility_1 = __webpack_require__(/*! ../abap/4_file_information/visibility */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass UnusedMethodsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.UnusedMethodsConf = UnusedMethodsConf;\r\nclass WorkArea {\r\n constructor() {\r\n this.list = [];\r\n this.list = [];\r\n }\r\n push(id) {\r\n this.list.push(id);\r\n }\r\n removeIfExists(id) {\r\n for (let i = 0; i < this.list.length; i++) {\r\n if (id.equals(this.list[i].identifier)) {\r\n this.list.splice(i, 1);\r\n return;\r\n }\r\n }\r\n }\r\n containsProteted() {\r\n for (const m of this.list) {\r\n if (m.visibility === visibility_1.Visibility.Protected) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n getLength() {\r\n return this.list.length;\r\n }\r\n get() {\r\n return this.list;\r\n }\r\n}\r\n// todo: add possibility to also search public methods\r\n// todo: for protected methods, also search subclasses\r\nclass UnusedMethods {\r\n constructor() {\r\n this.conf = new UnusedMethodsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"unused_methods\",\r\n title: \"Unused methods\",\r\n shortDescription: `Checks for unused methods`,\r\n extendedInformation: `Checks private and protected methods.\n\nSkips:\n* methods FOR TESTING\n* methods SETUP + TEARDOWN + CLASS_SETUP + CLASS_TEARDOWN in testclasses\n* class_constructor + constructor methods\n* event handlers\n* methods that are redefined\n* INCLUDEs\n`,\r\n tags: [],\r\n pragma: \"##CALLED\",\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 initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof _abap_object_1.ABAPObject)) {\r\n return [];\r\n }\r\n else if (obj instanceof objects_1.Interface) { // todo, how to handle interfaces?\r\n return [];\r\n }\r\n else if (obj instanceof objects_1.Program && obj.isInclude() === true) {\r\n return [];\r\n }\r\n // dont report anything when there are syntax errors\r\n const syntax = new syntax_1.SyntaxLogic(this.reg, obj).run();\r\n if (syntax.issues.length > 0) {\r\n return [];\r\n }\r\n this.wa = new WorkArea();\r\n for (const file of obj.getABAPFiles()) {\r\n for (const def of file.getInfo().listClassDefinitions()) {\r\n for (const method of def.methods) {\r\n if (method.isForTesting === true\r\n || method.isRedefinition === true\r\n || method.isEventHandler === true) {\r\n continue;\r\n }\r\n else if (def.isForTesting === true\r\n && (method.name.toUpperCase() === \"SETUP\"\r\n || method.name.toUpperCase() === \"CLASS_SETUP\"\r\n || method.name.toUpperCase() === \"TEARDOWN\"\r\n || method.name.toUpperCase() === \"CLASS_TEARDOWN\")) {\r\n continue;\r\n }\r\n else if (method.name.toUpperCase() === \"CONSTRUCTOR\"\r\n || method.name.toUpperCase() === \"CLASS_CONSTRUCTOR\") {\r\n continue;\r\n }\r\n if (method.visibility === visibility_1.Visibility.Private\r\n || method.visibility === visibility_1.Visibility.Protected) {\r\n this.wa.push(method);\r\n }\r\n }\r\n }\r\n }\r\n this.traverse(syntax.spaghetti.getTop());\r\n this.searchGlobalSubclasses(obj);\r\n const issues = [];\r\n for (const i of this.wa.get()) {\r\n const file = obj.getABAPFileByName(i.identifier.getFilename());\r\n if (file === undefined) {\r\n continue;\r\n }\r\n const statement = edit_helper_1.EditHelper.findStatement(i.identifier.getToken(), file);\r\n if (statement === undefined) {\r\n continue;\r\n }\r\n if (statement.getPragmas().some(t => t.getStr() === this.getMetadata().pragma)) {\r\n continue;\r\n }\r\n const message = \"Method \\\"\" + i.identifier.getName() + \"\\\" not used\";\r\n issues.push(issue_1.Issue.atIdentifier(i.identifier, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n return issues;\r\n }\r\n searchGlobalSubclasses(obj) {\r\n var _a, _b;\r\n if (this.wa.getLength() === 0\r\n || !(obj instanceof objects_1.Class)\r\n || this.wa.containsProteted() === false) {\r\n return;\r\n }\r\n const sup = obj.getDefinition();\r\n if (sup === undefined) {\r\n return;\r\n }\r\n for (const r of this.reg.getObjects()) {\r\n if (r instanceof objects_1.Class\r\n && ((_b = (_a = r.getDefinition()) === null || _a === void 0 ? void 0 : _a.getSuperClass()) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === sup.getName().toUpperCase()) {\r\n const syntax = new syntax_1.SyntaxLogic(this.reg, r).run();\r\n this.traverse(syntax.spaghetti.getTop());\r\n // recurse to sub-sub-* classes\r\n this.searchGlobalSubclasses(r);\r\n }\r\n }\r\n }\r\n traverse(node) {\r\n if (node.getIdentifier().stype !== _scope_type_1.ScopeType.BuiltIn) {\r\n this.checkNode(node);\r\n }\r\n for (const c of node.getChildren()) {\r\n this.traverse(c);\r\n }\r\n }\r\n checkNode(node) {\r\n for (const v of node.getData().references) {\r\n if (v.referenceType === _reference_1.ReferenceType.MethodReference && v.resolved) {\r\n this.wa.removeIfExists(v.resolved);\r\n }\r\n }\r\n }\r\n}\r\nexports.UnusedMethods = UnusedMethods;\r\n//# sourceMappingURL=unused_methods.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/unused_methods.js?");
|
|
13329
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UnusedMethods = exports.UnusedMethodsConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nconst visibility_1 = __webpack_require__(/*! ../abap/4_file_information/visibility */ \"./node_modules/@abaplint/core/build/src/abap/4_file_information/visibility.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass UnusedMethodsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.UnusedMethodsConf = UnusedMethodsConf;\r\nclass WorkArea {\r\n constructor() {\r\n this.list = [];\r\n this.list = [];\r\n }\r\n push(id) {\r\n this.list.push(id);\r\n }\r\n removeIfExists(id) {\r\n for (let i = 0; i < this.list.length; i++) {\r\n if (id.equals(this.list[i].identifier)) {\r\n this.list.splice(i, 1);\r\n return;\r\n }\r\n }\r\n }\r\n containsProteted() {\r\n for (const m of this.list) {\r\n if (m.visibility === visibility_1.Visibility.Protected) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n getLength() {\r\n return this.list.length;\r\n }\r\n get() {\r\n return this.list;\r\n }\r\n}\r\n// todo: add possibility to also search public methods\r\n// todo: for protected methods, also search subclasses\r\nclass UnusedMethods {\r\n constructor() {\r\n this.conf = new UnusedMethodsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"unused_methods\",\r\n title: \"Unused methods\",\r\n shortDescription: `Checks for unused methods`,\r\n extendedInformation: `Checks private and protected methods.\r\n\r\nSkips:\r\n* methods FOR TESTING\r\n* methods SETUP + TEARDOWN + CLASS_SETUP + CLASS_TEARDOWN in testclasses\r\n* class_constructor + constructor methods\r\n* event handlers\r\n* methods that are redefined\r\n* INCLUDEs\r\n`,\r\n tags: [],\r\n pragma: \"##CALLED\",\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 initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof _abap_object_1.ABAPObject)) {\r\n return [];\r\n }\r\n else if (obj instanceof objects_1.Interface) { // todo, how to handle interfaces?\r\n return [];\r\n }\r\n else if (obj instanceof objects_1.Program && obj.isInclude() === true) {\r\n return [];\r\n }\r\n // dont report anything when there are syntax errors\r\n const syntax = new syntax_1.SyntaxLogic(this.reg, obj).run();\r\n if (syntax.issues.length > 0) {\r\n return [];\r\n }\r\n this.wa = new WorkArea();\r\n for (const file of obj.getABAPFiles()) {\r\n for (const def of file.getInfo().listClassDefinitions()) {\r\n for (const method of def.methods) {\r\n if (method.isForTesting === true\r\n || method.isRedefinition === true\r\n || method.isEventHandler === true) {\r\n continue;\r\n }\r\n else if (def.isForTesting === true\r\n && (method.name.toUpperCase() === \"SETUP\"\r\n || method.name.toUpperCase() === \"CLASS_SETUP\"\r\n || method.name.toUpperCase() === \"TEARDOWN\"\r\n || method.name.toUpperCase() === \"CLASS_TEARDOWN\")) {\r\n continue;\r\n }\r\n else if (method.name.toUpperCase() === \"CONSTRUCTOR\"\r\n || method.name.toUpperCase() === \"CLASS_CONSTRUCTOR\") {\r\n continue;\r\n }\r\n if (method.visibility === visibility_1.Visibility.Private\r\n || method.visibility === visibility_1.Visibility.Protected) {\r\n this.wa.push(method);\r\n }\r\n }\r\n }\r\n }\r\n this.traverse(syntax.spaghetti.getTop());\r\n this.searchGlobalSubclasses(obj);\r\n const issues = [];\r\n for (const i of this.wa.get()) {\r\n const file = obj.getABAPFileByName(i.identifier.getFilename());\r\n if (file === undefined) {\r\n continue;\r\n }\r\n const statement = edit_helper_1.EditHelper.findStatement(i.identifier.getToken(), file);\r\n if (statement === undefined) {\r\n continue;\r\n }\r\n if (statement.getPragmas().some(t => t.getStr() === this.getMetadata().pragma)) {\r\n continue;\r\n }\r\n const message = \"Method \\\"\" + i.identifier.getName() + \"\\\" not used\";\r\n issues.push(issue_1.Issue.atIdentifier(i.identifier, message, this.getMetadata().key, this.conf.severity));\r\n }\r\n return issues;\r\n }\r\n searchGlobalSubclasses(obj) {\r\n var _a, _b;\r\n if (this.wa.getLength() === 0\r\n || !(obj instanceof objects_1.Class)\r\n || this.wa.containsProteted() === false) {\r\n return;\r\n }\r\n const sup = obj.getDefinition();\r\n if (sup === undefined) {\r\n return;\r\n }\r\n for (const r of this.reg.getObjects()) {\r\n if (r instanceof objects_1.Class\r\n && ((_b = (_a = r.getDefinition()) === null || _a === void 0 ? void 0 : _a.getSuperClass()) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === sup.getName().toUpperCase()) {\r\n const syntax = new syntax_1.SyntaxLogic(this.reg, r).run();\r\n this.traverse(syntax.spaghetti.getTop());\r\n // recurse to sub-sub-* classes\r\n this.searchGlobalSubclasses(r);\r\n }\r\n }\r\n }\r\n traverse(node) {\r\n if (node.getIdentifier().stype !== _scope_type_1.ScopeType.BuiltIn) {\r\n this.checkNode(node);\r\n }\r\n for (const c of node.getChildren()) {\r\n this.traverse(c);\r\n }\r\n }\r\n checkNode(node) {\r\n for (const v of node.getData().references) {\r\n if (v.referenceType === _reference_1.ReferenceType.MethodReference && v.resolved) {\r\n this.wa.removeIfExists(v.resolved);\r\n }\r\n }\r\n }\r\n}\r\nexports.UnusedMethods = UnusedMethods;\r\n//# sourceMappingURL=unused_methods.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/unused_methods.js?");
|
|
13330
13330
|
|
|
13331
13331
|
/***/ }),
|
|
13332
13332
|
|
|
@@ -13348,7 +13348,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
13348
13348
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13349
13349
|
|
|
13350
13350
|
"use strict";
|
|
13351
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UnusedVariables = exports.UnusedVariablesConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nclass UnusedVariablesConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** skip specific names, case insensitive\r\n * @uniqueItems true\r\n */\r\n this.skipNames = [];\r\n }\r\n}\r\nexports.UnusedVariablesConf = UnusedVariablesConf;\r\nclass WorkArea {\r\n constructor() {\r\n this.workarea = [];\r\n }\r\n push(id, count = 1) {\r\n for (const w of this.workarea) {\r\n if (id.equals(w.id)) {\r\n return;\r\n }\r\n }\r\n this.workarea.push({ id, count });\r\n }\r\n removeIfExists(id) {\r\n if (id === undefined) {\r\n return;\r\n }\r\n for (let i = 0; i < this.workarea.length; i++) {\r\n if (id.equals(this.workarea[i].id)) {\r\n this.workarea[i].count--;\r\n if (this.workarea[i].count === 0) {\r\n this.workarea.splice(i, 1);\r\n }\r\n return;\r\n }\r\n }\r\n }\r\n get() {\r\n return this.workarea;\r\n }\r\n count() {\r\n return this.workarea.length;\r\n }\r\n}\r\nclass UnusedVariables {\r\n constructor() {\r\n this.conf = new UnusedVariablesConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"unused_variables\",\r\n title: \"Unused variables\",\r\n shortDescription: `Checks for unused variables and constants`,\r\n extendedInformation: `Skips event parameters.\n\nNote that this currently does not work if the source code uses macros.\n\nUnused variables are not reported if the object contains syntax errors. Errors found in INCLUDES are reported for the main program.`,\r\n tags: [_irule_1.RuleTag.Quickfix],\r\n pragma: \"##NEEDED\",\r\n pseudoComment: \"EC NEEDED\",\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 if (this.conf.skipNames === undefined) {\r\n this.conf.skipNames = [];\r\n }\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof _abap_object_1.ABAPObject)) {\r\n return [];\r\n }\r\n else if (obj instanceof objects_1.Interface) { // todo, how to handle interfaces?\r\n return [];\r\n }\r\n // dont report unused variables when there are syntax errors\r\n const syntax = new syntax_1.SyntaxLogic(this.reg, obj).run();\r\n if (syntax.issues.length > 0) {\r\n return [];\r\n }\r\n this.workarea = new WorkArea();\r\n const top = syntax.spaghetti.getTop();\r\n this.buildWorkarea(top, obj);\r\n if (this.workarea.count() === 0) {\r\n return this.buildIssues(obj); // exit early if all variables are used\r\n }\r\n this.findUses(top, obj);\r\n for (const o of this.reg.getObjects()) {\r\n if (o === obj) {\r\n continue;\r\n }\r\n else if (o instanceof _abap_object_1.ABAPObject) {\r\n if (this.reg.isDependency(o)) {\r\n continue; // do not search in dependencies\r\n }\r\n const syntax = new syntax_1.SyntaxLogic(this.reg, o).run();\r\n this.findUses(syntax.spaghetti.getTop(), o);\r\n if (this.workarea.count() === 0) {\r\n return this.buildIssues(obj); // exit early if all variables are used\r\n }\r\n }\r\n }\r\n return this.buildIssues(obj);\r\n }\r\n findUses(node, obj) {\r\n for (const r of node.getData().references) {\r\n if (r.referenceType === _reference_1.ReferenceType.DataReadReference\r\n || r.referenceType === _reference_1.ReferenceType.DataWriteReference\r\n || r.referenceType === _reference_1.ReferenceType.TypeReference) {\r\n this.workarea.removeIfExists(r.resolved);\r\n }\r\n }\r\n for (const c of node.getChildren()) {\r\n this.findUses(c, obj);\r\n }\r\n }\r\n buildWorkarea(node, obj) {\r\n const stype = node.getIdentifier().stype;\r\n if (stype === _scope_type_1.ScopeType.OpenSQL) {\r\n return;\r\n }\r\n for (const c of node.getChildren()) {\r\n this.buildWorkarea(c, obj);\r\n }\r\n if (stype !== _scope_type_1.ScopeType.BuiltIn) {\r\n const vars = node.getData().vars;\r\n for (const name in vars) {\r\n const meta = vars[name].getMeta();\r\n if (this.conf.skipNames\r\n && this.conf.skipNames.length > 0\r\n && this.conf.skipNames.some((a) => a.toUpperCase() === name)) {\r\n continue;\r\n }\r\n else if (name === \"ME\"\r\n || name === \"SUPER\"\r\n || meta.includes(\"selection_screen_tab\" /* IdentifierMeta.SelectionScreenTab */)\r\n || meta.includes(\"event_parameter\" /* IdentifierMeta.EventParameter */)) {\r\n // todo, workaround for \"me\" and \"super\", these should somehow be typed to built-in\r\n continue;\r\n }\r\n const isInline = meta.includes(\"inline\" /* IdentifierMeta.InlineDefinition */);\r\n this.workarea.push(vars[name], isInline ? 2 : 1);\r\n }\r\n }\r\n }\r\n buildIssues(obj) {\r\n const ret = [];\r\n for (const w of this.workarea.get()) {\r\n const filename = w.id.getFilename();\r\n if (this.reg.isFileDependency(filename) === true) {\r\n continue;\r\n }\r\n else if (obj instanceof objects_1.Program === false && obj.containsFile(filename) === false) {\r\n continue;\r\n }\r\n const statement = this.findStatement(w.id);\r\n if (statement === null || statement === void 0 ? void 0 : statement.getPragmas().map(t => t.getStr()).includes(this.getMetadata().pragma + \"\")) {\r\n continue;\r\n }\r\n else if (this.suppressedbyPseudo(statement, w.id, obj)) {\r\n continue;\r\n }\r\n const name = w.id.getName();\r\n const message = \"Variable \\\"\" + name.toLowerCase() + \"\\\" not used\";\r\n const fix = this.buildFix(w.id, obj);\r\n ret.push(issue_1.Issue.atIdentifier(w.id, message, this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n return ret;\r\n }\r\n suppressedbyPseudo(statement, v, obj) {\r\n if (statement === undefined) {\r\n return false;\r\n }\r\n const file = obj.getABAPFileByName(v.getFilename());\r\n if (file === undefined) {\r\n return false;\r\n }\r\n let next = false;\r\n for (const s of file.getStatements()) {\r\n if (next === true && s.get() instanceof _statement_1.Comment) {\r\n return s.concatTokens().includes(this.getMetadata().pseudoComment + \"\");\r\n }\r\n if (s === statement) {\r\n next = true;\r\n }\r\n }\r\n return false;\r\n }\r\n findStatement(v) {\r\n const file = this.reg.getFileByName(v.getFilename());\r\n if (file === undefined) {\r\n return undefined;\r\n }\r\n const object = this.reg.findObjectForFile(file);\r\n if (!(object instanceof _abap_object_1.ABAPObject)) {\r\n return undefined;\r\n }\r\n const abapfile = object.getABAPFileByName(v.getFilename());\r\n if (abapfile === undefined) {\r\n return undefined;\r\n }\r\n const statement = edit_helper_1.EditHelper.findStatement(v.getToken(), abapfile);\r\n return statement;\r\n }\r\n buildFix(v, obj) {\r\n const file = obj.getABAPFileByName(v.getFilename());\r\n if (file === undefined) {\r\n return undefined;\r\n }\r\n const statement = edit_helper_1.EditHelper.findStatement(v.getToken(), file);\r\n if (statement === undefined) {\r\n return undefined;\r\n }\r\n else if (statement.get() instanceof Statements.Data) {\r\n return edit_helper_1.EditHelper.deleteStatement(file, statement);\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.UnusedVariables = UnusedVariables;\r\n//# sourceMappingURL=unused_variables.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/unused_variables.js?");
|
|
13351
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UnusedVariables = exports.UnusedVariablesConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\r\nconst _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\r\nconst _scope_type_1 = __webpack_require__(/*! ../abap/5_syntax/_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\r\nconst objects_1 = __webpack_require__(/*! ../objects */ \"./node_modules/@abaplint/core/build/src/objects/index.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nconst Statements = __webpack_require__(/*! ../abap/2_statements/statements */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nconst _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js\");\r\nclass UnusedVariablesConf extends _basic_rule_config_1.BasicRuleConfig {\r\n constructor() {\r\n super(...arguments);\r\n /** skip specific names, case insensitive\r\n * @uniqueItems true\r\n */\r\n this.skipNames = [];\r\n }\r\n}\r\nexports.UnusedVariablesConf = UnusedVariablesConf;\r\nclass WorkArea {\r\n constructor() {\r\n this.workarea = [];\r\n }\r\n push(id, count = 1) {\r\n for (const w of this.workarea) {\r\n if (id.equals(w.id)) {\r\n return;\r\n }\r\n }\r\n this.workarea.push({ id, count });\r\n }\r\n removeIfExists(id) {\r\n if (id === undefined) {\r\n return;\r\n }\r\n for (let i = 0; i < this.workarea.length; i++) {\r\n if (id.equals(this.workarea[i].id)) {\r\n this.workarea[i].count--;\r\n if (this.workarea[i].count === 0) {\r\n this.workarea.splice(i, 1);\r\n }\r\n return;\r\n }\r\n }\r\n }\r\n get() {\r\n return this.workarea;\r\n }\r\n count() {\r\n return this.workarea.length;\r\n }\r\n}\r\nclass UnusedVariables {\r\n constructor() {\r\n this.conf = new UnusedVariablesConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"unused_variables\",\r\n title: \"Unused variables\",\r\n shortDescription: `Checks for unused variables and constants`,\r\n extendedInformation: `Skips event parameters.\r\n\r\nNote that this currently does not work if the source code uses macros.\r\n\r\nUnused variables are not reported if the object contains syntax errors. Errors found in INCLUDES are reported for the main program.`,\r\n tags: [_irule_1.RuleTag.Quickfix],\r\n pragma: \"##NEEDED\",\r\n pseudoComment: \"EC NEEDED\",\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 if (this.conf.skipNames === undefined) {\r\n this.conf.skipNames = [];\r\n }\r\n }\r\n initialize(reg) {\r\n this.reg = reg;\r\n return this;\r\n }\r\n run(obj) {\r\n if (!(obj instanceof _abap_object_1.ABAPObject)) {\r\n return [];\r\n }\r\n else if (obj instanceof objects_1.Interface) { // todo, how to handle interfaces?\r\n return [];\r\n }\r\n // dont report unused variables when there are syntax errors\r\n const syntax = new syntax_1.SyntaxLogic(this.reg, obj).run();\r\n if (syntax.issues.length > 0) {\r\n return [];\r\n }\r\n this.workarea = new WorkArea();\r\n const top = syntax.spaghetti.getTop();\r\n this.buildWorkarea(top, obj);\r\n if (this.workarea.count() === 0) {\r\n return this.buildIssues(obj); // exit early if all variables are used\r\n }\r\n this.findUses(top, obj);\r\n for (const o of this.reg.getObjects()) {\r\n if (o === obj) {\r\n continue;\r\n }\r\n else if (o instanceof _abap_object_1.ABAPObject) {\r\n if (this.reg.isDependency(o)) {\r\n continue; // do not search in dependencies\r\n }\r\n const syntax = new syntax_1.SyntaxLogic(this.reg, o).run();\r\n this.findUses(syntax.spaghetti.getTop(), o);\r\n if (this.workarea.count() === 0) {\r\n return this.buildIssues(obj); // exit early if all variables are used\r\n }\r\n }\r\n }\r\n return this.buildIssues(obj);\r\n }\r\n findUses(node, obj) {\r\n for (const r of node.getData().references) {\r\n if (r.referenceType === _reference_1.ReferenceType.DataReadReference\r\n || r.referenceType === _reference_1.ReferenceType.DataWriteReference\r\n || r.referenceType === _reference_1.ReferenceType.TypeReference) {\r\n this.workarea.removeIfExists(r.resolved);\r\n }\r\n }\r\n for (const c of node.getChildren()) {\r\n this.findUses(c, obj);\r\n }\r\n }\r\n buildWorkarea(node, obj) {\r\n const stype = node.getIdentifier().stype;\r\n if (stype === _scope_type_1.ScopeType.OpenSQL) {\r\n return;\r\n }\r\n for (const c of node.getChildren()) {\r\n this.buildWorkarea(c, obj);\r\n }\r\n if (stype !== _scope_type_1.ScopeType.BuiltIn) {\r\n const vars = node.getData().vars;\r\n for (const name in vars) {\r\n const meta = vars[name].getMeta();\r\n if (this.conf.skipNames\r\n && this.conf.skipNames.length > 0\r\n && this.conf.skipNames.some((a) => a.toUpperCase() === name)) {\r\n continue;\r\n }\r\n else if (name === \"ME\"\r\n || name === \"SUPER\"\r\n || meta.includes(\"selection_screen_tab\" /* IdentifierMeta.SelectionScreenTab */)\r\n || meta.includes(\"event_parameter\" /* IdentifierMeta.EventParameter */)) {\r\n // todo, workaround for \"me\" and \"super\", these should somehow be typed to built-in\r\n continue;\r\n }\r\n const isInline = meta.includes(\"inline\" /* IdentifierMeta.InlineDefinition */);\r\n this.workarea.push(vars[name], isInline ? 2 : 1);\r\n }\r\n }\r\n }\r\n buildIssues(obj) {\r\n const ret = [];\r\n for (const w of this.workarea.get()) {\r\n const filename = w.id.getFilename();\r\n if (this.reg.isFileDependency(filename) === true) {\r\n continue;\r\n }\r\n else if (obj instanceof objects_1.Program === false && obj.containsFile(filename) === false) {\r\n continue;\r\n }\r\n const statement = this.findStatement(w.id);\r\n if (statement === null || statement === void 0 ? void 0 : statement.getPragmas().map(t => t.getStr()).includes(this.getMetadata().pragma + \"\")) {\r\n continue;\r\n }\r\n else if (this.suppressedbyPseudo(statement, w.id, obj)) {\r\n continue;\r\n }\r\n const name = w.id.getName();\r\n const message = \"Variable \\\"\" + name.toLowerCase() + \"\\\" not used\";\r\n const fix = this.buildFix(w.id, obj);\r\n ret.push(issue_1.Issue.atIdentifier(w.id, message, this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n return ret;\r\n }\r\n suppressedbyPseudo(statement, v, obj) {\r\n if (statement === undefined) {\r\n return false;\r\n }\r\n const file = obj.getABAPFileByName(v.getFilename());\r\n if (file === undefined) {\r\n return false;\r\n }\r\n let next = false;\r\n for (const s of file.getStatements()) {\r\n if (next === true && s.get() instanceof _statement_1.Comment) {\r\n return s.concatTokens().includes(this.getMetadata().pseudoComment + \"\");\r\n }\r\n if (s === statement) {\r\n next = true;\r\n }\r\n }\r\n return false;\r\n }\r\n findStatement(v) {\r\n const file = this.reg.getFileByName(v.getFilename());\r\n if (file === undefined) {\r\n return undefined;\r\n }\r\n const object = this.reg.findObjectForFile(file);\r\n if (!(object instanceof _abap_object_1.ABAPObject)) {\r\n return undefined;\r\n }\r\n const abapfile = object.getABAPFileByName(v.getFilename());\r\n if (abapfile === undefined) {\r\n return undefined;\r\n }\r\n const statement = edit_helper_1.EditHelper.findStatement(v.getToken(), abapfile);\r\n return statement;\r\n }\r\n buildFix(v, obj) {\r\n const file = obj.getABAPFileByName(v.getFilename());\r\n if (file === undefined) {\r\n return undefined;\r\n }\r\n const statement = edit_helper_1.EditHelper.findStatement(v.getToken(), file);\r\n if (statement === undefined) {\r\n return undefined;\r\n }\r\n else if (statement.get() instanceof Statements.Data) {\r\n return edit_helper_1.EditHelper.deleteStatement(file, statement);\r\n }\r\n return undefined;\r\n }\r\n}\r\nexports.UnusedVariables = UnusedVariables;\r\n//# sourceMappingURL=unused_variables.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/unused_variables.js?");
|
|
13352
13352
|
|
|
13353
13353
|
/***/ }),
|
|
13354
13354
|
|
|
@@ -13359,7 +13359,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
13359
13359
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13360
13360
|
|
|
13361
13361
|
"use strict";
|
|
13362
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UseBoolExpression = exports.UseBoolExpressionConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\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 Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.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 version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\n// note this rule assumes abap_true and abap_false is used for boolean variables\r\n// some other rule will in the future find assignments to abap_bool that are not abap_true/abap_false/abap_undefined\r\nclass UseBoolExpressionConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.UseBoolExpressionConf = UseBoolExpressionConf;\r\nclass UseBoolExpression extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new UseBoolExpressionConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"use_bool_expression\",\r\n title: \"Use boolean expression\",\r\n shortDescription: `Use boolean expression, xsdbool from 740sp08 and up, boolc from 702 and up`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-xsdbool-to-set-boolean-variables`,\r\n tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n badExample: `IF line IS INITIAL.\n has_entries = abap_false.\nELSE.\n has_entries = abap_true.\nENDIF.\n\nDATA(fsdf) = COND #( WHEN foo <> bar THEN abap_true ELSE abap_false ).`,\r\n goodExample: `DATA(has_entries) = xsdbool( line IS NOT INITIAL ).\n\nDATA(fsdf) = xsdbool( foo <> bar ).`,\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, _d, _e, _f, _g, _h, _j;\r\n const issues = [];\r\n const stru = file.getStructure();\r\n const version = this.reg.getConfig().getVersion();\r\n if (stru === undefined || (version < version_1.Version.v702 && version !== version_1.Version.Cloud)) {\r\n return [];\r\n }\r\n for (const i of stru.findAllStructures(Structures.If)) {\r\n if (i.findDirectStructure(Structures.ElseIf) !== undefined) {\r\n continue;\r\n }\r\n const bodyNodes = (_a = i.findDirectStructure(Structures.Body)) === null || _a === void 0 ? void 0 : _a.findAllStatementNodes();\r\n if (bodyNodes === undefined || bodyNodes.length !== 1) {\r\n continue;\r\n }\r\n const bodyStatement = bodyNodes[0];\r\n if (!(bodyStatement.get() instanceof Statements.Move)) {\r\n continue;\r\n }\r\n const elseNodes = (_c = (_b = i.findDirectStructure(Structures.Else)) === null || _b === void 0 ? void 0 : _b.findDirectStructure(Structures.Body)) === null || _c === void 0 ? void 0 : _c.findAllStatementNodes();\r\n if (elseNodes === undefined || elseNodes.length !== 1) {\r\n continue;\r\n }\r\n const elseStatement = elseNodes[0];\r\n if (!(elseStatement.get() instanceof Statements.Move)) {\r\n continue;\r\n }\r\n let bodyTarget = (_d = bodyStatement.findFirstExpression(Expressions.Target)) === null || _d === void 0 ? void 0 : _d.concatTokens();\r\n if (bodyTarget === null || bodyTarget === void 0 ? void 0 : bodyTarget.startsWith(\"DATA(\")) {\r\n bodyTarget = bodyTarget.substr(5, bodyTarget.length - 6);\r\n }\r\n const elseTarget = (_e = elseStatement.findFirstExpression(Expressions.Target)) === null || _e === void 0 ? void 0 : _e.concatTokens();\r\n if (bodyTarget === undefined\r\n || elseTarget === undefined\r\n || bodyTarget.toUpperCase() !== elseTarget.toUpperCase()) {\r\n continue;\r\n }\r\n const bodySource = (_f = bodyStatement.findFirstExpression(Expressions.Source)) === null || _f === void 0 ? void 0 : _f.concatTokens().toUpperCase();\r\n const elseSource = (_g = elseStatement.findFirstExpression(Expressions.Source)) === null || _g === void 0 ? void 0 : _g.concatTokens().toUpperCase();\r\n if ((bodySource === \"ABAP_TRUE\" && elseSource === \"ABAP_FALSE\")\r\n || (bodySource === \"ABAP_FALSE\" && elseSource === \"ABAP_TRUE\")) {\r\n const func = (this.reg.getConfig().getVersion() >= version_1.Version.v740sp08\r\n || this.reg.getConfig().getVersion() === version_1.Version.Cloud) ? \"xsdbool\" : \"boolc\";\r\n const negate = bodySource === \"ABAP_FALSE\";\r\n const message = `Use ${func} instead of IF` + (negate ? \", negate expression\" : \"\");\r\n const start = i.getFirstToken().getStart();\r\n const end = i.getLastToken().getEnd();\r\n const statement = bodyTarget + \" = \" + func + \"( \" +\r\n (negate ? \"NOT ( \" : \"\") +\r\n ((_j = (_h = i.findFirstStatement(Statements.If)) === null || _h === void 0 ? void 0 : _h.findFirstExpression(Expressions.Cond)) === null || _j === void 0 ? void 0 : _j.concatTokens()) +\r\n (negate ? \" )\" : \"\") +\r\n \" ).\";\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, start, end, statement);\r\n issues.push(issue_1.Issue.atRange(file, start, end, message, this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n }\r\n if (version >= version_1.Version.v740sp08 || version === version_1.Version.Cloud) {\r\n for (const b of stru.findAllExpressions(Expressions.CondBody)) {\r\n const concat = b.concatTokens().toUpperCase();\r\n if (concat.endsWith(\" THEN ABAP_TRUE ELSE ABAP_FALSE\")\r\n || concat.endsWith(\" THEN ABAP_TRUE\")\r\n || concat.endsWith(\" THEN ABAP_FALSE ELSE ABAP_TRUE\")) {\r\n const message = \"Use xsdbool\";\r\n // eslint-disable-next-line max-len\r\n issues.push(issue_1.Issue.atRange(file, b.getFirstToken().getStart(), b.getLastToken().getEnd(), message, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.UseBoolExpression = UseBoolExpression;\r\n//# sourceMappingURL=use_bool_expression.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/use_bool_expression.js?");
|
|
13362
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UseBoolExpression = exports.UseBoolExpressionConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\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 Structures = __webpack_require__(/*! ../abap/3_structures/structures */ \"./node_modules/@abaplint/core/build/src/abap/3_structures/structures/index.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 version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\n// note this rule assumes abap_true and abap_false is used for boolean variables\r\n// some other rule will in the future find assignments to abap_bool that are not abap_true/abap_false/abap_undefined\r\nclass UseBoolExpressionConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.UseBoolExpressionConf = UseBoolExpressionConf;\r\nclass UseBoolExpression extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new UseBoolExpressionConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"use_bool_expression\",\r\n title: \"Use boolean expression\",\r\n shortDescription: `Use boolean expression, xsdbool from 740sp08 and up, boolc from 702 and up`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#use-xsdbool-to-set-boolean-variables`,\r\n tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n badExample: `IF line IS INITIAL.\r\n has_entries = abap_false.\r\nELSE.\r\n has_entries = abap_true.\r\nENDIF.\r\n\r\nDATA(fsdf) = COND #( WHEN foo <> bar THEN abap_true ELSE abap_false ).`,\r\n goodExample: `DATA(has_entries) = xsdbool( line IS NOT INITIAL ).\r\n\r\nDATA(fsdf) = xsdbool( foo <> bar ).`,\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, _d, _e, _f, _g, _h, _j;\r\n const issues = [];\r\n const stru = file.getStructure();\r\n const version = this.reg.getConfig().getVersion();\r\n if (stru === undefined || (version < version_1.Version.v702 && version !== version_1.Version.Cloud)) {\r\n return [];\r\n }\r\n for (const i of stru.findAllStructures(Structures.If)) {\r\n if (i.findDirectStructure(Structures.ElseIf) !== undefined) {\r\n continue;\r\n }\r\n const bodyNodes = (_a = i.findDirectStructure(Structures.Body)) === null || _a === void 0 ? void 0 : _a.findAllStatementNodes();\r\n if (bodyNodes === undefined || bodyNodes.length !== 1) {\r\n continue;\r\n }\r\n const bodyStatement = bodyNodes[0];\r\n if (!(bodyStatement.get() instanceof Statements.Move)) {\r\n continue;\r\n }\r\n const elseNodes = (_c = (_b = i.findDirectStructure(Structures.Else)) === null || _b === void 0 ? void 0 : _b.findDirectStructure(Structures.Body)) === null || _c === void 0 ? void 0 : _c.findAllStatementNodes();\r\n if (elseNodes === undefined || elseNodes.length !== 1) {\r\n continue;\r\n }\r\n const elseStatement = elseNodes[0];\r\n if (!(elseStatement.get() instanceof Statements.Move)) {\r\n continue;\r\n }\r\n let bodyTarget = (_d = bodyStatement.findFirstExpression(Expressions.Target)) === null || _d === void 0 ? void 0 : _d.concatTokens();\r\n if (bodyTarget === null || bodyTarget === void 0 ? void 0 : bodyTarget.startsWith(\"DATA(\")) {\r\n bodyTarget = bodyTarget.substr(5, bodyTarget.length - 6);\r\n }\r\n const elseTarget = (_e = elseStatement.findFirstExpression(Expressions.Target)) === null || _e === void 0 ? void 0 : _e.concatTokens();\r\n if (bodyTarget === undefined\r\n || elseTarget === undefined\r\n || bodyTarget.toUpperCase() !== elseTarget.toUpperCase()) {\r\n continue;\r\n }\r\n const bodySource = (_f = bodyStatement.findFirstExpression(Expressions.Source)) === null || _f === void 0 ? void 0 : _f.concatTokens().toUpperCase();\r\n const elseSource = (_g = elseStatement.findFirstExpression(Expressions.Source)) === null || _g === void 0 ? void 0 : _g.concatTokens().toUpperCase();\r\n if ((bodySource === \"ABAP_TRUE\" && elseSource === \"ABAP_FALSE\")\r\n || (bodySource === \"ABAP_FALSE\" && elseSource === \"ABAP_TRUE\")) {\r\n const func = (this.reg.getConfig().getVersion() >= version_1.Version.v740sp08\r\n || this.reg.getConfig().getVersion() === version_1.Version.Cloud) ? \"xsdbool\" : \"boolc\";\r\n const negate = bodySource === \"ABAP_FALSE\";\r\n const message = `Use ${func} instead of IF` + (negate ? \", negate expression\" : \"\");\r\n const start = i.getFirstToken().getStart();\r\n const end = i.getLastToken().getEnd();\r\n const statement = bodyTarget + \" = \" + func + \"( \" +\r\n (negate ? \"NOT ( \" : \"\") +\r\n ((_j = (_h = i.findFirstStatement(Statements.If)) === null || _h === void 0 ? void 0 : _h.findFirstExpression(Expressions.Cond)) === null || _j === void 0 ? void 0 : _j.concatTokens()) +\r\n (negate ? \" )\" : \"\") +\r\n \" ).\";\r\n const fix = edit_helper_1.EditHelper.replaceRange(file, start, end, statement);\r\n issues.push(issue_1.Issue.atRange(file, start, end, message, this.getMetadata().key, this.conf.severity, fix));\r\n }\r\n }\r\n if (version >= version_1.Version.v740sp08 || version === version_1.Version.Cloud) {\r\n for (const b of stru.findAllExpressions(Expressions.CondBody)) {\r\n const concat = b.concatTokens().toUpperCase();\r\n if (concat.endsWith(\" THEN ABAP_TRUE ELSE ABAP_FALSE\")\r\n || concat.endsWith(\" THEN ABAP_TRUE\")\r\n || concat.endsWith(\" THEN ABAP_FALSE ELSE ABAP_TRUE\")) {\r\n const message = \"Use xsdbool\";\r\n // eslint-disable-next-line max-len\r\n issues.push(issue_1.Issue.atRange(file, b.getFirstToken().getStart(), b.getLastToken().getEnd(), message, this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n}\r\nexports.UseBoolExpression = UseBoolExpression;\r\n//# sourceMappingURL=use_bool_expression.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/use_bool_expression.js?");
|
|
13363
13363
|
|
|
13364
13364
|
/***/ }),
|
|
13365
13365
|
|
|
@@ -13381,7 +13381,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
13381
13381
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13382
13382
|
|
|
13383
13383
|
"use strict";
|
|
13384
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UseLineExists = exports.UseLineExistsConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\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 _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 version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nclass UseLineExistsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.UseLineExistsConf = UseLineExistsConf;\r\nclass UseLineExists extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new UseLineExistsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"use_line_exists\",\r\n title: \"Use line_exists\",\r\n shortDescription: `Use line_exists, from 740sp02 and up`,\r\n extendedInformation: `\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-line_exists-to-read-table-or-loop-at\n\nNot reported if the READ TABLE statement contains BINARY SEARCH.`,\r\n tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n badExample: `READ TABLE my_table TRANSPORTING NO FIELDS WITH KEY key = 'A'.\nIF sy-subrc = 0.\nENDIF.`,\r\n goodExample: `IF line_exists( my_table[ key = 'A' ] ).\nENDIF.`,\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, obj) {\r\n const issues = [];\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n const vers = this.reg.getConfig().getVersion();\r\n if (vers === version_1.Version.OpenABAP) {\r\n return [];\r\n }\r\n else if (vers < version_1.Version.v740sp02 && vers !== version_1.Version.Cloud) {\r\n return [];\r\n }\r\n const statements = file.getStatements();\r\n for (let i = 0; i < statements.length; i++) {\r\n const statement = statements[i];\r\n if (!(statement.get() instanceof Statements.ReadTable)) {\r\n continue;\r\n }\r\n const concat = statement.concatTokens().toUpperCase();\r\n if (concat.includes(\" TRANSPORTING NO FIELDS\") === true\r\n && concat.includes(\" BINARY SEARCH\") === false\r\n && this.checksSubrc(i, statements) === true\r\n && this.usesTabix(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, \"Use line_exists\", this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n return issues;\r\n }\r\n ///////////////////////\r\n checksSubrc(index, statements) {\r\n for (let i = index + 1; i < statements.length; i++) {\r\n const statement = statements[i];\r\n if (statement.get() instanceof _statement_1.Comment) {\r\n continue;\r\n }\r\n for (const c of statement.findAllExpressions(Expressions.Cond)) {\r\n for (const s of c.findAllExpressions(Expressions.Source)) {\r\n if (s.concatTokens().toUpperCase() === \"SY-SUBRC\") {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n return false;\r\n }\r\n // this is a heuristic, data flow analysis is required to get the correct result\r\n usesTabix(index, statements) {\r\n for (let i = index + 1; i < index + 5; i++) {\r\n const statement = statements[i];\r\n if (statement === undefined) {\r\n break;\r\n }\r\n else if (statement.get() instanceof _statement_1.Comment) {\r\n continue;\r\n }\r\n else if (statement.concatTokens().toUpperCase().includes(\" SY-TABIX\")) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\nexports.UseLineExists = UseLineExists;\r\n//# sourceMappingURL=use_line_exists.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/use_line_exists.js?");
|
|
13384
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UseLineExists = exports.UseLineExistsConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\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 _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 version_1 = __webpack_require__(/*! ../version */ \"./node_modules/@abaplint/core/build/src/version.js\");\r\nconst _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/statements/_statement.js\");\r\nclass UseLineExistsConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.UseLineExistsConf = UseLineExistsConf;\r\nclass UseLineExists extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new UseLineExistsConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"use_line_exists\",\r\n title: \"Use line_exists\",\r\n shortDescription: `Use line_exists, from 740sp02 and up`,\r\n extendedInformation: `\r\nhttps://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-line_exists-to-read-table-or-loop-at\r\n\r\nNot reported if the READ TABLE statement contains BINARY SEARCH.`,\r\n tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.SingleFile],\r\n badExample: `READ TABLE my_table TRANSPORTING NO FIELDS WITH KEY key = 'A'.\r\nIF sy-subrc = 0.\r\nENDIF.`,\r\n goodExample: `IF line_exists( my_table[ key = 'A' ] ).\r\nENDIF.`,\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, obj) {\r\n const issues = [];\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n const vers = this.reg.getConfig().getVersion();\r\n if (vers === version_1.Version.OpenABAP) {\r\n return [];\r\n }\r\n else if (vers < version_1.Version.v740sp02 && vers !== version_1.Version.Cloud) {\r\n return [];\r\n }\r\n const statements = file.getStatements();\r\n for (let i = 0; i < statements.length; i++) {\r\n const statement = statements[i];\r\n if (!(statement.get() instanceof Statements.ReadTable)) {\r\n continue;\r\n }\r\n const concat = statement.concatTokens().toUpperCase();\r\n if (concat.includes(\" TRANSPORTING NO FIELDS\") === true\r\n && concat.includes(\" BINARY SEARCH\") === false\r\n && this.checksSubrc(i, statements) === true\r\n && this.usesTabix(i, statements) === false) {\r\n issues.push(issue_1.Issue.atStatement(file, statement, \"Use line_exists\", this.getMetadata().key, this.conf.severity));\r\n }\r\n }\r\n return issues;\r\n }\r\n ///////////////////////\r\n checksSubrc(index, statements) {\r\n for (let i = index + 1; i < statements.length; i++) {\r\n const statement = statements[i];\r\n if (statement.get() instanceof _statement_1.Comment) {\r\n continue;\r\n }\r\n for (const c of statement.findAllExpressions(Expressions.Cond)) {\r\n for (const s of c.findAllExpressions(Expressions.Source)) {\r\n if (s.concatTokens().toUpperCase() === \"SY-SUBRC\") {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n return false;\r\n }\r\n // this is a heuristic, data flow analysis is required to get the correct result\r\n usesTabix(index, statements) {\r\n for (let i = index + 1; i < index + 5; i++) {\r\n const statement = statements[i];\r\n if (statement === undefined) {\r\n break;\r\n }\r\n else if (statement.get() instanceof _statement_1.Comment) {\r\n continue;\r\n }\r\n else if (statement.concatTokens().toUpperCase().includes(\" SY-TABIX\")) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n}\r\nexports.UseLineExists = UseLineExists;\r\n//# sourceMappingURL=use_line_exists.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/use_line_exists.js?");
|
|
13385
13385
|
|
|
13386
13386
|
/***/ }),
|
|
13387
13387
|
|
|
@@ -13392,7 +13392,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
13392
13392
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13393
13393
|
|
|
13394
13394
|
"use strict";
|
|
13395
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UseNew = exports.UseNewConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\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 _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 expressions_1 = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass UseNewConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.UseNewConf = UseNewConf;\r\nclass UseNew extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new UseNewConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"use_new\",\r\n title: \"Use NEW\",\r\n shortDescription: `Checks for deprecated CREATE OBJECT statements.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-new-to-create-object\n\nIf the target variable is referenced in the CREATE OBJECT statement, no errors are issued\n\nApplicable from v740sp02 and up`,\r\n badExample: `CREATE OBJECT ref.`,\r\n goodExample: `ref = NEW #( ).`,\r\n tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getMessage() {\r\n return \"Use NEW #( ) to instantiate object.\";\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, obj) {\r\n var _a;\r\n const issues = [];\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n if (this.reg.getConfig().getVersion() < version_1.Version.v740sp02 && this.reg.getConfig().getVersion() !== version_1.Version.Cloud) {\r\n return [];\r\n }\r\n for (const statement of file.getStatements()) {\r\n if (statement.get() instanceof Statements.CreateObject) {\r\n if (statement.findFirstExpression(expressions_1.Dynamic)) {\r\n continue;\r\n }\r\n else if (statement.findDirectExpression(expressions_1.ParameterListExceptions)) {\r\n continue;\r\n }\r\n else if (statement.findDirectTokenByText(\"AREA\")) {\r\n continue;\r\n }\r\n const target = ((_a = statement.findDirectExpression(expressions_1.Target)) === null || _a === void 0 ? void 0 : _a.concatTokens()) + \"->\";\r\n if (statement.concatTokens().includes(target)) {\r\n continue;\r\n }\r\n const fix = this.buildFix(file, statement);\r\n const issue = issue_1.Issue.atPosition(file, statement.getStart(), this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n buildFix(file, statement) {\r\n var _a, _b;\r\n const target = (_a = statement.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n if (target === undefined) {\r\n return undefined;\r\n }\r\n const parameters = statement.findDirectExpression(Expressions.ParameterListS);\r\n const param = parameters ? parameters.concatTokens() + \" \" : \"\";\r\n let type = (_b = statement.findDirectExpression(Expressions.ClassName)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr();\r\n if (type === undefined) {\r\n type = \"#\";\r\n }\r\n const string = `${target} = NEW ${type}( ${param}).`;\r\n return edit_helper_1.EditHelper.replaceRange(file, statement.getStart(), statement.getEnd(), string);\r\n }\r\n}\r\nexports.UseNew = UseNew;\r\n//# sourceMappingURL=use_new.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/use_new.js?");
|
|
13395
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.UseNew = exports.UseNewConf = void 0;\r\nconst issue_1 = __webpack_require__(/*! ../issue */ \"./node_modules/@abaplint/core/build/src/issue.js\");\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 _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 expressions_1 = __webpack_require__(/*! ../abap/2_statements/expressions */ \"./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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nconst edit_helper_1 = __webpack_require__(/*! ../edit_helper */ \"./node_modules/@abaplint/core/build/src/edit_helper.js\");\r\nclass UseNewConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.UseNewConf = UseNewConf;\r\nclass UseNew extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new UseNewConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"use_new\",\r\n title: \"Use NEW\",\r\n shortDescription: `Checks for deprecated CREATE OBJECT statements.`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-new-to-create-object\r\n\r\nIf the target variable is referenced in the CREATE OBJECT statement, no errors are issued\r\n\r\nApplicable from v740sp02 and up`,\r\n badExample: `CREATE OBJECT ref.`,\r\n goodExample: `ref = NEW #( ).`,\r\n tags: [_irule_1.RuleTag.Upport, _irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],\r\n };\r\n }\r\n getMessage() {\r\n return \"Use NEW #( ) to instantiate object.\";\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, obj) {\r\n var _a;\r\n const issues = [];\r\n if (obj.getType() === \"INTF\") {\r\n return [];\r\n }\r\n if (this.reg.getConfig().getVersion() < version_1.Version.v740sp02 && this.reg.getConfig().getVersion() !== version_1.Version.Cloud) {\r\n return [];\r\n }\r\n for (const statement of file.getStatements()) {\r\n if (statement.get() instanceof Statements.CreateObject) {\r\n if (statement.findFirstExpression(expressions_1.Dynamic)) {\r\n continue;\r\n }\r\n else if (statement.findDirectExpression(expressions_1.ParameterListExceptions)) {\r\n continue;\r\n }\r\n else if (statement.findDirectTokenByText(\"AREA\")) {\r\n continue;\r\n }\r\n const target = ((_a = statement.findDirectExpression(expressions_1.Target)) === null || _a === void 0 ? void 0 : _a.concatTokens()) + \"->\";\r\n if (statement.concatTokens().includes(target)) {\r\n continue;\r\n }\r\n const fix = this.buildFix(file, statement);\r\n const issue = issue_1.Issue.atPosition(file, statement.getStart(), this.getMessage(), this.getMetadata().key, this.conf.severity, fix);\r\n issues.push(issue);\r\n }\r\n }\r\n return issues;\r\n }\r\n buildFix(file, statement) {\r\n var _a, _b;\r\n const target = (_a = statement.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n if (target === undefined) {\r\n return undefined;\r\n }\r\n const parameters = statement.findDirectExpression(Expressions.ParameterListS);\r\n const param = parameters ? parameters.concatTokens() + \" \" : \"\";\r\n let type = (_b = statement.findDirectExpression(Expressions.ClassName)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr();\r\n if (type === undefined) {\r\n type = \"#\";\r\n }\r\n const string = `${target} = NEW ${type}( ${param}).`;\r\n return edit_helper_1.EditHelper.replaceRange(file, statement.getStart(), statement.getEnd(), string);\r\n }\r\n}\r\nexports.UseNew = UseNew;\r\n//# sourceMappingURL=use_new.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/use_new.js?");
|
|
13396
13396
|
|
|
13397
13397
|
/***/ }),
|
|
13398
13398
|
|
|
@@ -13403,7 +13403,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
13403
13403
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13404
13404
|
|
|
13405
13405
|
"use strict";
|
|
13406
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.WhenOthersLast = exports.WhenOthersLastConf = void 0;\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 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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass WhenOthersLastConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.WhenOthersLastConf = WhenOthersLastConf;\r\nclass WhenOthersLast extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new WhenOthersLastConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"when_others_last\",\r\n title: \"WHEN OTHERS last\",\r\n shortDescription: `Checks that WHEN OTHERS is placed the last within a CASE statement.`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `CASE bar.\n WHEN OTHERS.\n WHEN 2.\nENDCASE.`,\r\n goodExample: `CASE bar.\n WHEN 2.\n WHEN OTHERS.\nENDCASE.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"WHEN OTHERS should be the last branch in a CASE statement.\";\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n const struc = file.getStructure();\r\n if (struc === undefined) {\r\n return [];\r\n }\r\n const cases = struc.findAllStructures(Structures.Case);\r\n for (const c of cases) {\r\n const whentop = c.findDirectStructures(Structures.When);\r\n for (let i = 0; i < whentop.length - 1; i++) {\r\n const whens = whentop[i].findDirectStatements(Statements.When).concat(whentop[i].findDirectStatements(Statements.WhenOthers));\r\n for (const when of whens) {\r\n if (when.get() instanceof Statements.WhenOthers) {\r\n const start = when.getFirstToken().getStart();\r\n const issue = issue_1.Issue.atPosition(file, start, this.getMessage(), this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n }\r\n return issues;\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}\r\nexports.WhenOthersLast = WhenOthersLast;\r\n//# sourceMappingURL=when_others_last.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/when_others_last.js?");
|
|
13406
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.WhenOthersLast = exports.WhenOthersLastConf = void 0;\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 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 _irule_1 = __webpack_require__(/*! ./_irule */ \"./node_modules/@abaplint/core/build/src/rules/_irule.js\");\r\nclass WhenOthersLastConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.WhenOthersLastConf = WhenOthersLastConf;\r\nclass WhenOthersLast extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new WhenOthersLastConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"when_others_last\",\r\n title: \"WHEN OTHERS last\",\r\n shortDescription: `Checks that WHEN OTHERS is placed the last within a CASE statement.`,\r\n tags: [_irule_1.RuleTag.SingleFile],\r\n badExample: `CASE bar.\r\n WHEN OTHERS.\r\n WHEN 2.\r\nENDCASE.`,\r\n goodExample: `CASE bar.\r\n WHEN 2.\r\n WHEN OTHERS.\r\nENDCASE.`,\r\n };\r\n }\r\n getMessage() {\r\n return \"WHEN OTHERS should be the last branch in a CASE statement.\";\r\n }\r\n runParsed(file) {\r\n const issues = [];\r\n const struc = file.getStructure();\r\n if (struc === undefined) {\r\n return [];\r\n }\r\n const cases = struc.findAllStructures(Structures.Case);\r\n for (const c of cases) {\r\n const whentop = c.findDirectStructures(Structures.When);\r\n for (let i = 0; i < whentop.length - 1; i++) {\r\n const whens = whentop[i].findDirectStatements(Statements.When).concat(whentop[i].findDirectStatements(Statements.WhenOthers));\r\n for (const when of whens) {\r\n if (when.get() instanceof Statements.WhenOthers) {\r\n const start = when.getFirstToken().getStart();\r\n const issue = issue_1.Issue.atPosition(file, start, this.getMessage(), this.getMetadata().key, this.conf.severity);\r\n issues.push(issue);\r\n }\r\n }\r\n }\r\n }\r\n return issues;\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}\r\nexports.WhenOthersLast = WhenOthersLast;\r\n//# sourceMappingURL=when_others_last.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/when_others_last.js?");
|
|
13407
13407
|
|
|
13408
13408
|
/***/ }),
|
|
13409
13409
|
|