UNPKG

@abaplint/transpiler

Version:
141 lines 4.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Validation = exports.config = void 0; const core_1 = require("@abaplint/core"); const types_1 = require("./types"); exports.config = { "global": { "files": "/**/*.*", }, "syntax": { "version": core_1.Version.OpenABAP, "errorNamespace": ".", }, "rules": { "when_others_last": true, "avoid_use": { "execSQL": true, "kernelCall": true, "communication": true, "systemCall": true, "break": false, "statics": false, "endselect": false, "defaultKey": false, }, "parser_error": true, "allowed_object_types": { "allowed": [ "APIS", "AUTH", "CLAS", "DEVC", "DOMA", "DTEL", "ENHO", "ENHS", "ENQU", "FUGR", "HTTP", "INTF", "IWMO", "IWOM", "IWPR", "IWSG", "IWSV", "MSAG", "NROB", "NSPC", "OA2P", "PARA", "PROG", "WAPA", "SHLP", "SHMA", "SICF", "SMIM", "SMIM", "SPLO", "SRFC", "SUSC", "SUSH", "SUSO", "SXCI", "TABL", "TOBJ", "TRAN", "TTYP", "TYPE", "VCLS", "VIEW", "W3MI", "XSLT", "ZN01", "ZN02", "ZN03", "ZN04", "ZN05", "ZN06", "ZN07", "ZN08", "ZN09", "ZN10", "ZN11", "ZN12", "ZN13", "ZN14", "ZN15", "ZN16", "ZN17", "ZN18", "ZN19", "ZN20", "ZN21", "ZN22", ], }, "unknown_types": true, "ambiguous_statement": true, "implement_methods": true, "begin_end_names": true, "check_syntax": true, "form_no_dash": true, "forbidden_identifier": { "check": [], }, }, }; // todo, make sure nothing is overloaded, eg "lines()", there is a rule for this in abaplint now // hmm this ^ is okay? since lines will be prefixed with "abap.builtin"? class Validation { options; constructor(options) { this.options = options; } run(reg) { if (this.options?.ignoreSyntaxCheck === true) { exports.config.rules["check_syntax"] = false; } else { exports.config.rules["check_syntax"] = true; } exports.config.rules["forbidden_identifier"]["check"] = ["^unique\\d+$"]; if (this.options?.unknownTypes === types_1.UnknownTypesEnum.runtimeError) { // this is not a constant, just a regex that happens to not match anything exports.config.syntax.errorNamespace = "VOID_EVERYTHING"; } if (this.options?.skipVersionCheck === true) { // todo, set it to abaplint default version exports.config.syntax.version = core_1.Version.v758; } else { exports.config.syntax.version = core_1.Version.OpenABAP; } const conf = new core_1.Config(JSON.stringify(exports.config)); reg.setConfig(conf); const issues = reg.findIssues(); return issues; } } exports.Validation = Validation; //# sourceMappingURL=validation.js.map