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 1x 1x 1x 11307x 11307x 11307x 11307x 11307x 33820x 33820x 33820x 33820x 33820x 33820x 11307x 11307x 62x 62x 11307x 11307x 10810x 10810x 11307x 11307x 232x 232x 11307x 11307x 235x 235x 11307x 11307x 304x 304x 304x 71x 71x 71x 1x 71x 61x 61x 71x 62x 62x 62x 62x 71x 304x 304x 304x 11307x 11307x | import {Issue} from "../issue";
import {IRule} from "./_irule";
import {IObject} from "../objects/_iobject";
import {Class, Interface} from "../objects";
import {IRegistry} from "../_iregistry";
import {BasicRuleConfig} from "./_basic_rule_config";
import {Position} from "../position";
// standard class CL_OO_CLASS assumes classes have descriptions
export class DescriptionEmptyConf extends BasicRuleConfig {
}
export class DescriptionEmpty implements IRule {
private conf = new DescriptionEmptyConf();
public getMetadata() {
return {
key: "description_empty",
title: "Description in class must exist",
shortDescription: `Ensures descriptions in class metadata exist.`,
};
}
private getDescription(name: string): string {
return "Description empty in " + name;
}
public getConfig() {
return this.conf;
}
public setConfig(conf: DescriptionEmptyConf) {
this.conf = conf;
}
public initialize(_reg: IRegistry) {
return this;
}
public run(obj: IObject): Issue[] {
const issues: Issue[] = [];
if (obj instanceof Class || obj instanceof Interface) {
const description = obj.getDescription();
let message: string | undefined = undefined;
if (description === "") {
message = this.getDescription(obj.getName());
} else if (description === undefined) {
message = this.getDescription(obj.getName() + ", class XML file not found") ;
}
if (message) {
const position = new Position(1, 1);
const issue = Issue.atPosition(obj.getFiles()[0], position, message, this.getMetadata().key, this.conf.severity);
issues.push(issue);
}
}
return issues;
}
} |