Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 11290x 11290x 11290x 11290x 11290x 33693x 33693x 33693x 33693x 33693x 33693x 33693x 33693x 11290x 11290x 242x 242x 242x 11290x 11290x 10789x 10789x 11290x 11290x 229x 229x 11290x 11290x 308x 308x 308x 308x 308x 64x 64x 244x 244x 244x 11290x 11290x 64x 64x 64x 64x 64x 19x 19x 19x 45x 45x 45x 11290x 11290x | import {IRule, IRuleMetadata} from "./_irule";
import {Issue} from "../issue";
import * as Objects from "../objects";
import {IObject} from "../objects/_iobject";
import {IRegistry} from "../_iregistry";
import {BasicRuleConfig} from "./_basic_rule_config";
export class UnusedDDICConf extends BasicRuleConfig {
}
export class UnusedDDIC implements IRule {
private reg: IRegistry;
private conf = new UnusedDDICConf();
public getMetadata(): IRuleMetadata {
return {
key: "unused_ddic",
title: "Unused DDIC",
shortDescription: `Checks the usage of DDIC objects`,
extendedInformation: `Objects checked: DOMA + DTEL + TABL + TTYP + VIEW`,
tags: [],
};
}
public initialize(reg: IRegistry) {
this.reg = reg;
return this;
}
public getConfig() {
return this.conf;
}
public setConfig(conf: UnusedDDICConf) {
this.conf = conf;
}
public run(obj: IObject): Issue[] {
if (obj instanceof Objects.Domain
|| obj instanceof Objects.TableType
|| obj instanceof Objects.View
|| obj instanceof Objects.Table
|| obj instanceof Objects.DataElement) {
return this.check(obj);
}
return [];
}
private check(obj: IObject): Issue[] {
const id = obj.getIdentifier();
const refs = this.reg.getDDICReferences();
const list = refs.listWhereUsed(obj);
if (id && list.length === 0) {
const message = obj.getType() + " " + obj.getName() + " not statically referenced";
return [Issue.atIdentifier(id, message, this.getMetadata().key, this.conf.severity)];
}
return [];
}
} |