@abaplint/cli 2.82.0 → 2.82.4
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/abaplint +1 -1
- package/build/{bundle.js → cli.js} +18 -7
- package/build/src/apack_dependency_provider.js +30 -0
- package/build/src/compressed_file.js +22 -0
- package/build/src/file_operations.js +48 -0
- package/build/src/fixes.js +74 -0
- package/build/src/formatters/_format.js +23 -0
- package/build/src/formatters/_iformatter.js +3 -0
- package/build/src/formatters/codeframe.js +74 -0
- package/build/src/formatters/index.js +18 -0
- package/build/src/formatters/json.js +28 -0
- package/build/src/formatters/junit.js +58 -0
- package/build/src/formatters/standard.js +61 -0
- package/build/src/formatters/total.js +10 -0
- package/build/src/index.d.ts +20 -0
- package/build/src/index.js +206 -0
- package/build/src/rename.js +79 -0
- package/package.json +6 -4
package/abaplint
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
require("./build/
|
|
2
|
+
require("./build/cli");
|
|
@@ -27,7 +27,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
27
27
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
28
28
|
|
|
29
29
|
"use strict";
|
|
30
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nconst fs = __webpack_require__(/*! fs */ \"fs\");\r\nconst os = __webpack_require__(/*! os */ \"os\");\r\nconst path = __webpack_require__(/*! path */ \"path\");\r\nconst minimist = __webpack_require__(/*! minimist */ \"./node_modules/minimist/index.js\");\r\nconst ProgressBar = __webpack_require__(/*! progress */ \"./node_modules/progress/index.js\");\r\nconst childProcess = __webpack_require__(/*! child_process */ \"child_process\");\r\nconst JSON5 = __webpack_require__(/*! json5 */ \"./node_modules/json5/dist/index.mjs\");\r\nconst core_1 = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst _format_1 = __webpack_require__(/*! ./formatters/_format */ \"./build/src/formatters/_format.js\");\r\nconst file_operations_1 = __webpack_require__(/*! ./file_operations */ \"./build/src/file_operations.js\");\r\nconst apack_dependency_provider_1 = __webpack_require__(/*! ./apack_dependency_provider */ \"./build/src/apack_dependency_provider.js\");\r\nconst fixes_1 = __webpack_require__(/*! ./fixes */ \"./build/src/fixes.js\");\r\nconst rename_1 = __webpack_require__(/*! ./rename */ \"./build/src/rename.js\");\r\nconst GENERIC_ERROR = \"generic_error\";\r\nclass Progress {\r\n set(total, _text) {\r\n this.bar = new ProgressBar(\":percent - :elapseds - :text\", { total, renderThrottle: 100 });\r\n }\r\n async tick(text) {\r\n this.bar.tick({ text });\r\n this.bar.render();\r\n }\r\n tickSync(text) {\r\n this.bar.tick({ text });\r\n this.bar.render();\r\n }\r\n}\r\nfunction loadConfig(filename) {\r\n // possible cases:\r\n // a) nothing specified, using abaplint.json from cwd\r\n // b) nothing specified, no abaplint.json in cwd\r\n // c) specified and found\r\n // d) specified and not found => use default\r\n // e) supplied but a directory => use default\r\n let f = \"\";\r\n if (filename === undefined) {\r\n f = process.cwd() + path.sep + \"abaplint.json\";\r\n if (fs.existsSync(f) === false) {\r\n f = process.cwd() + path.sep + \"abaplint.jsonc\";\r\n }\r\n if (fs.existsSync(f) === false) {\r\n f = process.cwd() + path.sep + \"abaplint.json5\";\r\n }\r\n if (fs.existsSync(f) === false) {\r\n process.stderr.write(\"Using default config\\n\");\r\n return { config: core_1.Config.getDefault(), base: \".\" };\r\n }\r\n }\r\n else {\r\n if (fs.existsSync(filename) === false) {\r\n process.stderr.write(\"ERROR: Specified abaplint configuration file does not exist, using default config\\n\");\r\n return { config: core_1.Config.getDefault(), base: \".\" };\r\n }\r\n else if (fs.statSync(filename).isDirectory() === true) {\r\n process.stderr.write(\"Supply filename, not directory, using default config\\n\");\r\n return { config: core_1.Config.getDefault(), base: \".\" };\r\n }\r\n f = filename;\r\n }\r\n // evil hack to get JSON5 working\r\n // @ts-ignore\r\n JSON5.parse = JSON5.default.parse;\r\n process.stderr.write(\"Using config: \" + f + \"\\n\");\r\n const json = fs.readFileSync(f, \"utf8\");\r\n const parsed = JSON5.parse(json);\r\n const vers = core_1.Version;\r\n if (Object.keys(core_1.Version).some(v => vers[v] === parsed.syntax.version) === false) {\r\n throw \"Error: Unknown version in abaplint.json\";\r\n }\r\n return {\r\n config: new core_1.Config(json),\r\n base: path.dirname(f) === process.cwd() ? \".\" : path.dirname(f),\r\n };\r\n}\r\nasync function loadDependencies(config, compress, bar, base) {\r\n let files = [];\r\n const deps = config.get().dependencies || [];\r\n const useApack = config.get().global.useApackDependencies;\r\n if (useApack) {\r\n const apackPath = path.join(base, \".apack-manifest.xml\");\r\n if (fs.existsSync(apackPath)) {\r\n const apackManifest = fs.readFileSync(apackPath, \"utf8\");\r\n deps.push(...apack_dependency_provider_1.ApackDependencyProvider.fromManifest(apackManifest));\r\n }\r\n }\r\n if (!deps) {\r\n return [];\r\n }\r\n for (const d of deps) {\r\n if (d.folder) {\r\n const g = base + d.folder + d.files;\r\n const names = file_operations_1.FileOperations.loadFileNames(g, false);\r\n if (names.length > 0) {\r\n process.stderr.write(\"Using dependency from: \" + g + \"\\n\");\r\n files = files.concat(await file_operations_1.FileOperations.loadFiles(compress, names, bar));\r\n continue;\r\n }\r\n }\r\n if (d.url) {\r\n process.stderr.write(\"Clone: \" + d.url + \"\\n\");\r\n const dir = fs.mkdtempSync(path.join(os.tmpdir(), \"abaplint-\"));\r\n childProcess.execSync(\"git clone --quiet --depth 1 \" + d.url + \" .\", { cwd: dir, stdio: \"inherit\" });\r\n const names = file_operations_1.FileOperations.loadFileNames(dir + d.files);\r\n files = files.concat(await file_operations_1.FileOperations.loadFiles(compress, names, bar));\r\n file_operations_1.FileOperations.deleteFolderRecursive(dir);\r\n }\r\n }\r\n return files;\r\n}\r\nfunction displayHelp() {\r\n // follow docopt.org conventions,\r\n return \"Usage:\\n\" +\r\n \" abaplint [<abaplint.json> -f <format> -c --outformat <format> --outfile <file> --fix] \\n\" +\r\n \" abaplint -h | --help show this help\\n\" +\r\n \" abaplint -v | --version show version\\n\" +\r\n \" abaplint -d | --default show default configuration\\n\" +\r\n \"\\n\" +\r\n \"Options:\\n\" +\r\n \" -f, --format <format> output format (standard, total, json, summary, junit, codeframe)\\n\" +\r\n \" --outformat <format> output format, use in combination with outfile\\n\" +\r\n \" --outfile <file> output issues to file in format\\n\" +\r\n \" --fix apply quick fixes to files\\n\" +\r\n \" --rename rename object according to rules in abaplint.json\\n\" +\r\n \" -p output performance information\\n\" +\r\n \" -c compress files in memory\\n\";\r\n}\r\nfunction out(issues, format, length, argv) {\r\n const output = _format_1.Formatter.format(issues, format, length);\r\n if (argv[\"outformat\"] && argv[\"outfile\"]) {\r\n const fileContents = _format_1.Formatter.format(issues, argv[\"outformat\"], length);\r\n fs.writeFileSync(argv[\"outfile\"], fileContents, \"utf-8\");\r\n }\r\n return output;\r\n}\r\nasync function run() {\r\n var _a, _b;\r\n // evil hack to get JSON5 working\r\n // @ts-ignore\r\n JSON5.parse = JSON5.default.parse;\r\n // @ts-ignore\r\n JSON5.stringify = JSON5.default.stringify;\r\n const argv = minimist(process.argv.slice(2), { boolean: [\"p\", \"c\", \"fix\", \"rename\"] });\r\n let format = \"standard\";\r\n let output = \"\";\r\n let issues = [];\r\n if (argv[\"f\"] !== undefined || argv[\"format\"] !== undefined) {\r\n format = argv[\"f\"] ? argv[\"f\"] : argv[\"format\"];\r\n }\r\n const progress = new Progress();\r\n const compress = argv[\"c\"] ? true : false;\r\n const parsingPerformance = argv[\"p\"] ? true : false;\r\n if (argv[\"h\"] !== undefined || argv[\"help\"] !== undefined) {\r\n output = output + displayHelp();\r\n }\r\n else if (argv[\"v\"] !== undefined || argv[\"version\"] !== undefined) {\r\n output = output + core_1.Registry.abaplintVersion() + \"\\n\";\r\n }\r\n else if (argv[\"d\"] !== undefined || argv[\"default\"] !== undefined) {\r\n output = output + JSON.stringify(core_1.Config.getDefault().get(), undefined, 2) + \"\\n\";\r\n }\r\n else {\r\n process.stderr.write(\"abaplint \" + core_1.Registry.abaplintVersion() + \"\\n\");\r\n let loaded = [];\r\n let deps = [];\r\n let reg = undefined;\r\n const { config, base } = loadConfig(argv._[0]);\r\n try {\r\n if (config.get().global.files === undefined) {\r\n throw \"Error: Update abaplint configuration file to latest format\";\r\n }\r\n const files = file_operations_1.FileOperations.loadFileNames(base + config.get().global.files);\r\n loaded = await file_operations_1.FileOperations.loadFiles(compress, files, progress);\r\n deps = await loadDependencies(config, compress, progress, base);\r\n reg = new core_1.Registry(config);\r\n reg.addDependencies(deps);\r\n reg.addFiles(loaded); // if the object exists in repo, it should take precedence over deps\r\n await reg.parseAsync({ progress, outputPerformance: parsingPerformance });\r\n issues = issues.concat(reg.findIssues({ progress, outputPerformance: parsingPerformance }));\r\n }\r\n catch (error) {\r\n const file = new core_1.MemoryFile(\"generic\", \"dummy\");\r\n const message = error.toString() + \" \" + ((_b = (_a = error.stack) === null || _a === void 0 ? void 0 : _a.split(\"\\n\")[1]) === null || _b === void 0 ? void 0 : _b.trim());\r\n const issue = core_1.Issue.atPosition(file, new core_1.Position(1, 1), message, GENERIC_ERROR);\r\n issues = [issue];\r\n }\r\n let extra = \"\";\r\n if (argv[\"fix\"] && reg) {\r\n // @ts-ignore\r\n issues = (0, fixes_1.applyFixes)(issues, reg, fs, progress);\r\n extra = \"Fixes applied\";\r\n }\r\n else if (argv[\"rename\"] && reg) {\r\n if (issues.length === 0) {\r\n new rename_1.Rename(reg).run(config, base);\r\n extra = \"Renames applied\";\r\n }\r\n else {\r\n extra = \"Renames NOT applied, issues found\";\r\n }\r\n }\r\n output = out(issues, format, loaded.length, argv) + extra;\r\n }\r\n return { output, issues };\r\n}\r\nrun().then(({ output, issues }) => {\r\n if (output.length > 0) {\r\n process.stdout.write(output, () => {\r\n if (issues.length > 0) {\r\n if (issues[0].getKey() === GENERIC_ERROR) {\r\n process.exit(2); // eg. \"git\" does not exist in system\r\n }\r\n else {\r\n process.exit(1);\r\n }\r\n }\r\n else {\r\n process.exit();\r\n }\r\n });\r\n }\r\n else {\r\n process.exit();\r\n }\r\n}).catch((err) => {\r\n console.log(err);\r\n process.exit(2);\r\n});\r\n//# sourceMappingURL=cli.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./build/src/cli.js?");
|
|
30
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nconst minimist = __webpack_require__(/*! minimist */ \"./node_modules/minimist/index.js\");\r\nconst _1 = __webpack_require__(/*! . */ \"./build/src/index.js\");\r\nconst parsed = minimist(process.argv.slice(2), { boolean: [\"p\", \"c\", \"fix\", \"rename\"] });\r\nlet format = \"standard\";\r\nif (parsed[\"f\"] !== undefined || parsed[\"format\"] !== undefined) {\r\n format = parsed[\"f\"] ? parsed[\"f\"] : parsed[\"format\"];\r\n}\r\nconst arg = {\r\n configFilename: parsed._[0],\r\n format,\r\n compress: parsed[\"c\"],\r\n parsingPerformance: parsed[\"p\"],\r\n showHelp: parsed[\"h\"] !== undefined || parsed[\"help\"] !== undefined,\r\n showVersion: parsed[\"v\"] !== undefined || parsed[\"version\"] !== undefined,\r\n outputDefaultConfig: parsed[\"d\"] !== undefined || parsed[\"default\"] !== undefined,\r\n runFix: parsed[\"fix\"],\r\n runRename: parsed[\"rename\"],\r\n outFormat: parsed[\"outformat\"],\r\n outFile: parsed[\"outfile\"],\r\n};\r\n(0, _1.run)(arg).then(({ output, issues }) => {\r\n if (output.length > 0) {\r\n process.stdout.write(output, () => {\r\n if (issues.length > 0) {\r\n if (issues[0].getKey() === _1.GENERIC_ERROR) {\r\n process.exit(2); // eg. \"git\" does not exist in system\r\n }\r\n else {\r\n process.exit(1);\r\n }\r\n }\r\n else {\r\n process.exit();\r\n }\r\n });\r\n }\r\n else {\r\n process.exit();\r\n }\r\n}).catch((err) => {\r\n console.log(err);\r\n process.exit(2);\r\n});\r\n//# sourceMappingURL=cli.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./build/src/cli.js?");
|
|
31
31
|
|
|
32
32
|
/***/ }),
|
|
33
33
|
|
|
@@ -49,7 +49,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
49
49
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
50
50
|
|
|
51
51
|
"use strict";
|
|
52
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FileOperations = void 0;\r\nconst fs = __webpack_require__(/*! fs */ \"fs\");\r\nconst path = __webpack_require__(/*! path */ \"path\");\r\nconst zlib = __webpack_require__(/*! zlib */ \"zlib\");\r\nconst glob = __webpack_require__(/*! glob */ \"./node_modules/glob/glob.js\");\r\nconst core_1 = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst compressed_file_1 = __webpack_require__(/*! ./compressed_file */ \"./build/src/compressed_file.js\");\r\nclass FileOperations {\r\n static deleteFolderRecursive(
|
|
52
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FileOperations = void 0;\r\nconst fs = __webpack_require__(/*! fs */ \"fs\");\r\nconst path = __webpack_require__(/*! path */ \"path\");\r\nconst zlib = __webpack_require__(/*! zlib */ \"zlib\");\r\nconst glob = __webpack_require__(/*! glob */ \"./node_modules/glob/glob.js\");\r\nconst core_1 = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst compressed_file_1 = __webpack_require__(/*! ./compressed_file */ \"./build/src/compressed_file.js\");\r\nclass FileOperations {\r\n static deleteFolderRecursive(dir) {\r\n if (fs.existsSync(dir) === false) {\r\n return;\r\n }\r\n fs.rmSync(dir, { recursive: true });\r\n }\r\n static loadFileNames(arg, error = true) {\r\n const files = glob.sync(arg, { nosort: true, nodir: true });\r\n if (files.length === 0 && error) {\r\n throw \"Error: No files found\";\r\n }\r\n return files;\r\n }\r\n static async loadFiles(compress, input, bar) {\r\n const files = [];\r\n bar.set(input.length, \"Reading files\");\r\n for (const filename of input) {\r\n bar.tick(\"Reading files - \" + path.basename(filename));\r\n const base = filename.split(\"/\").reverse()[0];\r\n if (base.split(\".\").length <= 2) {\r\n continue; // not a abapGit file\r\n }\r\n // note that readFileSync is typically faster than async readFile,\r\n // https://medium.com/@adamhooper/node-synchronous-code-runs-faster-than-asynchronous-code-b0553d5cf54e\r\n const raw = fs.readFileSync(filename, \"utf8\");\r\n if (compress === true) {\r\n // todo, util.promisify(zlib.deflate) does not seem to work?\r\n files.push(new compressed_file_1.CompressedFile(filename, zlib.deflateSync(raw).toString(\"base64\")));\r\n }\r\n else {\r\n files.push(new core_1.MemoryFile(filename, raw));\r\n }\r\n }\r\n return files;\r\n }\r\n}\r\nexports.FileOperations = FileOperations;\r\n//# sourceMappingURL=file_operations.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./build/src/file_operations.js?");
|
|
53
53
|
|
|
54
54
|
/***/ }),
|
|
55
55
|
|
|
@@ -141,6 +141,17 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
141
141
|
|
|
142
142
|
/***/ }),
|
|
143
143
|
|
|
144
|
+
/***/ "./build/src/index.js":
|
|
145
|
+
/*!****************************!*\
|
|
146
|
+
!*** ./build/src/index.js ***!
|
|
147
|
+
\****************************/
|
|
148
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
149
|
+
|
|
150
|
+
"use strict";
|
|
151
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.run = exports.GENERIC_ERROR = void 0;\r\nconst fs = __webpack_require__(/*! fs */ \"fs\");\r\nconst os = __webpack_require__(/*! os */ \"os\");\r\nconst path = __webpack_require__(/*! path */ \"path\");\r\nconst ProgressBar = __webpack_require__(/*! progress */ \"./node_modules/progress/index.js\");\r\nconst childProcess = __webpack_require__(/*! child_process */ \"child_process\");\r\nconst JSON5 = __webpack_require__(/*! json5 */ \"./node_modules/json5/dist/index.mjs\");\r\nconst core_1 = __webpack_require__(/*! @abaplint/core */ \"./node_modules/@abaplint/core/build/src/index.js\");\r\nconst _format_1 = __webpack_require__(/*! ./formatters/_format */ \"./build/src/formatters/_format.js\");\r\nconst file_operations_1 = __webpack_require__(/*! ./file_operations */ \"./build/src/file_operations.js\");\r\nconst apack_dependency_provider_1 = __webpack_require__(/*! ./apack_dependency_provider */ \"./build/src/apack_dependency_provider.js\");\r\nconst fixes_1 = __webpack_require__(/*! ./fixes */ \"./build/src/fixes.js\");\r\nconst rename_1 = __webpack_require__(/*! ./rename */ \"./build/src/rename.js\");\r\nexports.GENERIC_ERROR = \"generic_error\";\r\nclass Progress {\r\n set(total, _text) {\r\n this.bar = new ProgressBar(\":percent - :elapseds - :text\", { total, renderThrottle: 100 });\r\n }\r\n async tick(text) {\r\n this.bar.tick({ text });\r\n this.bar.render();\r\n }\r\n tickSync(text) {\r\n this.bar.tick({ text });\r\n this.bar.render();\r\n }\r\n}\r\nfunction loadConfig(filename) {\r\n // possible cases:\r\n // a) nothing specified, using abaplint.json from cwd\r\n // b) nothing specified, no abaplint.json in cwd\r\n // c) specified and found\r\n // d) specified and not found => use default\r\n // e) supplied but a directory => use default\r\n let f = \"\";\r\n if (filename === undefined) {\r\n f = process.cwd() + path.sep + \"abaplint.json\";\r\n if (fs.existsSync(f) === false) {\r\n f = process.cwd() + path.sep + \"abaplint.jsonc\";\r\n }\r\n if (fs.existsSync(f) === false) {\r\n f = process.cwd() + path.sep + \"abaplint.json5\";\r\n }\r\n if (fs.existsSync(f) === false) {\r\n process.stderr.write(\"Using default config\\n\");\r\n return { config: core_1.Config.getDefault(), base: \".\" };\r\n }\r\n }\r\n else {\r\n if (fs.existsSync(filename) === false) {\r\n process.stderr.write(\"ERROR: Specified abaplint configuration file does not exist, using default config\\n\");\r\n return { config: core_1.Config.getDefault(), base: \".\" };\r\n }\r\n else if (fs.statSync(filename).isDirectory() === true) {\r\n process.stderr.write(\"Supply filename, not directory, using default config\\n\");\r\n return { config: core_1.Config.getDefault(), base: \".\" };\r\n }\r\n f = filename;\r\n }\r\n // evil hack to get JSON5 working\r\n if (JSON5.parse === undefined) {\r\n // @ts-ignore\r\n JSON5.parse = JSON5.default.parse;\r\n }\r\n process.stderr.write(\"Using config: \" + f + \"\\n\");\r\n const json = fs.readFileSync(f, \"utf8\");\r\n const parsed = JSON5.parse(json);\r\n const vers = core_1.Version;\r\n if (Object.keys(core_1.Version).some(v => vers[v] === parsed.syntax.version) === false) {\r\n throw \"Error: Unknown version in abaplint.json\";\r\n }\r\n return {\r\n config: new core_1.Config(json),\r\n base: path.dirname(f) === process.cwd() ? \".\" : path.dirname(f),\r\n };\r\n}\r\nasync function loadDependencies(config, compress, bar, base) {\r\n let files = [];\r\n const deps = config.get().dependencies || [];\r\n const useApack = config.get().global.useApackDependencies;\r\n if (useApack) {\r\n const apackPath = path.join(base, \".apack-manifest.xml\");\r\n if (fs.existsSync(apackPath)) {\r\n const apackManifest = fs.readFileSync(apackPath, \"utf8\");\r\n deps.push(...apack_dependency_provider_1.ApackDependencyProvider.fromManifest(apackManifest));\r\n }\r\n }\r\n if (!deps) {\r\n return [];\r\n }\r\n for (const d of deps) {\r\n if (d.folder) {\r\n const g = base + d.folder + d.files;\r\n const names = file_operations_1.FileOperations.loadFileNames(g, false);\r\n if (names.length > 0) {\r\n process.stderr.write(\"Using dependency from: \" + g + \"\\n\");\r\n files = files.concat(await file_operations_1.FileOperations.loadFiles(compress, names, bar));\r\n continue;\r\n }\r\n }\r\n if (d.url) {\r\n process.stderr.write(\"Clone: \" + d.url + \"\\n\");\r\n const dir = fs.mkdtempSync(path.join(os.tmpdir(), \"abaplint-\"));\r\n childProcess.execSync(\"git clone --quiet --depth 1 \" + d.url + \" .\", { cwd: dir, stdio: \"inherit\" });\r\n const names = file_operations_1.FileOperations.loadFileNames(dir + d.files);\r\n files = files.concat(await file_operations_1.FileOperations.loadFiles(compress, names, bar));\r\n file_operations_1.FileOperations.deleteFolderRecursive(dir);\r\n }\r\n }\r\n return files;\r\n}\r\nfunction displayHelp() {\r\n // follow https://docopt.org conventions,\r\n return \"Usage:\\n\" +\r\n \" abaplint [<abaplint.json> -f <format> -c --outformat <format> --outfile <file> --fix] \\n\" +\r\n \" abaplint -h | --help show this help\\n\" +\r\n \" abaplint -v | --version show version\\n\" +\r\n \" abaplint -d | --default show default configuration\\n\" +\r\n \"\\n\" +\r\n \"Options:\\n\" +\r\n \" -f, --format <format> output format (standard, total, json, summary, junit, codeframe)\\n\" +\r\n \" --outformat <format> output format, use in combination with outfile\\n\" +\r\n \" --outfile <file> output issues to file in format\\n\" +\r\n \" --fix apply quick fixes to files\\n\" +\r\n \" --rename rename object according to rules in abaplint.json\\n\" +\r\n \" -p output performance information\\n\" +\r\n \" -c compress files in memory\\n\";\r\n}\r\nfunction out(issues, length, arg) {\r\n const output = _format_1.Formatter.format(issues, arg.format, length);\r\n if (arg.outFormat && arg.outFile) {\r\n const fileContents = _format_1.Formatter.format(issues, arg.outFile, length);\r\n fs.writeFileSync(arg.outFile, fileContents, \"utf-8\");\r\n }\r\n return output;\r\n}\r\nasync function run(arg) {\r\n var _a, _b;\r\n // evil hack to get JSON5 working\r\n if (JSON5.parse === undefined) {\r\n // @ts-ignore\r\n JSON5.parse = JSON5.default.parse;\r\n }\r\n if (JSON5.stringify === undefined) {\r\n // @ts-ignore\r\n JSON5.stringify = JSON5.default.stringify;\r\n }\r\n let output = \"\";\r\n let issues = [];\r\n let reg = undefined;\r\n const progress = new Progress();\r\n if (arg.showHelp === true) {\r\n output = output + displayHelp();\r\n }\r\n else if (arg.showVersion === true) {\r\n output = output + core_1.Registry.abaplintVersion() + \"\\n\";\r\n }\r\n else if (arg.outputDefaultConfig === true) {\r\n output = output + JSON.stringify(core_1.Config.getDefault().get(), undefined, 2) + \"\\n\";\r\n }\r\n else {\r\n process.stderr.write(\"abaplint \" + core_1.Registry.abaplintVersion() + \"\\n\");\r\n let loaded = [];\r\n let deps = [];\r\n const { config, base } = loadConfig(arg.configFilename);\r\n try {\r\n if (config.get().global.files === undefined) {\r\n throw \"Error: Update abaplint configuration file to latest format\";\r\n }\r\n const files = file_operations_1.FileOperations.loadFileNames(base + config.get().global.files);\r\n loaded = await file_operations_1.FileOperations.loadFiles(arg.compress, files, progress);\r\n deps = await loadDependencies(config, arg.compress, progress, base);\r\n reg = new core_1.Registry(config);\r\n reg.addDependencies(deps);\r\n reg.addFiles(loaded); // if the object exists in repo, it should take precedence over deps\r\n await reg.parseAsync({ progress, outputPerformance: arg.parsingPerformance });\r\n issues = issues.concat(reg.findIssues({ progress, outputPerformance: arg.parsingPerformance }));\r\n }\r\n catch (error) {\r\n const file = new core_1.MemoryFile(\"generic\", \"dummy\");\r\n const message = error.toString() + \" \" + ((_b = (_a = error.stack) === null || _a === void 0 ? void 0 : _a.split(\"\\n\")[1]) === null || _b === void 0 ? void 0 : _b.trim());\r\n const issue = core_1.Issue.atPosition(file, new core_1.Position(1, 1), message, exports.GENERIC_ERROR);\r\n issues = [issue];\r\n }\r\n let extra = \"\";\r\n if (arg.runFix === true && reg) {\r\n issues = (0, fixes_1.applyFixes)(issues, reg, fs, progress);\r\n extra = \"Fixes applied\";\r\n }\r\n else if (arg.runRename === true && reg) {\r\n if (issues.length === 0) {\r\n new rename_1.Rename(reg).run(config, base);\r\n extra = \"Renames applied\";\r\n }\r\n else {\r\n extra = \"Renames NOT applied, issues found\";\r\n }\r\n }\r\n output = out(issues, loaded.length, arg) + extra;\r\n }\r\n return { output, issues, reg };\r\n}\r\nexports.run = run;\r\n//# sourceMappingURL=index.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./build/src/index.js?");
|
|
152
|
+
|
|
153
|
+
/***/ }),
|
|
154
|
+
|
|
144
155
|
/***/ "./build/src/rename.js":
|
|
145
156
|
/*!*****************************!*\
|
|
146
157
|
!*** ./build/src/rename.js ***!
|
|
@@ -159,7 +170,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
159
170
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
160
171
|
|
|
161
172
|
"use strict";
|
|
162
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Lexer = void 0;\r\nconst Tokens = __webpack_require__(/*! ./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\nvar Mode;\r\n(function (Mode) {\r\n Mode[Mode[\"Normal\"] = 0] = \"Normal\";\r\n Mode[Mode[\"Ping\"] = 1] = \"Ping\";\r\n Mode[Mode[\"Str\"] = 2] = \"Str\";\r\n Mode[Mode[\"Template\"] = 3] = \"Template\";\r\n Mode[Mode[\"Comment\"] = 4] = \"Comment\";\r\n Mode[Mode[\"Pragma\"] = 5] = \"Pragma\";\r\n})(Mode || (Mode = {}));\r\nclass Buffer {\r\n constructor() {\r\n this.buf = \"\";\r\n }\r\n add(s) {\r\n this.buf = this.buf + s;\r\n }\r\n get() {\r\n return this.buf;\r\n }\r\n clear() {\r\n this.buf = \"\";\r\n }\r\n}\r\nclass Stream {\r\n constructor(raw) {\r\n this.offset = -1;\r\n this.raw = raw;\r\n this.row = 0;\r\n this.col = 0;\r\n }\r\n advance() {\r\n if (this.currentChar() === \"\\n\") {\r\n this.col = 1;\r\n this.row = this.row + 1;\r\n }\r\n if (this.offset === this.raw.length) {\r\n return false;\r\n }\r\n this.col = this.col + 1;\r\n this.offset = this.offset + 1;\r\n return true;\r\n }\r\n getCol() {\r\n return this.col;\r\n }\r\n getRow() {\r\n return this.row;\r\n }\r\n prevChar() {\r\n return this.raw.substr(this.offset - 1, 1);\r\n }\r\n prevPrevChar() {\r\n return this.raw.substr(this.offset - 2, 2);\r\n }\r\n currentChar() {\r\n if (this.offset < 0) {\r\n return \"\\n\"; // simulate newline at start of file to handle star(*) comments\r\n }\r\n return this.raw.substr(this.offset, 1);\r\n }\r\n nextChar() {\r\n return this.raw.substr(this.offset + 1, 1);\r\n }\r\n nextNextChar() {\r\n return this.raw.substr(this.offset + 1, 2);\r\n }\r\n}\r\nclass Lexer {\r\n static run(file, virtual) {\r\n this.virtual = virtual;\r\n this.tokens = [];\r\n this.m = Mode.Normal;\r\n this.process(file.getRaw());\r\n return { file, tokens: this.tokens };\r\n }\r\n static add() {\r\n const s = this.buffer.get().trim();\r\n if (s.length > 0) {\r\n const col = this.stream.getCol();\r\n const row = this.stream.getRow();\r\n let whiteBefore = false;\r\n const prev = this.stream.prevChar();\r\n if (prev === \" \" || prev === \"\\n\" || prev === \"\\t\" || prev === \":\") {\r\n whiteBefore = true;\r\n }\r\n let whiteAfter = false;\r\n const next = this.stream.nextChar();\r\n if (next === \" \" || next === \"\\n\" || next === \"\\t\" || next === \":\" || next === \",\" || next === \".\" || next === \"\" || next === \"\\\"\") {\r\n whiteAfter = true;\r\n }\r\n let pos = new position_1.Position(row, col - s.length);\r\n if (this.virtual) {\r\n pos = new position_1.VirtualPosition(this.virtual, pos.getRow(), pos.getCol());\r\n }\r\n let tok = undefined;\r\n if (this.m === Mode.Comment) {\r\n tok = new Tokens.Comment(pos, s);\r\n }\r\n else if (this.m === Mode.Ping || this.m === Mode.Str) {\r\n tok = new Tokens.String(pos, s);\r\n }\r\n else if (this.m === Mode.Template) {\r\n const first = s.charAt(0);\r\n const last = s.charAt(s.length - 1);\r\n if (first === \"|\" && last === \"|\") {\r\n tok = new Tokens.StringTemplate(pos, s);\r\n }\r\n else if (first === \"|\" && last === \"{\") {\r\n tok = new Tokens.StringTemplateBegin(pos, s);\r\n }\r\n else if (first === \"}\" && last === \"|\") {\r\n tok = new Tokens.StringTemplateEnd(pos, s);\r\n }\r\n else if (first === \"}\" && last === \"{\") {\r\n tok = new Tokens.StringTemplateMiddle(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.Identifier(pos, s);\r\n }\r\n }\r\n else if (s.substr(0, 2) === \"##\") {\r\n tok = new Tokens.Pragma(pos, s);\r\n }\r\n else if (s.length === 1) {\r\n if (s === \".\" || s === \",\") {\r\n tok = new Tokens.Punctuation(pos, s);\r\n }\r\n else if (s === \"[\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WBracketLeftW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WBracketLeft(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.BracketLeftW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.BracketLeft(pos, s);\r\n }\r\n }\r\n else if (s === \"(\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WParenLeftW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WParenLeft(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.ParenLeftW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.ParenLeft(pos, s);\r\n }\r\n }\r\n else if (s === \"]\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WBracketRightW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WBracketRight(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.BracketRightW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.BracketRight(pos, s);\r\n }\r\n }\r\n else if (s === \")\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WParenRightW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WParenRight(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.ParenRightW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.ParenRight(pos, s);\r\n }\r\n }\r\n else if (s === \"-\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WDashW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WDash(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.DashW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.Dash(pos, s);\r\n }\r\n }\r\n else if (s === \"+\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WPlusW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WPlus(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.PlusW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.Plus(pos, s);\r\n }\r\n }\r\n else if (s === \"@\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WAtW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WAt(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.AtW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.At(pos, s);\r\n }\r\n }\r\n }\r\n else if (s.length === 2) {\r\n if (s === \"->\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WInstanceArrowW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WInstanceArrow(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.InstanceArrowW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.InstanceArrow(pos, s);\r\n }\r\n }\r\n else if (s === \"=>\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WStaticArrowW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WStaticArrow(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.StaticArrowW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.StaticArrow(pos, s);\r\n }\r\n }\r\n }\r\n if (tok === undefined) {\r\n tok = new Tokens.Identifier(pos, s);\r\n }\r\n this.tokens.push(tok);\r\n }\r\n this.buffer.clear();\r\n }\r\n static process(raw) {\r\n this.stream = new Stream(raw.replace(/\\r/g, \"\"));\r\n this.buffer = new Buffer();\r\n for (;;) {\r\n const current = this.stream.currentChar();\r\n this.buffer.add(current);\r\n const buf = this.buffer.get();\r\n const ahead = this.stream.nextChar();\r\n const aahead = this.stream.nextNextChar();\r\n const prev = this.stream.prevChar();\r\n if (ahead === \"'\" && this.m === Mode.Normal) {\r\n // start string\r\n this.add();\r\n this.m = Mode.Str;\r\n }\r\n else if ((ahead === \"|\" || ahead === \"}\")\r\n && this.m === Mode.Normal) {\r\n // start template\r\n this.add();\r\n this.m = Mode.Template;\r\n }\r\n else if (ahead === \"`\" && this.m === Mode.Normal) {\r\n // start ping\r\n this.add();\r\n this.m = Mode.Ping;\r\n }\r\n else if (aahead === \"##\" && this.m === Mode.Normal) {\r\n // start pragma\r\n this.add();\r\n this.m = Mode.Pragma;\r\n }\r\n else if ((ahead === \"\\\"\" || (ahead === \"*\" && current === \"\\n\"))\r\n && this.m === Mode.Normal) {\r\n // start comment\r\n this.add();\r\n this.m = Mode.Comment;\r\n }\r\n else if (this.m === Mode.Pragma && (ahead === \",\" || ahead === \":\" || ahead === \".\" || ahead === \" \" || ahead === \"\\n\")) {\r\n // end of pragma\r\n this.add();\r\n this.m = Mode.Normal;\r\n }\r\n else if (this.m === Mode.Ping\r\n && buf.length > 1\r\n && current === \"`\"\r\n && aahead !== \"``\"\r\n && (buf.match(/`/g) || []).length % 2 === 0\r\n && ahead !== \"`\") {\r\n // end of ping\r\n this.add();\r\n this.m = Mode.Normal;\r\n }\r\n else if (this.m === Mode.Template\r\n && buf.length > 1\r\n && (current === \"|\" || current === \"{\")\r\n && (prev !== \"\\\\\" || this.stream.prevPrevChar() === \"\\\\\\\\\")) {\r\n // end of template\r\n this.add();\r\n this.m = Mode.Normal;\r\n }\r\n else if (this.m === Mode.Str\r\n && current === \"'\"\r\n && buf.length > 1\r\n && aahead !== \"''\"\r\n && (buf.match(/'/g) || []).length % 2 === 0\r\n && ahead !== \"'\") {\r\n // end of string\r\n this.add();\r\n if (ahead === \"\\\"\") {\r\n this.m = Mode.Comment;\r\n }\r\n else {\r\n this.m = Mode.Normal;\r\n }\r\n }\r\n else if (this.m === Mode.Normal\r\n && (ahead === \" \"\r\n || ahead === \":\"\r\n || ahead === \".\"\r\n || ahead === \",\"\r\n || ahead === \"-\"\r\n || ahead === \"+\"\r\n || ahead === \"(\"\r\n || ahead === \")\"\r\n || ahead === \"[\"\r\n || ahead === \"]\"\r\n || (ahead === \"@\" && buf.trim().length === 0)\r\n || aahead === \"->\"\r\n || aahead === \"=>\"\r\n || ahead === \"\\t\"\r\n || ahead === \"\\n\")) {\r\n this.add();\r\n }\r\n else if (ahead === \"\\n\" && this.m !== Mode.Template) {\r\n this.add();\r\n this.m = Mode.Normal;\r\n }\r\n else if (this.m === Mode.Template && current === \"\\n\") {\r\n this.add();\r\n }\r\n else if (current === \">\"\r\n && (prev === \"-\" || prev === \"=\")\r\n && ahead !== \" \"\r\n && this.m === Mode.Normal) {\r\n // arrows\r\n this.add();\r\n }\r\n else if (this.m === Mode.Normal\r\n && (buf === \".\"\r\n || buf === \",\"\r\n || buf === \":\"\r\n || buf === \"(\"\r\n || buf === \")\"\r\n || buf === \"[\"\r\n || buf === \"]\"\r\n || buf === \"+\"\r\n || buf === \"@\"\r\n || (buf === \"-\" && ahead !== \">\"))) {\r\n this.add();\r\n }\r\n if (!this.stream.advance()) {\r\n break;\r\n }\r\n }\r\n this.add();\r\n }\r\n}\r\nexports.Lexer = Lexer;\r\n//# sourceMappingURL=lexer.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/1_lexer/lexer.js?");
|
|
173
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Lexer = void 0;\r\nconst Tokens = __webpack_require__(/*! ./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\nvar Mode;\r\n(function (Mode) {\r\n Mode[Mode[\"Normal\"] = 0] = \"Normal\";\r\n Mode[Mode[\"Ping\"] = 1] = \"Ping\";\r\n Mode[Mode[\"Str\"] = 2] = \"Str\";\r\n Mode[Mode[\"Template\"] = 3] = \"Template\";\r\n Mode[Mode[\"Comment\"] = 4] = \"Comment\";\r\n Mode[Mode[\"Pragma\"] = 5] = \"Pragma\";\r\n})(Mode || (Mode = {}));\r\nclass Buffer {\r\n constructor() {\r\n this.buf = \"\";\r\n }\r\n add(s) {\r\n this.buf = this.buf + s;\r\n }\r\n get() {\r\n return this.buf;\r\n }\r\n clear() {\r\n this.buf = \"\";\r\n }\r\n}\r\nclass Stream {\r\n constructor(raw) {\r\n this.offset = -1;\r\n this.raw = raw;\r\n this.row = 0;\r\n this.col = 0;\r\n }\r\n advance() {\r\n if (this.currentChar() === \"\\n\") {\r\n this.col = 1;\r\n this.row = this.row + 1;\r\n }\r\n if (this.offset === this.raw.length) {\r\n return false;\r\n }\r\n this.col = this.col + 1;\r\n this.offset = this.offset + 1;\r\n return true;\r\n }\r\n getCol() {\r\n return this.col;\r\n }\r\n getRow() {\r\n return this.row;\r\n }\r\n prevChar() {\r\n return this.raw.substr(this.offset - 1, 1);\r\n }\r\n prevPrevChar() {\r\n return this.raw.substr(this.offset - 2, 2);\r\n }\r\n currentChar() {\r\n if (this.offset < 0) {\r\n return \"\\n\"; // simulate newline at start of file to handle star(*) comments\r\n }\r\n return this.raw.substr(this.offset, 1);\r\n }\r\n nextChar() {\r\n return this.raw.substr(this.offset + 1, 1);\r\n }\r\n nextNextChar() {\r\n return this.raw.substr(this.offset + 1, 2);\r\n }\r\n}\r\nclass Lexer {\r\n static run(file, virtual) {\r\n this.virtual = virtual;\r\n this.tokens = [];\r\n this.m = Mode.Normal;\r\n this.process(file.getRaw());\r\n return { file, tokens: this.tokens };\r\n }\r\n static add() {\r\n const s = this.buffer.get().trim();\r\n if (s.length > 0) {\r\n const col = this.stream.getCol();\r\n const row = this.stream.getRow();\r\n let whiteBefore = false;\r\n let prev = this.stream.prevChar();\r\n if (s.length === 2) {\r\n prev = this.stream.prevPrevChar().substr(0, 1);\r\n }\r\n if (prev === \" \" || prev === \"\\n\" || prev === \"\\t\" || prev === \":\") {\r\n whiteBefore = true;\r\n }\r\n let whiteAfter = false;\r\n const next = this.stream.nextChar();\r\n if (next === \" \" || next === \"\\n\" || next === \"\\t\" || next === \":\" || next === \",\" || next === \".\" || next === \"\" || next === \"\\\"\") {\r\n whiteAfter = true;\r\n }\r\n let pos = new position_1.Position(row, col - s.length);\r\n if (this.virtual) {\r\n pos = new position_1.VirtualPosition(this.virtual, pos.getRow(), pos.getCol());\r\n }\r\n let tok = undefined;\r\n if (this.m === Mode.Comment) {\r\n tok = new Tokens.Comment(pos, s);\r\n }\r\n else if (this.m === Mode.Ping || this.m === Mode.Str) {\r\n tok = new Tokens.String(pos, s);\r\n }\r\n else if (this.m === Mode.Template) {\r\n const first = s.charAt(0);\r\n const last = s.charAt(s.length - 1);\r\n if (first === \"|\" && last === \"|\") {\r\n tok = new Tokens.StringTemplate(pos, s);\r\n }\r\n else if (first === \"|\" && last === \"{\") {\r\n tok = new Tokens.StringTemplateBegin(pos, s);\r\n }\r\n else if (first === \"}\" && last === \"|\") {\r\n tok = new Tokens.StringTemplateEnd(pos, s);\r\n }\r\n else if (first === \"}\" && last === \"{\") {\r\n tok = new Tokens.StringTemplateMiddle(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.Identifier(pos, s);\r\n }\r\n }\r\n else if (s.substr(0, 2) === \"##\") {\r\n tok = new Tokens.Pragma(pos, s);\r\n }\r\n else if (s.length === 1) {\r\n if (s === \".\" || s === \",\") {\r\n tok = new Tokens.Punctuation(pos, s);\r\n }\r\n else if (s === \"[\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WBracketLeftW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WBracketLeft(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.BracketLeftW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.BracketLeft(pos, s);\r\n }\r\n }\r\n else if (s === \"(\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WParenLeftW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WParenLeft(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.ParenLeftW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.ParenLeft(pos, s);\r\n }\r\n }\r\n else if (s === \"]\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WBracketRightW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WBracketRight(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.BracketRightW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.BracketRight(pos, s);\r\n }\r\n }\r\n else if (s === \")\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WParenRightW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WParenRight(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.ParenRightW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.ParenRight(pos, s);\r\n }\r\n }\r\n else if (s === \"-\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WDashW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WDash(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.DashW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.Dash(pos, s);\r\n }\r\n }\r\n else if (s === \"+\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WPlusW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WPlus(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.PlusW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.Plus(pos, s);\r\n }\r\n }\r\n else if (s === \"@\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WAtW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WAt(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.AtW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.At(pos, s);\r\n }\r\n }\r\n }\r\n else if (s.length === 2) {\r\n if (s === \"->\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WInstanceArrowW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WInstanceArrow(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.InstanceArrowW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.InstanceArrow(pos, s);\r\n }\r\n }\r\n else if (s === \"=>\") {\r\n if (whiteBefore && whiteAfter) {\r\n tok = new Tokens.WStaticArrowW(pos, s);\r\n }\r\n else if (whiteBefore) {\r\n tok = new Tokens.WStaticArrow(pos, s);\r\n }\r\n else if (whiteAfter) {\r\n tok = new Tokens.StaticArrowW(pos, s);\r\n }\r\n else {\r\n tok = new Tokens.StaticArrow(pos, s);\r\n }\r\n }\r\n }\r\n if (tok === undefined) {\r\n tok = new Tokens.Identifier(pos, s);\r\n }\r\n this.tokens.push(tok);\r\n }\r\n this.buffer.clear();\r\n }\r\n static process(raw) {\r\n this.stream = new Stream(raw.replace(/\\r/g, \"\"));\r\n this.buffer = new Buffer();\r\n for (;;) {\r\n const current = this.stream.currentChar();\r\n this.buffer.add(current);\r\n const buf = this.buffer.get();\r\n const ahead = this.stream.nextChar();\r\n const aahead = this.stream.nextNextChar();\r\n const prev = this.stream.prevChar();\r\n if (ahead === \"'\" && this.m === Mode.Normal) {\r\n // start string\r\n this.add();\r\n this.m = Mode.Str;\r\n }\r\n else if ((ahead === \"|\" || ahead === \"}\")\r\n && this.m === Mode.Normal) {\r\n // start template\r\n this.add();\r\n this.m = Mode.Template;\r\n }\r\n else if (ahead === \"`\" && this.m === Mode.Normal) {\r\n // start ping\r\n this.add();\r\n this.m = Mode.Ping;\r\n }\r\n else if (aahead === \"##\" && this.m === Mode.Normal) {\r\n // start pragma\r\n this.add();\r\n this.m = Mode.Pragma;\r\n }\r\n else if ((ahead === \"\\\"\" || (ahead === \"*\" && current === \"\\n\"))\r\n && this.m === Mode.Normal) {\r\n // start comment\r\n this.add();\r\n this.m = Mode.Comment;\r\n }\r\n else if (this.m === Mode.Pragma && (ahead === \",\" || ahead === \":\" || ahead === \".\" || ahead === \" \" || ahead === \"\\n\")) {\r\n // end of pragma\r\n this.add();\r\n this.m = Mode.Normal;\r\n }\r\n else if (this.m === Mode.Ping\r\n && buf.length > 1\r\n && current === \"`\"\r\n && aahead !== \"``\"\r\n && (buf.match(/`/g) || []).length % 2 === 0\r\n && ahead !== \"`\") {\r\n // end of ping\r\n this.add();\r\n this.m = Mode.Normal;\r\n }\r\n else if (this.m === Mode.Template\r\n && buf.length > 1\r\n && (current === \"|\" || current === \"{\")\r\n && (prev !== \"\\\\\" || this.stream.prevPrevChar() === \"\\\\\\\\\")) {\r\n // end of template\r\n this.add();\r\n this.m = Mode.Normal;\r\n }\r\n else if (this.m === Mode.Str\r\n && current === \"'\"\r\n && buf.length > 1\r\n && aahead !== \"''\"\r\n && (buf.match(/'/g) || []).length % 2 === 0\r\n && ahead !== \"'\") {\r\n // end of string\r\n this.add();\r\n if (ahead === \"\\\"\") {\r\n this.m = Mode.Comment;\r\n }\r\n else {\r\n this.m = Mode.Normal;\r\n }\r\n }\r\n else if (this.m === Mode.Normal\r\n && (ahead === \" \"\r\n || ahead === \":\"\r\n || ahead === \".\"\r\n || ahead === \",\"\r\n || ahead === \"-\"\r\n || ahead === \"+\"\r\n || ahead === \"(\"\r\n || ahead === \")\"\r\n || ahead === \"[\"\r\n || ahead === \"]\"\r\n || (ahead === \"@\" && buf.trim().length === 0)\r\n || aahead === \"->\"\r\n || aahead === \"=>\"\r\n || ahead === \"\\t\"\r\n || ahead === \"\\n\")) {\r\n this.add();\r\n }\r\n else if (ahead === \"\\n\" && this.m !== Mode.Template) {\r\n this.add();\r\n this.m = Mode.Normal;\r\n }\r\n else if (this.m === Mode.Template && current === \"\\n\") {\r\n this.add();\r\n }\r\n else if (current === \">\"\r\n && (prev === \"-\" || prev === \"=\")\r\n && ahead !== \" \"\r\n && this.m === Mode.Normal) {\r\n // arrows\r\n this.add();\r\n }\r\n else if (this.m === Mode.Normal\r\n && (buf === \".\"\r\n || buf === \",\"\r\n || buf === \":\"\r\n || buf === \"(\"\r\n || buf === \")\"\r\n || buf === \"[\"\r\n || buf === \"]\"\r\n || buf === \"+\"\r\n || buf === \"@\"\r\n || (buf === \"-\" && ahead !== \">\"))) {\r\n this.add();\r\n }\r\n if (!this.stream.advance()) {\r\n break;\r\n }\r\n }\r\n this.add();\r\n }\r\n}\r\nexports.Lexer = Lexer;\r\n//# sourceMappingURL=lexer.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/1_lexer/lexer.js?");
|
|
163
174
|
|
|
164
175
|
/***/ }),
|
|
165
176
|
|
|
@@ -6946,7 +6957,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
6946
6957
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
6947
6958
|
|
|
6948
6959
|
"use strict";
|
|
6949
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Select = void 0;\r\nconst Expressions = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst basic_1 = __webpack_require__(/*! ../../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst inline_data_1 = __webpack_require__(/*! ./inline_data */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/inline_data.js\");\r\nconst target_1 = __webpack_require__(/*! ./target */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js\");\r\nconst sql_from_1 = __webpack_require__(/*! ./sql_from */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/sql_from.js\");\r\nconst source_1 = __webpack_require__(/*! ./source */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js\");\r\nconst sql_for_all_entries_1 = __webpack_require__(/*! ./sql_for_all_entries */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/sql_for_all_entries.js\");\r\nconst _scope_type_1 = __webpack_require__(/*! ../_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\r\nclass Select {\r\n runSyntax(node, scope, filename) {\r\n var _a, _b;\r\n const token = node.getFirstToken();\r\n const from = node.findDirectExpression(Expressions.SQLFrom);\r\n if (from) {\r\n new sql_from_1.SQLFrom().runSyntax(from, scope, filename);\r\n }\r\n for (const inline of node.findAllExpressions(Expressions.InlineData)) {\r\n // todo, for now these are voided\r\n new inline_data_1.InlineData().runSyntax(inline, scope, filename, new basic_1.VoidType(\"SELECT_todo\"));\r\n }\r\n const fae = node.findDirectExpression(Expressions.SQLForAllEntries);\r\n if (fae) {\r\n scope.push(_scope_type_1.ScopeType.OpenSQL, \"SELECT\", token.getStart(), filename);\r\n new sql_for_all_entries_1.SQLForAllEntries().runSyntax(fae, scope, filename);\r\n }\r\n for (const t of node.findAllExpressions(Expressions.Target)) {\r\n new target_1.Target().runSyntax(t, scope, filename);\r\n }\r\n // check implicit into, the target field is implict equal to the table name\r\n if (node.findDirectExpression(Expressions.SQLIntoTable) === undefined\r\n && node.findDirectExpression(Expressions.SQLIntoStructure) === undefined) {\r\n const fields = (_a = node.findFirstExpression(Expressions.SQLAggregation)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n const c = new RegExp(/^count\\(\\s*\\*\\s*\\)$/, \"i\");\r\n if (fields === undefined || c.test(fields) === false) {\r\n const name = (_b = from === null || from === void 0 ? void 0 : from.findDirectExpression(Expressions.SQLFromSource)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n if (name && scope.findVariable(name) === undefined) {\r\n throw new Error(`Target variable ${name} not found in scope`);\r\n }\r\n }\r\n }\r\n for (const s of node.findAllExpressions(Expressions.Source)) {\r\n new source_1.Source().runSyntax(s, scope, filename);\r\n }\r\n if (scope.getType() === _scope_type_1.ScopeType.OpenSQL) {\r\n scope.pop(node.getLastToken().getEnd());\r\n }\r\n }\r\n}\r\nexports.Select = Select;\r\n//# sourceMappingURL=select.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/select.js?");
|
|
6960
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Select = void 0;\r\nconst Expressions = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst basic_1 = __webpack_require__(/*! ../../types/basic */ \"./node_modules/@abaplint/core/build/src/abap/types/basic/index.js\");\r\nconst inline_data_1 = __webpack_require__(/*! ./inline_data */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/inline_data.js\");\r\nconst target_1 = __webpack_require__(/*! ./target */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/target.js\");\r\nconst sql_from_1 = __webpack_require__(/*! ./sql_from */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/sql_from.js\");\r\nconst source_1 = __webpack_require__(/*! ./source */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/source.js\");\r\nconst sql_for_all_entries_1 = __webpack_require__(/*! ./sql_for_all_entries */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/sql_for_all_entries.js\");\r\nconst _scope_type_1 = __webpack_require__(/*! ../_scope_type */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/_scope_type.js\");\r\nclass Select {\r\n runSyntax(node, scope, filename, skipImplicitInto = false) {\r\n var _a, _b;\r\n const token = node.getFirstToken();\r\n const from = node.findDirectExpression(Expressions.SQLFrom);\r\n if (from) {\r\n new sql_from_1.SQLFrom().runSyntax(from, scope, filename);\r\n }\r\n for (const inline of node.findAllExpressions(Expressions.InlineData)) {\r\n // todo, for now these are voided\r\n new inline_data_1.InlineData().runSyntax(inline, scope, filename, new basic_1.VoidType(\"SELECT_todo\"));\r\n }\r\n const fae = node.findDirectExpression(Expressions.SQLForAllEntries);\r\n if (fae) {\r\n scope.push(_scope_type_1.ScopeType.OpenSQL, \"SELECT\", token.getStart(), filename);\r\n new sql_for_all_entries_1.SQLForAllEntries().runSyntax(fae, scope, filename);\r\n }\r\n for (const t of node.findAllExpressions(Expressions.Target)) {\r\n new target_1.Target().runSyntax(t, scope, filename);\r\n }\r\n // check implicit into, the target field is implict equal to the table name\r\n if (skipImplicitInto === false\r\n && node.findDirectExpression(Expressions.SQLIntoTable) === undefined\r\n && node.findDirectExpression(Expressions.SQLIntoStructure) === undefined) {\r\n const fields = (_a = node.findFirstExpression(Expressions.SQLAggregation)) === null || _a === void 0 ? void 0 : _a.concatTokens();\r\n const c = new RegExp(/^count\\(\\s*\\*\\s*\\)$/, \"i\");\r\n if (fields === undefined || c.test(fields) === false) {\r\n const name = (_b = from === null || from === void 0 ? void 0 : from.findDirectExpression(Expressions.SQLFromSource)) === null || _b === void 0 ? void 0 : _b.concatTokens();\r\n if (name && scope.findVariable(name) === undefined) {\r\n throw new Error(`Target variable ${name} not found in scope`);\r\n }\r\n }\r\n }\r\n for (const s of node.findAllExpressions(Expressions.Source)) {\r\n new source_1.Source().runSyntax(s, scope, filename);\r\n }\r\n if (scope.getType() === _scope_type_1.ScopeType.OpenSQL) {\r\n scope.pop(node.getLastToken().getEnd());\r\n }\r\n }\r\n}\r\nexports.Select = Select;\r\n//# sourceMappingURL=select.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/select.js?");
|
|
6950
6961
|
|
|
6951
6962
|
/***/ }),
|
|
6952
6963
|
|
|
@@ -7969,7 +7980,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
7969
7980
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
7970
7981
|
|
|
7971
7982
|
"use strict";
|
|
7972
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Select = void 0;\r\nconst Expressions = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst select_1 = __webpack_require__(/*! ../expressions/select */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/select.js\");\r\nclass Select {\r\n runSyntax(node, scope, filename) {\r\n const
|
|
7983
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Select = void 0;\r\nconst Expressions = __webpack_require__(/*! ../../2_statements/expressions */ \"./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js\");\r\nconst select_1 = __webpack_require__(/*! ../expressions/select */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/expressions/select.js\");\r\nclass Select {\r\n runSyntax(node, scope, filename) {\r\n const selects = node.findDirectExpressions(Expressions.Select);\r\n for (let i = 0; i < selects.length; i++) {\r\n const last = i === selects.length - 1;\r\n const s = selects[i];\r\n new select_1.Select().runSyntax(s, scope, filename, last === false);\r\n }\r\n }\r\n}\r\nexports.Select = Select;\r\n//# sourceMappingURL=select.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/abap/5_syntax/statements/select.js?");
|
|
7973
7984
|
|
|
7974
7985
|
/***/ }),
|
|
7975
7986
|
|
|
@@ -10708,7 +10719,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
10708
10719
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
10709
10720
|
|
|
10710
10721
|
"use strict";
|
|
10711
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Registry = void 0;\nconst config_1 = __webpack_require__(/*! ./config */ \"./node_modules/@abaplint/core/build/src/config.js\");\nconst artifacts_objects_1 = __webpack_require__(/*! ./artifacts_objects */ \"./node_modules/@abaplint/core/build/src/artifacts_objects.js\");\nconst artifacts_rules_1 = __webpack_require__(/*! ./artifacts_rules */ \"./node_modules/@abaplint/core/build/src/artifacts_rules.js\");\nconst skip_logic_1 = __webpack_require__(/*! ./skip_logic */ \"./node_modules/@abaplint/core/build/src/skip_logic.js\");\nconst _abap_object_1 = __webpack_require__(/*! ./objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\nconst find_global_definitions_1 = __webpack_require__(/*! ./abap/5_syntax/global_definitions/find_global_definitions */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/global_definitions/find_global_definitions.js\");\nconst syntax_1 = __webpack_require__(/*! ./abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\nconst excludeHelper_1 = __webpack_require__(/*! ./utils/excludeHelper */ \"./node_modules/@abaplint/core/build/src/utils/excludeHelper.js\");\nconst ddic_references_1 = __webpack_require__(/*! ./ddic_references */ \"./node_modules/@abaplint/core/build/src/ddic_references.js\");\n// todo, this should really be an instance in case there are multiple Registry'ies\nclass ParsingPerformance {\n static clear() {\n this.results = [];\n this.lexing = 0;\n this.statements = 0;\n this.structure = 0;\n }\n static push(obj, result) {\n if (result.runtimeExtra) {\n this.lexing += result.runtimeExtra.lexing;\n this.statements += result.runtimeExtra.statements;\n this.structure += result.runtimeExtra.structure;\n }\n if (result.runtime < 100) {\n return;\n }\n if (this.results === undefined) {\n this.results = [];\n }\n let extra = \"\";\n if (result.runtimeExtra) {\n extra = `\\t(lexing: ${result.runtimeExtra.lexing}ms, statements: ${result.runtimeExtra.statements}ms, structure: ${result.runtimeExtra.structure}ms)`;\n }\n this.results.push({\n runtime: result.runtime,\n extra,\n name: obj.getType() + \" \" + obj.getName(),\n });\n }\n static output() {\n const MAX = 10;\n this.results.sort((a, b) => { return b.runtime - a.runtime; });\n for (let i = 0; i < MAX; i++) {\n const row = this.results[i];\n if (row === undefined) {\n break;\n }\n process.stderr.write(`\\t${row.runtime}ms\\t${row.name} ${row.extra}\\n`);\n }\n process.stderr.write(`\\tTotal lexing: ${this.lexing}ms\\n`);\n process.stderr.write(`\\tTotal statements: ${this.statements}ms\\n`);\n process.stderr.write(`\\tTotal structure: ${this.structure}ms\\n`);\n }\n}\n///////////////////////////////////////////////////////////////////////////////////////////////\nclass Registry {\n constructor(conf) {\n this.objects = {};\n this.objectsByType = {};\n /** object containing filenames of dependencies */\n this.dependencies = {};\n this.issues = [];\n this.conf = conf ? conf : config_1.Config.getDefault();\n this.references = new ddic_references_1.DDICReferences();\n }\n static abaplintVersion() {\n // magic, see build script \"version.sh\"\n return \"2.82.0\";\n }\n getDDICReferences() {\n return this.references;\n }\n *getObjects() {\n for (const name in this.objects) {\n for (const type in this.objects[name]) {\n yield this.objects[name][type];\n }\n }\n }\n *getObjectsByType(type) {\n for (const name in this.objectsByType[type] || []) {\n yield this.objectsByType[type][name];\n }\n }\n *getFiles() {\n for (const obj of this.getObjects()) {\n for (const file of obj.getFiles()) {\n yield file;\n }\n }\n }\n getFirstObject() {\n for (const name in this.objects) {\n for (const type in this.objects[name]) {\n return this.objects[name][type];\n }\n }\n return undefined;\n }\n getObjectCount(skipDependencies = true) {\n let res = 0;\n for (const o of this.getObjects()) {\n if (skipDependencies === true && this.isDependency(o)) {\n continue;\n }\n res = res + 1;\n }\n return res;\n }\n getFileByName(filename) {\n const upper = filename.toUpperCase();\n for (const o of this.getObjects()) {\n for (const f of o.getFiles()) {\n if (f.getFilename().toUpperCase() === upper) {\n return f;\n }\n }\n }\n return undefined;\n }\n getObject(type, name) {\n if (type === undefined || name === undefined) {\n return undefined;\n }\n const searchName = name.toUpperCase();\n if (this.objects[searchName]) {\n return this.objects[searchName][type];\n }\n return undefined;\n }\n getConfig() {\n return this.conf;\n }\n // assumption: Config is immutable, and can only be changed via this method\n setConfig(conf) {\n for (const obj of this.getObjects()) {\n obj.setDirty();\n }\n this.conf = conf;\n return this;\n }\n inErrorNamespace(name) {\n const reg = new RegExp(this.getConfig().getSyntaxSetttings().errorNamespace, \"i\");\n return reg.test(name);\n }\n addFile(file) {\n return this.addFiles([file]);\n }\n updateFile(file) {\n const obj = this.find(file.getObjectName(), file.getObjectType());\n obj.updateFile(file);\n return this;\n }\n removeFile(file) {\n const obj = this.find(file.getObjectName(), file.getObjectType());\n obj.removeFile(file);\n if (obj.getFiles().length === 0) {\n this.references.clear(obj);\n this.removeObject(obj);\n }\n return this;\n }\n addFiles(files) {\n var _a;\n const globalExclude = ((_a = this.conf.getGlobal().exclude) !== null && _a !== void 0 ? _a : [])\n .map(pattern => new RegExp(pattern, \"i\"));\n for (const f of files) {\n const filename = f.getFilename();\n const isNotAbapgitFile = filename.split(\".\").length <= 2;\n if (isNotAbapgitFile || excludeHelper_1.ExcludeHelper.isExcluded(filename, globalExclude)) {\n continue;\n }\n const found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n found.addFile(f);\n }\n return this;\n }\n addDependencies(files) {\n for (const f of files) {\n this.dependencies[f.getFilename().toUpperCase()] = true;\n }\n return this.addFiles(files);\n }\n addDependency(file) {\n this.dependencies[file.getFilename().toUpperCase()] = true;\n this.addFile(file);\n return this;\n }\n isDependency(obj) {\n const filename = obj.getFiles()[0].getFilename().toUpperCase();\n return this.dependencies[filename] === true;\n }\n isFileDependency(filename) {\n return this.dependencies[filename.toUpperCase()] === true;\n }\n // assumption: the file is already in the registry\n findObjectForFile(file) {\n const filename = file.getFilename();\n for (const obj of this.getObjects()) {\n for (const ofile of obj.getFiles()) {\n if (ofile.getFilename() === filename) {\n return obj;\n }\n }\n }\n return undefined;\n }\n // todo, this will be changed to async sometime\n findIssues(input) {\n if (this.isDirty() === true) {\n this.parse();\n }\n return this.runRules(input);\n }\n // todo, this will be changed to async sometime\n findIssuesObject(iobj) {\n if (this.isDirty() === true) {\n this.parse();\n }\n return this.runRules(undefined, iobj);\n }\n // todo, this will be changed to async sometime\n parse() {\n if (this.isDirty() === false) {\n return this;\n }\n ParsingPerformance.clear();\n this.issues = [];\n for (const o of this.getObjects()) {\n this.parsePrivate(o);\n this.issues.push(...o.getParsingIssues());\n }\n new find_global_definitions_1.FindGlobalDefinitions(this).run();\n return this;\n }\n async parseAsync(input) {\n var _a, _b;\n if (this.isDirty() === false) {\n return this;\n }\n ParsingPerformance.clear();\n (_a = input === null || input === void 0 ? void 0 : input.progress) === null || _a === void 0 ? void 0 : _a.set(this.getObjectCount(false), \"Lexing and parsing\");\n this.issues = [];\n for (const o of this.getObjects()) {\n await ((_b = input === null || input === void 0 ? void 0 : input.progress) === null || _b === void 0 ? void 0 : _b.tick(\"Lexing and parsing(\" + this.conf.getVersion() + \") - \" + o.getType() + \" \" + o.getName()));\n this.parsePrivate(o);\n this.issues.push(...o.getParsingIssues());\n }\n if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {\n ParsingPerformance.output();\n }\n new find_global_definitions_1.FindGlobalDefinitions(this).run(input === null || input === void 0 ? void 0 : input.progress);\n return this;\n }\n //////////////////////////////////////////\n // todo, refactor, this is a mess, see where-used, a lot of the code should be in this method instead\n parsePrivate(input) {\n const config = this.getConfig();\n const result = input.parse(config.getVersion(), config.getSyntaxSetttings().globalMacros);\n ParsingPerformance.push(input, result);\n }\n isDirty() {\n for (const o of this.getObjects()) {\n const dirty = o.isDirty();\n if (dirty === true) {\n return true;\n }\n }\n return false;\n }\n runRules(input, iobj) {\n var _a, _b, _c, _d, _e, _f;\n const rulePerformance = {};\n const issues = this.issues.slice(0);\n const objects = iobj ? [iobj] : this.getObjects();\n const rules = this.conf.getEnabledRules();\n const skipLogic = new skip_logic_1.SkipLogic(this);\n (_a = input === null || input === void 0 ? void 0 : input.progress) === null || _a === void 0 ? void 0 : _a.set(iobj ? 1 : this.getObjectCount(false), \"Run Syntax\");\n const check = [];\n for (const obj of objects) {\n (_b = input === null || input === void 0 ? void 0 : input.progress) === null || _b === void 0 ? void 0 : _b.tick(\"Run Syntax - \" + obj.getName());\n if (skipLogic.skip(obj) || this.isDependency(obj)) {\n continue;\n }\n if (obj instanceof _abap_object_1.ABAPObject) {\n new syntax_1.SyntaxLogic(this, obj).run();\n }\n check.push(obj);\n }\n (_c = input === null || input === void 0 ? void 0 : input.progress) === null || _c === void 0 ? void 0 : _c.set(rules.length, \"Initialize Rules\");\n for (const rule of rules) {\n (_d = input === null || input === void 0 ? void 0 : input.progress) === null || _d === void 0 ? void 0 : _d.tick(\"Initialize Rules - \" + rule.getMetadata().key);\n if (rule.initialize === undefined) {\n throw new Error(rule.getMetadata().key + \" missing initialize method\");\n }\n rule.initialize(this);\n rulePerformance[rule.getMetadata().key] = 0;\n }\n (_e = input === null || input === void 0 ? void 0 : input.progress) === null || _e === void 0 ? void 0 : _e.set(check.length, \"Finding Issues\");\n for (const obj of check) {\n (_f = input === null || input === void 0 ? void 0 : input.progress) === null || _f === void 0 ? void 0 : _f.tick(\"Finding Issues - \" + obj.getType() + \" \" + obj.getName());\n for (const rule of rules) {\n const before = Date.now();\n issues.push(...rule.run(obj));\n const runtime = Date.now() - before;\n rulePerformance[rule.getMetadata().key] = rulePerformance[rule.getMetadata().key] + runtime;\n }\n }\n if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {\n const perf = [];\n for (const p in rulePerformance) {\n if (rulePerformance[p] > 100) { // ignore rules if it takes less than 100ms\n perf.push({ name: p, time: rulePerformance[p] });\n }\n }\n perf.sort((a, b) => { return b.time - a.time; });\n for (const p of perf) {\n process.stderr.write(\"\\t\" + p.time + \"ms\\t\" + p.name + \"\\n\");\n }\n }\n return this.excludeIssues(issues);\n }\n excludeIssues(issues) {\n var _a;\n const ret = issues;\n // exclude issues, as now we know both the filename and issue key\n for (const rule of artifacts_rules_1.ArtifactsRules.getRules()) {\n const key = rule.getMetadata().key;\n const ruleExclude = ((_a = this.conf.readByKey(key, \"exclude\")) !== null && _a !== void 0 ? _a : []);\n const ruleExcludePatterns = ruleExclude.map(x => new RegExp(x, \"i\"));\n for (let i = ret.length - 1; i >= 0; i--) {\n if (ret[i].getKey() !== key) {\n continue;\n }\n const filename = ret[i].getFilename();\n if (excludeHelper_1.ExcludeHelper.isExcluded(filename, ruleExcludePatterns)) {\n ret.splice(i, 1);\n }\n }\n }\n return ret;\n }\n findOrCreate(name, type) {\n try {\n return this.find(name, type);\n }\n catch (_a) {\n const newName = name.toUpperCase();\n const newType = type ? type : \"UNKNOWN\";\n const add = artifacts_objects_1.ArtifactsObjects.newObject(newName, newType);\n if (this.objects[newName] === undefined) {\n this.objects[newName] = {};\n }\n this.objects[newName][newType] = add;\n if (this.objectsByType[newType] === undefined) {\n this.objectsByType[newType] = {};\n }\n this.objectsByType[newType][newName] = add;\n return add;\n }\n }\n removeObject(remove) {\n if (remove === undefined) {\n return;\n }\n if (this.objects[remove.getName()][remove.getType()] === undefined) {\n throw new Error(\"removeObject: object not found\");\n }\n if (Object.keys(this.objects[remove.getName()]).length === 1) {\n delete this.objects[remove.getName()];\n }\n else {\n delete this.objects[remove.getName()][remove.getType()];\n }\n if (Object.keys(this.objectsByType[remove.getType()]).length === 1) {\n delete this.objectsByType[remove.getType()];\n }\n else {\n delete this.objectsByType[remove.getType()][remove.getName()];\n }\n }\n find(name, type) {\n const searchType = type ? type : \"UNKNOWN\";\n const searchName = name.toUpperCase();\n if (this.objects[searchName] !== undefined\n && this.objects[searchName][searchType]) {\n return this.objects[searchName][searchType];\n }\n throw new Error(\"find: object not found, \" + type + \" \" + name);\n }\n}\nexports.Registry = Registry;\n//# sourceMappingURL=registry.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/registry.js?");
|
|
10722
|
+
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Registry = void 0;\nconst config_1 = __webpack_require__(/*! ./config */ \"./node_modules/@abaplint/core/build/src/config.js\");\nconst artifacts_objects_1 = __webpack_require__(/*! ./artifacts_objects */ \"./node_modules/@abaplint/core/build/src/artifacts_objects.js\");\nconst artifacts_rules_1 = __webpack_require__(/*! ./artifacts_rules */ \"./node_modules/@abaplint/core/build/src/artifacts_rules.js\");\nconst skip_logic_1 = __webpack_require__(/*! ./skip_logic */ \"./node_modules/@abaplint/core/build/src/skip_logic.js\");\nconst _abap_object_1 = __webpack_require__(/*! ./objects/_abap_object */ \"./node_modules/@abaplint/core/build/src/objects/_abap_object.js\");\nconst find_global_definitions_1 = __webpack_require__(/*! ./abap/5_syntax/global_definitions/find_global_definitions */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/global_definitions/find_global_definitions.js\");\nconst syntax_1 = __webpack_require__(/*! ./abap/5_syntax/syntax */ \"./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js\");\nconst excludeHelper_1 = __webpack_require__(/*! ./utils/excludeHelper */ \"./node_modules/@abaplint/core/build/src/utils/excludeHelper.js\");\nconst ddic_references_1 = __webpack_require__(/*! ./ddic_references */ \"./node_modules/@abaplint/core/build/src/ddic_references.js\");\n// todo, this should really be an instance in case there are multiple Registry'ies\nclass ParsingPerformance {\n static clear() {\n this.results = [];\n this.lexing = 0;\n this.statements = 0;\n this.structure = 0;\n }\n static push(obj, result) {\n if (result.runtimeExtra) {\n this.lexing += result.runtimeExtra.lexing;\n this.statements += result.runtimeExtra.statements;\n this.structure += result.runtimeExtra.structure;\n }\n if (result.runtime < 100) {\n return;\n }\n if (this.results === undefined) {\n this.results = [];\n }\n let extra = \"\";\n if (result.runtimeExtra) {\n extra = `\\t(lexing: ${result.runtimeExtra.lexing}ms, statements: ${result.runtimeExtra.statements}ms, structure: ${result.runtimeExtra.structure}ms)`;\n }\n this.results.push({\n runtime: result.runtime,\n extra,\n name: obj.getType() + \" \" + obj.getName(),\n });\n }\n static output() {\n const MAX = 10;\n this.results.sort((a, b) => { return b.runtime - a.runtime; });\n for (let i = 0; i < MAX; i++) {\n const row = this.results[i];\n if (row === undefined) {\n break;\n }\n process.stderr.write(`\\t${row.runtime}ms\\t${row.name} ${row.extra}\\n`);\n }\n process.stderr.write(`\\tTotal lexing: ${this.lexing}ms\\n`);\n process.stderr.write(`\\tTotal statements: ${this.statements}ms\\n`);\n process.stderr.write(`\\tTotal structure: ${this.structure}ms\\n`);\n }\n}\n///////////////////////////////////////////////////////////////////////////////////////////////\nclass Registry {\n constructor(conf) {\n this.objects = {};\n this.objectsByType = {};\n /** object containing filenames of dependencies */\n this.dependencies = {};\n this.issues = [];\n this.conf = conf ? conf : config_1.Config.getDefault();\n this.references = new ddic_references_1.DDICReferences();\n }\n static abaplintVersion() {\n // magic, see build script \"version.sh\"\n return \"2.82.4\";\n }\n getDDICReferences() {\n return this.references;\n }\n *getObjects() {\n for (const name in this.objects) {\n for (const type in this.objects[name]) {\n yield this.objects[name][type];\n }\n }\n }\n *getObjectsByType(type) {\n for (const name in this.objectsByType[type] || []) {\n yield this.objectsByType[type][name];\n }\n }\n *getFiles() {\n for (const obj of this.getObjects()) {\n for (const file of obj.getFiles()) {\n yield file;\n }\n }\n }\n getFirstObject() {\n for (const name in this.objects) {\n for (const type in this.objects[name]) {\n return this.objects[name][type];\n }\n }\n return undefined;\n }\n getObjectCount(skipDependencies = true) {\n let res = 0;\n for (const o of this.getObjects()) {\n if (skipDependencies === true && this.isDependency(o)) {\n continue;\n }\n res = res + 1;\n }\n return res;\n }\n getFileByName(filename) {\n const upper = filename.toUpperCase();\n for (const o of this.getObjects()) {\n for (const f of o.getFiles()) {\n if (f.getFilename().toUpperCase() === upper) {\n return f;\n }\n }\n }\n return undefined;\n }\n getObject(type, name) {\n if (type === undefined || name === undefined) {\n return undefined;\n }\n const searchName = name.toUpperCase();\n if (this.objects[searchName]) {\n return this.objects[searchName][type];\n }\n return undefined;\n }\n getConfig() {\n return this.conf;\n }\n // assumption: Config is immutable, and can only be changed via this method\n setConfig(conf) {\n for (const obj of this.getObjects()) {\n obj.setDirty();\n }\n this.conf = conf;\n return this;\n }\n inErrorNamespace(name) {\n const reg = new RegExp(this.getConfig().getSyntaxSetttings().errorNamespace, \"i\");\n return reg.test(name);\n }\n addFile(file) {\n return this.addFiles([file]);\n }\n updateFile(file) {\n const obj = this.find(file.getObjectName(), file.getObjectType());\n obj.updateFile(file);\n return this;\n }\n removeFile(file) {\n const obj = this.find(file.getObjectName(), file.getObjectType());\n obj.removeFile(file);\n if (obj.getFiles().length === 0) {\n this.references.clear(obj);\n this.removeObject(obj);\n }\n return this;\n }\n addFiles(files) {\n var _a;\n const globalExclude = ((_a = this.conf.getGlobal().exclude) !== null && _a !== void 0 ? _a : [])\n .map(pattern => new RegExp(pattern, \"i\"));\n for (const f of files) {\n const filename = f.getFilename();\n const isNotAbapgitFile = filename.split(\".\").length <= 2;\n if (isNotAbapgitFile || excludeHelper_1.ExcludeHelper.isExcluded(filename, globalExclude)) {\n continue;\n }\n const found = this.findOrCreate(f.getObjectName(), f.getObjectType());\n found.addFile(f);\n }\n return this;\n }\n addDependencies(files) {\n for (const f of files) {\n this.dependencies[f.getFilename().toUpperCase()] = true;\n }\n return this.addFiles(files);\n }\n addDependency(file) {\n this.dependencies[file.getFilename().toUpperCase()] = true;\n this.addFile(file);\n return this;\n }\n isDependency(obj) {\n const filename = obj.getFiles()[0].getFilename().toUpperCase();\n return this.dependencies[filename] === true;\n }\n isFileDependency(filename) {\n return this.dependencies[filename.toUpperCase()] === true;\n }\n // assumption: the file is already in the registry\n findObjectForFile(file) {\n const filename = file.getFilename();\n for (const obj of this.getObjects()) {\n for (const ofile of obj.getFiles()) {\n if (ofile.getFilename() === filename) {\n return obj;\n }\n }\n }\n return undefined;\n }\n // todo, this will be changed to async sometime\n findIssues(input) {\n if (this.isDirty() === true) {\n this.parse();\n }\n return this.runRules(input);\n }\n // todo, this will be changed to async sometime\n findIssuesObject(iobj) {\n if (this.isDirty() === true) {\n this.parse();\n }\n return this.runRules(undefined, iobj);\n }\n // todo, this will be changed to async sometime\n parse() {\n if (this.isDirty() === false) {\n return this;\n }\n ParsingPerformance.clear();\n this.issues = [];\n for (const o of this.getObjects()) {\n this.parsePrivate(o);\n this.issues.push(...o.getParsingIssues());\n }\n new find_global_definitions_1.FindGlobalDefinitions(this).run();\n return this;\n }\n async parseAsync(input) {\n var _a, _b;\n if (this.isDirty() === false) {\n return this;\n }\n ParsingPerformance.clear();\n (_a = input === null || input === void 0 ? void 0 : input.progress) === null || _a === void 0 ? void 0 : _a.set(this.getObjectCount(false), \"Lexing and parsing\");\n this.issues = [];\n for (const o of this.getObjects()) {\n await ((_b = input === null || input === void 0 ? void 0 : input.progress) === null || _b === void 0 ? void 0 : _b.tick(\"Lexing and parsing(\" + this.conf.getVersion() + \") - \" + o.getType() + \" \" + o.getName()));\n this.parsePrivate(o);\n this.issues.push(...o.getParsingIssues());\n }\n if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {\n ParsingPerformance.output();\n }\n new find_global_definitions_1.FindGlobalDefinitions(this).run(input === null || input === void 0 ? void 0 : input.progress);\n return this;\n }\n //////////////////////////////////////////\n // todo, refactor, this is a mess, see where-used, a lot of the code should be in this method instead\n parsePrivate(input) {\n const config = this.getConfig();\n const result = input.parse(config.getVersion(), config.getSyntaxSetttings().globalMacros);\n ParsingPerformance.push(input, result);\n }\n isDirty() {\n for (const o of this.getObjects()) {\n const dirty = o.isDirty();\n if (dirty === true) {\n return true;\n }\n }\n return false;\n }\n runRules(input, iobj) {\n var _a, _b, _c, _d, _e, _f;\n const rulePerformance = {};\n const issues = this.issues.slice(0);\n const objects = iobj ? [iobj] : this.getObjects();\n const rules = this.conf.getEnabledRules();\n const skipLogic = new skip_logic_1.SkipLogic(this);\n (_a = input === null || input === void 0 ? void 0 : input.progress) === null || _a === void 0 ? void 0 : _a.set(iobj ? 1 : this.getObjectCount(false), \"Run Syntax\");\n const check = [];\n for (const obj of objects) {\n (_b = input === null || input === void 0 ? void 0 : input.progress) === null || _b === void 0 ? void 0 : _b.tick(\"Run Syntax - \" + obj.getName());\n if (skipLogic.skip(obj) || this.isDependency(obj)) {\n continue;\n }\n if (obj instanceof _abap_object_1.ABAPObject) {\n new syntax_1.SyntaxLogic(this, obj).run();\n }\n check.push(obj);\n }\n (_c = input === null || input === void 0 ? void 0 : input.progress) === null || _c === void 0 ? void 0 : _c.set(rules.length, \"Initialize Rules\");\n for (const rule of rules) {\n (_d = input === null || input === void 0 ? void 0 : input.progress) === null || _d === void 0 ? void 0 : _d.tick(\"Initialize Rules - \" + rule.getMetadata().key);\n if (rule.initialize === undefined) {\n throw new Error(rule.getMetadata().key + \" missing initialize method\");\n }\n rule.initialize(this);\n rulePerformance[rule.getMetadata().key] = 0;\n }\n (_e = input === null || input === void 0 ? void 0 : input.progress) === null || _e === void 0 ? void 0 : _e.set(check.length, \"Finding Issues\");\n for (const obj of check) {\n (_f = input === null || input === void 0 ? void 0 : input.progress) === null || _f === void 0 ? void 0 : _f.tick(\"Finding Issues - \" + obj.getType() + \" \" + obj.getName());\n for (const rule of rules) {\n const before = Date.now();\n issues.push(...rule.run(obj));\n const runtime = Date.now() - before;\n rulePerformance[rule.getMetadata().key] = rulePerformance[rule.getMetadata().key] + runtime;\n }\n }\n if ((input === null || input === void 0 ? void 0 : input.outputPerformance) === true) {\n const perf = [];\n for (const p in rulePerformance) {\n if (rulePerformance[p] > 100) { // ignore rules if it takes less than 100ms\n perf.push({ name: p, time: rulePerformance[p] });\n }\n }\n perf.sort((a, b) => { return b.time - a.time; });\n for (const p of perf) {\n process.stderr.write(\"\\t\" + p.time + \"ms\\t\" + p.name + \"\\n\");\n }\n }\n return this.excludeIssues(issues);\n }\n excludeIssues(issues) {\n var _a;\n const ret = issues;\n // exclude issues, as now we know both the filename and issue key\n for (const rule of artifacts_rules_1.ArtifactsRules.getRules()) {\n const key = rule.getMetadata().key;\n const ruleExclude = ((_a = this.conf.readByKey(key, \"exclude\")) !== null && _a !== void 0 ? _a : []);\n const ruleExcludePatterns = ruleExclude.map(x => new RegExp(x, \"i\"));\n for (let i = ret.length - 1; i >= 0; i--) {\n if (ret[i].getKey() !== key) {\n continue;\n }\n const filename = ret[i].getFilename();\n if (excludeHelper_1.ExcludeHelper.isExcluded(filename, ruleExcludePatterns)) {\n ret.splice(i, 1);\n }\n }\n }\n return ret;\n }\n findOrCreate(name, type) {\n try {\n return this.find(name, type);\n }\n catch (_a) {\n const newName = name.toUpperCase();\n const newType = type ? type : \"UNKNOWN\";\n const add = artifacts_objects_1.ArtifactsObjects.newObject(newName, newType);\n if (this.objects[newName] === undefined) {\n this.objects[newName] = {};\n }\n this.objects[newName][newType] = add;\n if (this.objectsByType[newType] === undefined) {\n this.objectsByType[newType] = {};\n }\n this.objectsByType[newType][newName] = add;\n return add;\n }\n }\n removeObject(remove) {\n if (remove === undefined) {\n return;\n }\n if (this.objects[remove.getName()][remove.getType()] === undefined) {\n throw new Error(\"removeObject: object not found\");\n }\n if (Object.keys(this.objects[remove.getName()]).length === 1) {\n delete this.objects[remove.getName()];\n }\n else {\n delete this.objects[remove.getName()][remove.getType()];\n }\n if (Object.keys(this.objectsByType[remove.getType()]).length === 1) {\n delete this.objectsByType[remove.getType()];\n }\n else {\n delete this.objectsByType[remove.getType()][remove.getName()];\n }\n }\n find(name, type) {\n const searchType = type ? type : \"UNKNOWN\";\n const searchName = name.toUpperCase();\n if (this.objects[searchName] !== undefined\n && this.objects[searchName][searchType]) {\n return this.objects[searchName][searchType];\n }\n throw new Error(\"find: object not found, \" + type + \" \" + name);\n }\n}\nexports.Registry = Registry;\n//# sourceMappingURL=registry.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/registry.js?");
|
|
10712
10723
|
|
|
10713
10724
|
/***/ }),
|
|
10714
10725
|
|
|
@@ -12028,7 +12039,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
12028
12039
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12029
12040
|
|
|
12030
12041
|
"use strict";
|
|
12031
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.StaticCallViaInstance = exports.StaticCallViaInstanceConf = void 0;\r\n/* eslint-disable max-len */\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 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 types_1 = __webpack_require__(/*! ../abap/types */ \"./node_modules/@abaplint/core/build/src/abap/types/index.js\");\r\nclass StaticCallViaInstanceConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.StaticCallViaInstanceConf = StaticCallViaInstanceConf;\r\nclass StaticCallViaInstance extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new StaticCallViaInstanceConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"static_call_via_instance\",\r\n title: \"Static call via instance variable\",\r\n shortDescription: `Static method call via instance variable`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#dont-call-static-methods-through-instance-variables`,\r\n tags: [_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, obj) {\r\n const issues = [];\r\n const staticMethodCalls = this.listMethodCalls(file.getFilename(), new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti.getTop());\r\n const tokens = file.getTokens();\r\n for (let i = 0; i < tokens.length - 1; i++) {\r\n const token = tokens[i];\r\n if (token.getStr() !== \"->\") {\r\n continue;\r\n }\r\n const next = tokens[i + 1];\r\n for (const s of staticMethodCalls) {\r\n if (s.equals(next.getStart())) {\r\n const message = \"Avoid calling static method via instance\";\r\n issue_1.Issue.atToken(file, token, message, this.getMetadata().key);\r\n break;\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n listMethodCalls(filename, node) {\r\n const ret = [];\r\n for (const r of node.getData().references) {\r\n if (r.referenceType !== _reference_1.ReferenceType.MethodReference || r.position.getFilename() !== filename) {\r\n continue;\r\n }\r\n if (r.resolved instanceof types_1.MethodDefinition && r.resolved.isStatic() === true) {\r\n ret.push(r.position.getStart());\r\n }\r\n }\r\n for (const child of node.getChildren()) {\r\n ret.push(...this.listMethodCalls(filename, child));\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.StaticCallViaInstance = StaticCallViaInstance;\r\n//# sourceMappingURL=static_call_via_instance.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/static_call_via_instance.js?");
|
|
12042
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.StaticCallViaInstance = exports.StaticCallViaInstanceConf = void 0;\r\n/* eslint-disable max-len */\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 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 types_1 = __webpack_require__(/*! ../abap/types */ \"./node_modules/@abaplint/core/build/src/abap/types/index.js\");\r\nclass StaticCallViaInstanceConf extends _basic_rule_config_1.BasicRuleConfig {\r\n}\r\nexports.StaticCallViaInstanceConf = StaticCallViaInstanceConf;\r\nclass StaticCallViaInstance extends _abap_rule_1.ABAPRule {\r\n constructor() {\r\n super(...arguments);\r\n this.conf = new StaticCallViaInstanceConf();\r\n }\r\n getMetadata() {\r\n return {\r\n key: \"static_call_via_instance\",\r\n title: \"Static call via instance variable\",\r\n shortDescription: `Static method call via instance variable`,\r\n extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#dont-call-static-methods-through-instance-variables`,\r\n tags: [_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, obj) {\r\n const issues = [];\r\n const staticMethodCalls = this.listMethodCalls(file.getFilename(), new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti.getTop());\r\n const tokens = file.getTokens();\r\n for (let i = 0; i < tokens.length - 1; i++) {\r\n const token = tokens[i];\r\n if (token.getStr() !== \"->\") {\r\n continue;\r\n }\r\n const next = tokens[i + 1];\r\n for (const s of staticMethodCalls) {\r\n if (s.equals(next.getStart())) {\r\n const message = \"Avoid calling static method via instance\";\r\n issues.push(issue_1.Issue.atToken(file, token, message, this.getMetadata().key));\r\n break;\r\n }\r\n }\r\n }\r\n return issues;\r\n }\r\n listMethodCalls(filename, node) {\r\n const ret = [];\r\n for (const r of node.getData().references) {\r\n if (r.referenceType !== _reference_1.ReferenceType.MethodReference || r.position.getFilename() !== filename) {\r\n continue;\r\n }\r\n if (r.resolved instanceof types_1.MethodDefinition && r.resolved.isStatic() === true) {\r\n ret.push(r.position.getStart());\r\n }\r\n }\r\n for (const child of node.getChildren()) {\r\n ret.push(...this.listMethodCalls(filename, child));\r\n }\r\n return ret;\r\n }\r\n}\r\nexports.StaticCallViaInstance = StaticCallViaInstance;\r\n//# sourceMappingURL=static_call_via_instance.js.map\n\n//# sourceURL=webpack://@abaplint/cli/./node_modules/@abaplint/core/build/src/rules/static_call_via_instance.js?");
|
|
12032
12043
|
|
|
12033
12044
|
/***/ }),
|
|
12034
12045
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApackDependencyProvider = void 0;
|
|
4
|
+
const xml_js_1 = require("xml-js");
|
|
5
|
+
class ApackDependencyProvider {
|
|
6
|
+
static fromManifest(manifestContents) {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
if (!manifestContents || !manifestContents.length) {
|
|
9
|
+
return [];
|
|
10
|
+
}
|
|
11
|
+
const result = [];
|
|
12
|
+
const manifest = (0, xml_js_1.xml2js)(manifestContents, { compact: true });
|
|
13
|
+
let apackDependencies = (_b = (_a = manifest["asx:abap"]["asx:values"]["DATA"]) === null || _a === void 0 ? void 0 : _a["DEPENDENCIES"]) === null || _b === void 0 ? void 0 : _b.item;
|
|
14
|
+
if (!apackDependencies) {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
else if (!apackDependencies.length) {
|
|
18
|
+
apackDependencies = [apackDependencies];
|
|
19
|
+
}
|
|
20
|
+
for (const dependency of apackDependencies) {
|
|
21
|
+
result.push({
|
|
22
|
+
files: "/src/**/*.*",
|
|
23
|
+
url: dependency["GIT_URL"]["_text"],
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.ApackDependencyProvider = ApackDependencyProvider;
|
|
30
|
+
//# sourceMappingURL=apack_dependency_provider.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompressedFile = void 0;
|
|
4
|
+
const core_1 = require("@abaplint/core");
|
|
5
|
+
const zlib = require("zlib");
|
|
6
|
+
class CompressedFile extends core_1.AbstractFile {
|
|
7
|
+
constructor(filename, compressed) {
|
|
8
|
+
super(filename);
|
|
9
|
+
this.compressed = compressed;
|
|
10
|
+
}
|
|
11
|
+
getRaw() {
|
|
12
|
+
return this.decompress(this.compressed);
|
|
13
|
+
}
|
|
14
|
+
getRawRows() {
|
|
15
|
+
return this.decompress(this.compressed).split("\n");
|
|
16
|
+
}
|
|
17
|
+
decompress(compressed) {
|
|
18
|
+
return zlib.inflateSync(Buffer.from(compressed, "base64")).toString("utf8");
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.CompressedFile = CompressedFile;
|
|
22
|
+
//# sourceMappingURL=compressed_file.js.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FileOperations = void 0;
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const zlib = require("zlib");
|
|
7
|
+
const glob = require("glob");
|
|
8
|
+
const core_1 = require("@abaplint/core");
|
|
9
|
+
const compressed_file_1 = require("./compressed_file");
|
|
10
|
+
class FileOperations {
|
|
11
|
+
static deleteFolderRecursive(dir) {
|
|
12
|
+
if (fs.existsSync(dir) === false) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
fs.rmSync(dir, { recursive: true });
|
|
16
|
+
}
|
|
17
|
+
static loadFileNames(arg, error = true) {
|
|
18
|
+
const files = glob.sync(arg, { nosort: true, nodir: true });
|
|
19
|
+
if (files.length === 0 && error) {
|
|
20
|
+
throw "Error: No files found";
|
|
21
|
+
}
|
|
22
|
+
return files;
|
|
23
|
+
}
|
|
24
|
+
static async loadFiles(compress, input, bar) {
|
|
25
|
+
const files = [];
|
|
26
|
+
bar.set(input.length, "Reading files");
|
|
27
|
+
for (const filename of input) {
|
|
28
|
+
bar.tick("Reading files - " + path.basename(filename));
|
|
29
|
+
const base = filename.split("/").reverse()[0];
|
|
30
|
+
if (base.split(".").length <= 2) {
|
|
31
|
+
continue; // not a abapGit file
|
|
32
|
+
}
|
|
33
|
+
// note that readFileSync is typically faster than async readFile,
|
|
34
|
+
// https://medium.com/@adamhooper/node-synchronous-code-runs-faster-than-asynchronous-code-b0553d5cf54e
|
|
35
|
+
const raw = fs.readFileSync(filename, "utf8");
|
|
36
|
+
if (compress === true) {
|
|
37
|
+
// todo, util.promisify(zlib.deflate) does not seem to work?
|
|
38
|
+
files.push(new compressed_file_1.CompressedFile(filename, zlib.deflateSync(raw).toString("base64")));
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
files.push(new core_1.MemoryFile(filename, raw));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return files;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.FileOperations = FileOperations;
|
|
48
|
+
//# sourceMappingURL=file_operations.js.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyFixes = void 0;
|
|
4
|
+
const core_1 = require("@abaplint/core");
|
|
5
|
+
function applyFixes(inputIssues, reg, fs, bar) {
|
|
6
|
+
let changed = [];
|
|
7
|
+
let iteration = 1;
|
|
8
|
+
let issues = inputIssues;
|
|
9
|
+
const MAX_ITERATIONS = 30;
|
|
10
|
+
bar === null || bar === void 0 ? void 0 : bar.set(MAX_ITERATIONS, "Apply Fixes");
|
|
11
|
+
while (iteration <= MAX_ITERATIONS) {
|
|
12
|
+
bar === null || bar === void 0 ? void 0 : bar.tick("Apply Fixes, iteration " + iteration + ", " + issues.length + " candidates");
|
|
13
|
+
changed = applyList(issues, reg, fs);
|
|
14
|
+
if (changed.length === 0) {
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
iteration++;
|
|
18
|
+
issues = reg.parse().findIssues();
|
|
19
|
+
}
|
|
20
|
+
// always end the progress indicator at 100%
|
|
21
|
+
while (iteration <= MAX_ITERATIONS) {
|
|
22
|
+
bar === null || bar === void 0 ? void 0 : bar.tick("Apply Fixes, iteration " + iteration + ", " + issues.length + " candidates");
|
|
23
|
+
iteration++;
|
|
24
|
+
}
|
|
25
|
+
return issues;
|
|
26
|
+
}
|
|
27
|
+
exports.applyFixes = applyFixes;
|
|
28
|
+
function possibleOverlap(edit, list) {
|
|
29
|
+
// only checks if the edits have changes in the same rows
|
|
30
|
+
for (const e of list) {
|
|
31
|
+
for (const file1 of Object.keys(e)) {
|
|
32
|
+
for (const file2 of Object.keys(edit)) {
|
|
33
|
+
if (file1 === file2) {
|
|
34
|
+
for (const list1 of e[file1]) {
|
|
35
|
+
for (const list2 of edit[file2]) {
|
|
36
|
+
if (list2.range.start.getRow() <= list1.range.start.getRow()
|
|
37
|
+
&& list2.range.end.getRow() >= list1.range.start.getRow()) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
if (list2.range.start.getRow() <= list1.range.start.getRow()
|
|
41
|
+
&& list2.range.end.getRow() >= list1.range.end.getRow()) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
function applyList(issues, reg, fs) {
|
|
53
|
+
const edits = [];
|
|
54
|
+
for (const i of issues) {
|
|
55
|
+
const edit = i.getFix();
|
|
56
|
+
if (edit === undefined) {
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
else if (possibleOverlap(edit, edits) === true) {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
edits.push(edit);
|
|
63
|
+
}
|
|
64
|
+
const changed = (0, core_1.applyEditList)(reg, edits);
|
|
65
|
+
for (const filename of changed) {
|
|
66
|
+
const file = reg.getFileByName(filename);
|
|
67
|
+
if (file === undefined) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
fs.writeFileSync(file.getFilename(), file.getRaw());
|
|
71
|
+
}
|
|
72
|
+
return changed;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=fixes.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Formatter = void 0;
|
|
4
|
+
const Formatters = require(".");
|
|
5
|
+
class Formatter {
|
|
6
|
+
static format(issues, format, fileCount) {
|
|
7
|
+
// todo, this can be done more generic, move to artifacts.ts?
|
|
8
|
+
switch (format) {
|
|
9
|
+
case "total":
|
|
10
|
+
return new Formatters.Total().output(issues, fileCount);
|
|
11
|
+
case "json":
|
|
12
|
+
return new Formatters.Json().output(issues, fileCount);
|
|
13
|
+
case "junit":
|
|
14
|
+
return new Formatters.Junit().output(issues, fileCount);
|
|
15
|
+
case "codeframe":
|
|
16
|
+
return new Formatters.CodeFrame().output(issues, fileCount);
|
|
17
|
+
default:
|
|
18
|
+
return new Formatters.Standard().output(issues, fileCount);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.Formatter = Formatter;
|
|
23
|
+
//# sourceMappingURL=_format.js.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CodeFrame = void 0;
|
|
4
|
+
const total_1 = require("./total");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const chalk_1 = require("chalk");
|
|
7
|
+
function issueSort(a, b) {
|
|
8
|
+
return a.filename.localeCompare(b.filename)
|
|
9
|
+
|| (a.row - b.row)
|
|
10
|
+
|| (a.col - b.col);
|
|
11
|
+
}
|
|
12
|
+
class CodeFrame {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.currentFilename = "";
|
|
15
|
+
this.currentFileLinesCount = 0;
|
|
16
|
+
this.fileContent = [];
|
|
17
|
+
}
|
|
18
|
+
output(issues, fileCount) {
|
|
19
|
+
const builtIssues = this.convertAllIssues(issues).sort(issueSort); // Make sure it is sorted by filename for caching to work
|
|
20
|
+
return [
|
|
21
|
+
...builtIssues.map(i => this.renderIssue(i)),
|
|
22
|
+
(issues.length > 0 ? (0, chalk_1.red)(new total_1.Total().output(issues, fileCount)) : (0, chalk_1.green)(new total_1.Total().output(issues, fileCount))),
|
|
23
|
+
].join("\n");
|
|
24
|
+
}
|
|
25
|
+
convertAllIssues(issues) {
|
|
26
|
+
return issues.map(i => this.convertIssue(i));
|
|
27
|
+
}
|
|
28
|
+
cacheFile(filename) {
|
|
29
|
+
if (filename !== this.currentFilename) {
|
|
30
|
+
this.currentFilename = filename;
|
|
31
|
+
this.fileContent = fs.readFileSync(filename, "utf8").split(/\r?\n/);
|
|
32
|
+
this.currentFileLinesCount = this.fileContent.length;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
renderIssue(issue) {
|
|
36
|
+
this.cacheFile(issue.filename);
|
|
37
|
+
const frameSize = 1;
|
|
38
|
+
const lineFrom = Math.max(issue.row - frameSize, 1);
|
|
39
|
+
const lineTo = Math.min(issue.row + frameSize, this.currentFileLinesCount);
|
|
40
|
+
const issueLineIndex = issue.row - 1;
|
|
41
|
+
const padSize = Math.ceil(Math.log10(lineTo)) + 4;
|
|
42
|
+
const code = [];
|
|
43
|
+
for (let lineIndex = lineFrom - 1; lineIndex < lineTo; lineIndex++) {
|
|
44
|
+
const prefix = `${ /*(lineIndex === issueLineIndex) ? ">" :*/" "}${lineIndex + 1} |`.padStart(padSize);
|
|
45
|
+
code.push(prefix + this.fileContent[lineIndex]);
|
|
46
|
+
if (lineIndex === issueLineIndex) {
|
|
47
|
+
code.push("|".padStart(padSize) + " ".repeat(issue.col - 1) + "^");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const severityStr = issue.severity === "E"
|
|
51
|
+
? (0, chalk_1.red)(issue.severity)
|
|
52
|
+
: (0, chalk_1.yellow)(issue.severity);
|
|
53
|
+
return `[${severityStr}] ${issue.description} (${issue.issueKey}) @ ${issue.location}`
|
|
54
|
+
+ "\n"
|
|
55
|
+
+ code.map(str => (0, chalk_1.grey)(str)).join("\n")
|
|
56
|
+
+ "\n";
|
|
57
|
+
}
|
|
58
|
+
renderLocation(issue) {
|
|
59
|
+
return issue.getFilename() + "[" + issue.getStart().getRow() + ", " + issue.getStart().getCol() + "]";
|
|
60
|
+
}
|
|
61
|
+
convertIssue(issue) {
|
|
62
|
+
return {
|
|
63
|
+
location: this.renderLocation(issue),
|
|
64
|
+
description: issue.getMessage(),
|
|
65
|
+
issueKey: issue.getKey(),
|
|
66
|
+
filename: issue.getFilename(),
|
|
67
|
+
severity: issue.getSeverity().toString().charAt(0),
|
|
68
|
+
row: issue.getStart().getRow(),
|
|
69
|
+
col: issue.getStart().getCol(),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.CodeFrame = CodeFrame;
|
|
74
|
+
//# sourceMappingURL=codeframe.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./json"), exports);
|
|
14
|
+
__exportStar(require("./junit"), exports);
|
|
15
|
+
__exportStar(require("./standard"), exports);
|
|
16
|
+
__exportStar(require("./total"), exports);
|
|
17
|
+
__exportStar(require("./codeframe"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Json = void 0;
|
|
4
|
+
class Json {
|
|
5
|
+
output(issues, _fileCount) {
|
|
6
|
+
const out = [];
|
|
7
|
+
for (const issue of issues) {
|
|
8
|
+
const single = {
|
|
9
|
+
description: issue.getMessage(),
|
|
10
|
+
key: issue.getKey(),
|
|
11
|
+
file: issue.getFilename(),
|
|
12
|
+
start: {
|
|
13
|
+
row: issue.getStart().getRow(),
|
|
14
|
+
col: issue.getStart().getCol(),
|
|
15
|
+
},
|
|
16
|
+
end: {
|
|
17
|
+
row: issue.getEnd().getRow(),
|
|
18
|
+
col: issue.getEnd().getCol(),
|
|
19
|
+
},
|
|
20
|
+
severity: issue.getSeverity(),
|
|
21
|
+
};
|
|
22
|
+
out.push(single);
|
|
23
|
+
}
|
|
24
|
+
return JSON.stringify(out) + "\n";
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.Json = Json;
|
|
28
|
+
//# sourceMappingURL=json.js.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Junit = void 0;
|
|
4
|
+
const xml_js_1 = require("xml-js");
|
|
5
|
+
class Junit {
|
|
6
|
+
output(issues, _fileCount) {
|
|
7
|
+
const outputObj = {
|
|
8
|
+
_declaration: {
|
|
9
|
+
_attributes: {
|
|
10
|
+
version: "1.0",
|
|
11
|
+
encoding: "UTF-8",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
testsuites: {
|
|
15
|
+
testsuite: {
|
|
16
|
+
_attributes: {
|
|
17
|
+
name: "abaplint",
|
|
18
|
+
tests: issues.length || 1,
|
|
19
|
+
failures: issues.length,
|
|
20
|
+
errors: 0,
|
|
21
|
+
skipped: 0,
|
|
22
|
+
},
|
|
23
|
+
testcase: [],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
if (issues.length > 0) {
|
|
28
|
+
for (const issue of issues) {
|
|
29
|
+
outputObj.testsuites.testsuite.testcase.push({
|
|
30
|
+
_attributes: {
|
|
31
|
+
classname: issue.getFilename().split(".")[0],
|
|
32
|
+
file: issue.getFilename(),
|
|
33
|
+
name: `${issue.getFilename()}: [${issue.getStart().getRow()}, ${issue.getStart().getCol()}] - ${issue.getKey()}`,
|
|
34
|
+
},
|
|
35
|
+
failure: {
|
|
36
|
+
_attributes: {
|
|
37
|
+
message: issue.getKey(),
|
|
38
|
+
type: issue.getSeverity().toString(),
|
|
39
|
+
},
|
|
40
|
+
_cdata: `${issue.getMessage()}`,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
outputObj.testsuites.testsuite.testcase.push({
|
|
47
|
+
_attributes: {
|
|
48
|
+
classname: "none",
|
|
49
|
+
name: "OK",
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
const xml = (0, xml_js_1.js2xml)(outputObj, { compact: true, spaces: 2 });
|
|
54
|
+
return xml;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.Junit = Junit;
|
|
58
|
+
//# sourceMappingURL=junit.js.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Standard = void 0;
|
|
4
|
+
const total_1 = require("./total");
|
|
5
|
+
class Standard {
|
|
6
|
+
output(issues, fileCount) {
|
|
7
|
+
const tuples = [];
|
|
8
|
+
for (const issue of issues) {
|
|
9
|
+
tuples.push(this.build(issue));
|
|
10
|
+
}
|
|
11
|
+
tuples.sort((a, b) => {
|
|
12
|
+
const nameCompare = a.rawFilename.localeCompare(b.rawFilename);
|
|
13
|
+
if (nameCompare === 0) {
|
|
14
|
+
const rowCompare = a.startPos.getRow() - b.startPos.getRow();
|
|
15
|
+
if (rowCompare === 0) {
|
|
16
|
+
return a.startPos.getCol() - b.startPos.getCol();
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
return rowCompare;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
return nameCompare;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
const result = this.columns(tuples);
|
|
27
|
+
return result + new total_1.Total().output(issues, fileCount);
|
|
28
|
+
}
|
|
29
|
+
columns(issues) {
|
|
30
|
+
let max = 0;
|
|
31
|
+
issues.forEach((tuple) => { if (max < tuple.filename.length) {
|
|
32
|
+
max = tuple.filename.length;
|
|
33
|
+
} });
|
|
34
|
+
let result = "";
|
|
35
|
+
issues.forEach((issue) => {
|
|
36
|
+
result = result +
|
|
37
|
+
this.pad(issue.filename, max - issue.filename.length) +
|
|
38
|
+
issue.description +
|
|
39
|
+
` [${issue.severity.charAt(0)}]\n`; //E/W/I
|
|
40
|
+
});
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
pad(input, length) {
|
|
44
|
+
let output = input;
|
|
45
|
+
for (let i = 0; i < length; i++) {
|
|
46
|
+
output = output + " ";
|
|
47
|
+
}
|
|
48
|
+
return output + " - ";
|
|
49
|
+
}
|
|
50
|
+
build(issue) {
|
|
51
|
+
return {
|
|
52
|
+
filename: issue.getFilename() + "[" + issue.getStart().getRow() + ", " + issue.getStart().getCol() + "]",
|
|
53
|
+
description: issue.getMessage() + " (" + issue.getKey() + ")",
|
|
54
|
+
startPos: issue.getStart(),
|
|
55
|
+
rawFilename: issue.getFilename(),
|
|
56
|
+
severity: issue.getSeverity().toString(),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.Standard = Standard;
|
|
61
|
+
//# sourceMappingURL=standard.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Total = void 0;
|
|
4
|
+
class Total {
|
|
5
|
+
output(issues, fileCount) {
|
|
6
|
+
return "abaplint: " + issues.length + " issue(s) found, " + fileCount + " file(s) analyzed\n";
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.Total = Total;
|
|
10
|
+
//# sourceMappingURL=total.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Issue, IRegistry } from "@abaplint/core";
|
|
2
|
+
export declare const GENERIC_ERROR = "generic_error";
|
|
3
|
+
export declare type Arguments = {
|
|
4
|
+
configFilename?: string;
|
|
5
|
+
format: string;
|
|
6
|
+
compress?: boolean;
|
|
7
|
+
parsingPerformance?: boolean;
|
|
8
|
+
showHelp?: boolean;
|
|
9
|
+
showVersion?: boolean;
|
|
10
|
+
outputDefaultConfig?: boolean;
|
|
11
|
+
runFix?: boolean;
|
|
12
|
+
runRename?: boolean;
|
|
13
|
+
outFormat?: string;
|
|
14
|
+
outFile?: string;
|
|
15
|
+
};
|
|
16
|
+
export declare function run(arg: Arguments): Promise<{
|
|
17
|
+
output: string;
|
|
18
|
+
issues: Issue[];
|
|
19
|
+
reg: IRegistry | undefined;
|
|
20
|
+
}>;
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.run = exports.GENERIC_ERROR = void 0;
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const os = require("os");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const ProgressBar = require("progress");
|
|
8
|
+
const childProcess = require("child_process");
|
|
9
|
+
const JSON5 = require("json5");
|
|
10
|
+
const core_1 = require("@abaplint/core");
|
|
11
|
+
const _format_1 = require("./formatters/_format");
|
|
12
|
+
const file_operations_1 = require("./file_operations");
|
|
13
|
+
const apack_dependency_provider_1 = require("./apack_dependency_provider");
|
|
14
|
+
const fixes_1 = require("./fixes");
|
|
15
|
+
const rename_1 = require("./rename");
|
|
16
|
+
exports.GENERIC_ERROR = "generic_error";
|
|
17
|
+
class Progress {
|
|
18
|
+
set(total, _text) {
|
|
19
|
+
this.bar = new ProgressBar(":percent - :elapseds - :text", { total, renderThrottle: 100 });
|
|
20
|
+
}
|
|
21
|
+
async tick(text) {
|
|
22
|
+
this.bar.tick({ text });
|
|
23
|
+
this.bar.render();
|
|
24
|
+
}
|
|
25
|
+
tickSync(text) {
|
|
26
|
+
this.bar.tick({ text });
|
|
27
|
+
this.bar.render();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function loadConfig(filename) {
|
|
31
|
+
// possible cases:
|
|
32
|
+
// a) nothing specified, using abaplint.json from cwd
|
|
33
|
+
// b) nothing specified, no abaplint.json in cwd
|
|
34
|
+
// c) specified and found
|
|
35
|
+
// d) specified and not found => use default
|
|
36
|
+
// e) supplied but a directory => use default
|
|
37
|
+
let f = "";
|
|
38
|
+
if (filename === undefined) {
|
|
39
|
+
f = process.cwd() + path.sep + "abaplint.json";
|
|
40
|
+
if (fs.existsSync(f) === false) {
|
|
41
|
+
f = process.cwd() + path.sep + "abaplint.jsonc";
|
|
42
|
+
}
|
|
43
|
+
if (fs.existsSync(f) === false) {
|
|
44
|
+
f = process.cwd() + path.sep + "abaplint.json5";
|
|
45
|
+
}
|
|
46
|
+
if (fs.existsSync(f) === false) {
|
|
47
|
+
process.stderr.write("Using default config\n");
|
|
48
|
+
return { config: core_1.Config.getDefault(), base: "." };
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
if (fs.existsSync(filename) === false) {
|
|
53
|
+
process.stderr.write("ERROR: Specified abaplint configuration file does not exist, using default config\n");
|
|
54
|
+
return { config: core_1.Config.getDefault(), base: "." };
|
|
55
|
+
}
|
|
56
|
+
else if (fs.statSync(filename).isDirectory() === true) {
|
|
57
|
+
process.stderr.write("Supply filename, not directory, using default config\n");
|
|
58
|
+
return { config: core_1.Config.getDefault(), base: "." };
|
|
59
|
+
}
|
|
60
|
+
f = filename;
|
|
61
|
+
}
|
|
62
|
+
// evil hack to get JSON5 working
|
|
63
|
+
if (JSON5.parse === undefined) {
|
|
64
|
+
// @ts-ignore
|
|
65
|
+
JSON5.parse = JSON5.default.parse;
|
|
66
|
+
}
|
|
67
|
+
process.stderr.write("Using config: " + f + "\n");
|
|
68
|
+
const json = fs.readFileSync(f, "utf8");
|
|
69
|
+
const parsed = JSON5.parse(json);
|
|
70
|
+
const vers = core_1.Version;
|
|
71
|
+
if (Object.keys(core_1.Version).some(v => vers[v] === parsed.syntax.version) === false) {
|
|
72
|
+
throw "Error: Unknown version in abaplint.json";
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
config: new core_1.Config(json),
|
|
76
|
+
base: path.dirname(f) === process.cwd() ? "." : path.dirname(f),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
async function loadDependencies(config, compress, bar, base) {
|
|
80
|
+
let files = [];
|
|
81
|
+
const deps = config.get().dependencies || [];
|
|
82
|
+
const useApack = config.get().global.useApackDependencies;
|
|
83
|
+
if (useApack) {
|
|
84
|
+
const apackPath = path.join(base, ".apack-manifest.xml");
|
|
85
|
+
if (fs.existsSync(apackPath)) {
|
|
86
|
+
const apackManifest = fs.readFileSync(apackPath, "utf8");
|
|
87
|
+
deps.push(...apack_dependency_provider_1.ApackDependencyProvider.fromManifest(apackManifest));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (!deps) {
|
|
91
|
+
return [];
|
|
92
|
+
}
|
|
93
|
+
for (const d of deps) {
|
|
94
|
+
if (d.folder) {
|
|
95
|
+
const g = base + d.folder + d.files;
|
|
96
|
+
const names = file_operations_1.FileOperations.loadFileNames(g, false);
|
|
97
|
+
if (names.length > 0) {
|
|
98
|
+
process.stderr.write("Using dependency from: " + g + "\n");
|
|
99
|
+
files = files.concat(await file_operations_1.FileOperations.loadFiles(compress, names, bar));
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (d.url) {
|
|
104
|
+
process.stderr.write("Clone: " + d.url + "\n");
|
|
105
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "abaplint-"));
|
|
106
|
+
childProcess.execSync("git clone --quiet --depth 1 " + d.url + " .", { cwd: dir, stdio: "inherit" });
|
|
107
|
+
const names = file_operations_1.FileOperations.loadFileNames(dir + d.files);
|
|
108
|
+
files = files.concat(await file_operations_1.FileOperations.loadFiles(compress, names, bar));
|
|
109
|
+
file_operations_1.FileOperations.deleteFolderRecursive(dir);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return files;
|
|
113
|
+
}
|
|
114
|
+
function displayHelp() {
|
|
115
|
+
// follow https://docopt.org conventions,
|
|
116
|
+
return "Usage:\n" +
|
|
117
|
+
" abaplint [<abaplint.json> -f <format> -c --outformat <format> --outfile <file> --fix] \n" +
|
|
118
|
+
" abaplint -h | --help show this help\n" +
|
|
119
|
+
" abaplint -v | --version show version\n" +
|
|
120
|
+
" abaplint -d | --default show default configuration\n" +
|
|
121
|
+
"\n" +
|
|
122
|
+
"Options:\n" +
|
|
123
|
+
" -f, --format <format> output format (standard, total, json, summary, junit, codeframe)\n" +
|
|
124
|
+
" --outformat <format> output format, use in combination with outfile\n" +
|
|
125
|
+
" --outfile <file> output issues to file in format\n" +
|
|
126
|
+
" --fix apply quick fixes to files\n" +
|
|
127
|
+
" --rename rename object according to rules in abaplint.json\n" +
|
|
128
|
+
" -p output performance information\n" +
|
|
129
|
+
" -c compress files in memory\n";
|
|
130
|
+
}
|
|
131
|
+
function out(issues, length, arg) {
|
|
132
|
+
const output = _format_1.Formatter.format(issues, arg.format, length);
|
|
133
|
+
if (arg.outFormat && arg.outFile) {
|
|
134
|
+
const fileContents = _format_1.Formatter.format(issues, arg.outFile, length);
|
|
135
|
+
fs.writeFileSync(arg.outFile, fileContents, "utf-8");
|
|
136
|
+
}
|
|
137
|
+
return output;
|
|
138
|
+
}
|
|
139
|
+
async function run(arg) {
|
|
140
|
+
var _a, _b;
|
|
141
|
+
// evil hack to get JSON5 working
|
|
142
|
+
if (JSON5.parse === undefined) {
|
|
143
|
+
// @ts-ignore
|
|
144
|
+
JSON5.parse = JSON5.default.parse;
|
|
145
|
+
}
|
|
146
|
+
if (JSON5.stringify === undefined) {
|
|
147
|
+
// @ts-ignore
|
|
148
|
+
JSON5.stringify = JSON5.default.stringify;
|
|
149
|
+
}
|
|
150
|
+
let output = "";
|
|
151
|
+
let issues = [];
|
|
152
|
+
let reg = undefined;
|
|
153
|
+
const progress = new Progress();
|
|
154
|
+
if (arg.showHelp === true) {
|
|
155
|
+
output = output + displayHelp();
|
|
156
|
+
}
|
|
157
|
+
else if (arg.showVersion === true) {
|
|
158
|
+
output = output + core_1.Registry.abaplintVersion() + "\n";
|
|
159
|
+
}
|
|
160
|
+
else if (arg.outputDefaultConfig === true) {
|
|
161
|
+
output = output + JSON.stringify(core_1.Config.getDefault().get(), undefined, 2) + "\n";
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
process.stderr.write("abaplint " + core_1.Registry.abaplintVersion() + "\n");
|
|
165
|
+
let loaded = [];
|
|
166
|
+
let deps = [];
|
|
167
|
+
const { config, base } = loadConfig(arg.configFilename);
|
|
168
|
+
try {
|
|
169
|
+
if (config.get().global.files === undefined) {
|
|
170
|
+
throw "Error: Update abaplint configuration file to latest format";
|
|
171
|
+
}
|
|
172
|
+
const files = file_operations_1.FileOperations.loadFileNames(base + config.get().global.files);
|
|
173
|
+
loaded = await file_operations_1.FileOperations.loadFiles(arg.compress, files, progress);
|
|
174
|
+
deps = await loadDependencies(config, arg.compress, progress, base);
|
|
175
|
+
reg = new core_1.Registry(config);
|
|
176
|
+
reg.addDependencies(deps);
|
|
177
|
+
reg.addFiles(loaded); // if the object exists in repo, it should take precedence over deps
|
|
178
|
+
await reg.parseAsync({ progress, outputPerformance: arg.parsingPerformance });
|
|
179
|
+
issues = issues.concat(reg.findIssues({ progress, outputPerformance: arg.parsingPerformance }));
|
|
180
|
+
}
|
|
181
|
+
catch (error) {
|
|
182
|
+
const file = new core_1.MemoryFile("generic", "dummy");
|
|
183
|
+
const message = error.toString() + " " + ((_b = (_a = error.stack) === null || _a === void 0 ? void 0 : _a.split("\n")[1]) === null || _b === void 0 ? void 0 : _b.trim());
|
|
184
|
+
const issue = core_1.Issue.atPosition(file, new core_1.Position(1, 1), message, exports.GENERIC_ERROR);
|
|
185
|
+
issues = [issue];
|
|
186
|
+
}
|
|
187
|
+
let extra = "";
|
|
188
|
+
if (arg.runFix === true && reg) {
|
|
189
|
+
issues = (0, fixes_1.applyFixes)(issues, reg, fs, progress);
|
|
190
|
+
extra = "Fixes applied";
|
|
191
|
+
}
|
|
192
|
+
else if (arg.runRename === true && reg) {
|
|
193
|
+
if (issues.length === 0) {
|
|
194
|
+
new rename_1.Rename(reg).run(config, base);
|
|
195
|
+
extra = "Renames applied";
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
extra = "Renames NOT applied, issues found";
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
output = out(issues, loaded.length, arg) + extra;
|
|
202
|
+
}
|
|
203
|
+
return { output, issues, reg };
|
|
204
|
+
}
|
|
205
|
+
exports.run = run;
|
|
206
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Rename = void 0;
|
|
4
|
+
const abaplint = require("@abaplint/core");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const fs = require("fs");
|
|
7
|
+
const file_operations_1 = require("./file_operations");
|
|
8
|
+
class Rename {
|
|
9
|
+
constructor(reg) {
|
|
10
|
+
this.reg = reg;
|
|
11
|
+
}
|
|
12
|
+
run(config, base) {
|
|
13
|
+
const rconfig = config.get().rename;
|
|
14
|
+
if (rconfig === undefined) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
this.skip(rconfig);
|
|
18
|
+
this.rename(rconfig);
|
|
19
|
+
this.write(rconfig, base);
|
|
20
|
+
}
|
|
21
|
+
////////////////////////
|
|
22
|
+
write(rconfig, base) {
|
|
23
|
+
const outputFolder = base + path.sep + rconfig.output;
|
|
24
|
+
console.log("Base: " + base);
|
|
25
|
+
console.log("Output folder: " + outputFolder);
|
|
26
|
+
file_operations_1.FileOperations.deleteFolderRecursive(outputFolder);
|
|
27
|
+
for (const o of this.reg.getObjects()) {
|
|
28
|
+
if (this.reg.isDependency(o) === true) {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
for (const f of o.getFiles()) {
|
|
32
|
+
const n = outputFolder + f.getFilename().replace(base, "");
|
|
33
|
+
console.log("Write " + n);
|
|
34
|
+
fs.mkdirSync(path.dirname(n), { recursive: true });
|
|
35
|
+
fs.writeFileSync(n, f.getRaw());
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
rename(rconfig) {
|
|
40
|
+
const renamer = new abaplint.Rename(this.reg);
|
|
41
|
+
for (const o of this.reg.getObjects()) {
|
|
42
|
+
if (this.reg.isDependency(o) === true) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
for (const p of rconfig.patterns || []) {
|
|
46
|
+
if (!(o.getType().match(p.type))) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
const regex = new RegExp(p.oldName, "i");
|
|
50
|
+
const match = regex.exec(o.getName());
|
|
51
|
+
if (!match) {
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
const newStr = o.getName().replace(regex, p.newName);
|
|
55
|
+
console.log("Renaming " + o.getName().padEnd(30, " ") + " -> " + newStr);
|
|
56
|
+
renamer.rename(o.getType(), o.getName(), newStr);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
skip(rconfig) {
|
|
61
|
+
if (rconfig.skip) {
|
|
62
|
+
for (const s of rconfig.skip) {
|
|
63
|
+
const all = [];
|
|
64
|
+
for (const f of this.reg.getFiles()) {
|
|
65
|
+
all.push(f);
|
|
66
|
+
}
|
|
67
|
+
for (const n of all) {
|
|
68
|
+
if (n.getFilename().match(s)) {
|
|
69
|
+
console.log(n.getFilename() + " skipped");
|
|
70
|
+
this.reg.removeFile(n);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
this.reg.parse();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.Rename = Rename;
|
|
79
|
+
//# sourceMappingURL=rename.js.map
|
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/cli",
|
|
3
|
-
"version": "2.82.
|
|
3
|
+
"version": "2.82.4",
|
|
4
4
|
"description": "abaplint - Command Line Interface",
|
|
5
5
|
"bin": {
|
|
6
6
|
"abaplint": "./abaplint"
|
|
7
7
|
},
|
|
8
|
+
"main": "./build/src/index.js",
|
|
9
|
+
"types": "./build/src/index.d.ts",
|
|
8
10
|
"scripts": {
|
|
9
11
|
"lint": "eslint src/**/*.ts test/**/*.ts --format unix",
|
|
10
12
|
"compile": "tsc",
|
|
@@ -37,7 +39,7 @@
|
|
|
37
39
|
},
|
|
38
40
|
"homepage": "https://abaplint.org",
|
|
39
41
|
"devDependencies": {
|
|
40
|
-
"@abaplint/core": "^2.82.
|
|
42
|
+
"@abaplint/core": "^2.82.4",
|
|
41
43
|
"@types/chai": "^4.2.22",
|
|
42
44
|
"@types/glob": "^7.2.0",
|
|
43
45
|
"@types/minimist": "^1.2.2",
|
|
@@ -45,7 +47,7 @@
|
|
|
45
47
|
"@types/node": "^16.11.10",
|
|
46
48
|
"@types/progress": "^2.0.5",
|
|
47
49
|
"chai": "^4.3.4",
|
|
48
|
-
"chalk": "
|
|
50
|
+
"chalk": "=4.1.2",
|
|
49
51
|
"eslint": "^8.3.0",
|
|
50
52
|
"glob": "^7.2.0",
|
|
51
53
|
"json5": "^2.2.0",
|
|
@@ -54,7 +56,7 @@
|
|
|
54
56
|
"mocha": "^9.1.3",
|
|
55
57
|
"progress": "^2.0.3",
|
|
56
58
|
"typescript": "^4.5.2",
|
|
57
|
-
"webpack": "^5.64.
|
|
59
|
+
"webpack": "^5.64.4",
|
|
58
60
|
"webpack-cli": "^4.9.1",
|
|
59
61
|
"xml-js": "^1.6.11"
|
|
60
62
|
},
|