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 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 20232x 20232x 20232x 20232x 20232x 99328x 99328x 99328x 99328x 99328x 99328x 99328x 20232x 20232x 19366x 19366x 20232x 20232x 418x 418x 418x 20232x 20232x 360x 360x 20232x 20232x 613x 206x 206x 407x 407x 407x 407x 407x 613x 1x 1x 1x 1x 1x 1x 407x 407x 407x 20232x 20232x | import {IRegistry} from "../_iregistry";
import {SyntaxLogic} from "../abap/5_syntax/syntax";
import {BasicRuleConfig} from "./_basic_rule_config";
import {IObject} from "../objects/_iobject";
import {ABAPObject} from "../objects/_abap_object";
import {Issue} from "../issue";
import {RuleTag, IRuleMetadata, IRule} from "./_irule";
import {Severity} from "../severity";
import {CheckSyntaxKey} from "../abap/5_syntax/_syntax_input";
export class CheckSyntaxConf extends BasicRuleConfig {
}
export class CheckSyntax implements IRule {
private reg: IRegistry;
private conf = new CheckSyntaxConf();
public getMetadata(): IRuleMetadata {
return {
key: CheckSyntaxKey,
title: "Check syntax",
shortDescription: `Enables syntax check and variable resolution`,
tags: [RuleTag.Syntax],
};
}
public getConfig() {
return this.conf;
}
public initialize(reg: IRegistry) {
this.reg = reg;
return this;
}
public setConfig(conf: CheckSyntaxConf) {
this.conf = conf;
}
public run(obj: IObject): Issue[] {
if (!(obj instanceof ABAPObject)) {
return [];
}
const issues = new SyntaxLogic(this.reg, obj).run().issues;
// the syntax logic does not know the rule severity when its run
if (this.conf.severity
&& this.conf.severity !== Severity.Error) {
issues.forEach((value: Issue, index: number) => {
const data = value.getData();
data.severity = this.conf.severity!;
issues[index] = new Issue(data);
});
}
return issues;
}
} |