@abaplint/core
Version:
abaplint - Core API
60 lines • 2.34 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CheckTransformationExists = exports.CheckTransformationExistsConf = void 0;
const issue_1 = require("../issue");
const _abap_rule_1 = require("./_abap_rule");
const _basic_rule_config_1 = require("./_basic_rule_config");
const statements_1 = require("../abap/2_statements/statements");
const expressions_1 = require("../abap/2_statements/expressions");
const _irule_1 = require("./_irule");
class CheckTransformationExistsConf extends _basic_rule_config_1.BasicRuleConfig {
}
exports.CheckTransformationExistsConf = CheckTransformationExistsConf;
class CheckTransformationExists extends _abap_rule_1.ABAPRule {
constructor() {
super(...arguments);
this.conf = new CheckTransformationExistsConf();
}
getMetadata() {
return {
key: "check_transformation_exists",
title: "Check transformation exists",
shortDescription: `Checks that used XSLT transformations exist.`,
tags: [_irule_1.RuleTag.Syntax],
};
}
getDescription(name) {
return "Transformation \"" + name + "\" not found";
}
getConfig() {
return this.conf;
}
setConfig(conf) {
this.conf = conf;
}
runParsed(file) {
const output = [];
const struc = file.getStructure();
if (struc === undefined) {
return [];
}
for (const s of file.getStatements()) {
if (s.get() instanceof statements_1.CallTransformation) {
const nameExpression = s.findFirstExpression(expressions_1.NamespaceSimpleName);
if (nameExpression === undefined) {
continue;
}
const tok = nameExpression.getFirstToken();
const name = tok.getStr();
if (this.reg.inErrorNamespace(name) === true
&& this.reg.getObject("XSLT", name) === undefined) {
const issue = issue_1.Issue.atToken(file, tok, this.getDescription(name), this.getMetadata().key);
output.push(issue);
}
}
}
return output;
}
}
exports.CheckTransformationExists = CheckTransformationExists;
//# sourceMappingURL=check_transformation_exists.js.map