@abaplint/core
Version:
abaplint - Core API
60 lines (59 loc) • 2.1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.NROBConsistency = exports.NROBConsistencyConf = void 0;
const _irule_1 = require("./_irule");
const issue_1 = require("../issue");
const Objects = require("../objects");
const _basic_rule_config_1 = require("./_basic_rule_config");
class NROBConsistencyConf extends _basic_rule_config_1.BasicRuleConfig {
}
exports.NROBConsistencyConf = NROBConsistencyConf;
class NROBConsistency {
constructor() {
this.conf = new NROBConsistencyConf();
}
getMetadata() {
return {
key: "nrob_consistency",
title: "Number range consistency",
shortDescription: `Consistency checks for number ranges`,
extendedInformation: `Issue reported if percentage warning is over 50%
Issue reported if the referenced domain is not found(taking error namespace into account)`,
tags: [_irule_1.RuleTag.SingleFile],
};
}
getConfig() {
return this.conf;
}
setConfig(conf) {
this.conf = conf;
}
initialize(reg) {
this.reg = reg;
return this;
}
run(obj) {
if (!(obj instanceof Objects.NumberRange)) {
return [];
}
const issues = [];
const id = obj.getIdentifier();
if (id === undefined) {
return [];
}
if (obj.getPercentage() || 0 > 50) {
const message = "Percentage more than 50";
issues.push(issue_1.Issue.atIdentifier(id, message, this.getMetadata().key, this.getConfig().severity));
}
const domain = obj.getDomain();
if (domain
&& this.reg.getObject("DOMA", domain) === undefined
&& this.reg.inErrorNamespace(domain) === true) {
const message = "Domain " + domain + " not found";
issues.push(issue_1.Issue.atIdentifier(id, message, this.getMetadata().key, this.getConfig().severity));
}
return [];
}
}
exports.NROBConsistency = NROBConsistency;
//# sourceMappingURL=nrob_consistency.js.map