UNPKG

@abaplint/core

Version:
56 lines 1.93 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.IdenticalFormNames = exports.IdenticalFormNamesConf = void 0; const issue_1 = require("../issue"); const _irule_1 = require("./_irule"); const _basic_rule_config_1 = require("./_basic_rule_config"); const _abap_object_1 = require("../objects/_abap_object"); class IdenticalFormNamesConf extends _basic_rule_config_1.BasicRuleConfig { } exports.IdenticalFormNamesConf = IdenticalFormNamesConf; // todo: deprecation candidate? this is/should be handled by the syntax check? class IdenticalFormNames { constructor() { this.conf = new IdenticalFormNamesConf(); } getMetadata() { return { key: "identical_form_names", title: "Identical FORM names", shortDescription: `Detects identically named FORMs`, tags: [_irule_1.RuleTag.Syntax], }; } getConfig() { return this.conf; } setConfig(conf) { this.conf = conf; } initialize(_reg) { return this; } run(obj) { if (!(obj instanceof _abap_object_1.ABAPObject)) { return []; } const ret = []; const found = []; for (const file of obj.getABAPFiles()) { for (const form of file.getInfo().listFormDefinitions()) { const name = form.name.toUpperCase(); if (found.indexOf(name) >= 0) { const message = "Identical FORM Names: \"" + name + "\""; const issue = issue_1.Issue.atIdentifier(form.identifier, message, this.getMetadata().key, this.conf.severity); ret.push(issue); } else { found.push(name); } } } return ret; } } exports.IdenticalFormNames = IdenticalFormNames; //# sourceMappingURL=identical_form_names.js.map