UNPKG

@abaplint/core

Version:
49 lines 1.76 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CDSParserError = exports.CDSParserErrorConf = void 0; const issue_1 = require("../issue"); const _irule_1 = require("./_irule"); const _basic_rule_config_1 = require("./_basic_rule_config"); const objects_1 = require("../objects"); class CDSParserErrorConf extends _basic_rule_config_1.BasicRuleConfig { } exports.CDSParserErrorConf = CDSParserErrorConf; class CDSParserError { constructor() { this.conf = new CDSParserErrorConf(); } getMetadata() { return { key: "cds_parser_error", title: "CDS Parser Error", shortDescription: `CDS parsing`, extendedInformation: `Parses CDS and issues parser errors`, tags: [_irule_1.RuleTag.Syntax], }; } getConfig() { return this.conf; } setConfig(conf) { this.conf = conf; } initialize(_reg) { return this; } run(object) { const issues = []; if ((object.getType() === "DDLS" && object instanceof objects_1.DataDefinition) || (object.getType() === "DDLX" && object instanceof objects_1.CDSMetadataExtension)) { const hasError = object.hasParserError(); const file = object.findSourceFile(); if (hasError === true && file) { const empty = file.getRaw().length === 0 ? ", empty file" : ""; const message = "CDS Parser error" + empty; issues.push(issue_1.Issue.atRow(file, 1, message, this.getMetadata().key, this.getConfig().severity)); } } return issues; } } exports.CDSParserError = CDSParserError; //# sourceMappingURL=cds_parser_error.js.map