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 64 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 11064x 11064x 11064x 11064x 33037x 33037x 33037x 33037x 33037x 33037x 33037x 11064x 11064x 1x 1x 11064x 11064x 10540x 10540x 11064x 11064x 244x 244x 11064x 11064x 268x 268x 268x 268x 13x 13x 255x 268x 1463x 4x 4x 1x 1x 3x 3x 3x 4x 1x 1x 1x 4x 1463x 255x 255x 255x 11064x 11064x | import {Issue} from "../issue";
import {ABAPRule} from "./_abap_rule";
import {BasicRuleConfig} from "./_basic_rule_config";
import {CallTransformation} from "../abap/2_statements/statements";
import {NamespaceSimpleName} from "../abap/2_statements/expressions";
import {RuleTag} from "./_irule";
import {ABAPFile} from "../abap/abap_file";
export class CheckTransformationExistsConf extends BasicRuleConfig {
}
export class CheckTransformationExists extends ABAPRule {
private conf = new CheckTransformationExistsConf();
public getMetadata() {
return {
key: "check_transformation_exists",
title: "Check transformation exists",
shortDescription: `Checks that used XSLT transformations exist.`,
tags: [RuleTag.Syntax],
};
}
private getDescription(name: string): string {
return "Transformation \"" + name + "\" not found";
}
public getConfig() {
return this.conf;
}
public setConfig(conf: CheckTransformationExistsConf) {
this.conf = conf;
}
public runParsed(file: ABAPFile) {
const output: Issue[] = [];
const struc = file.getStructure();
if (struc === undefined) {
return [];
}
for (const s of file.getStatements()) {
if (s.get() instanceof CallTransformation) {
const nameExpression = s.findFirstExpression(NamespaceSimpleName);
if (nameExpression === undefined) {
continue;
}
const tok = nameExpression.getFirstToken();
const name = tok.getStr();
if (this.reg.inErrorNamespace(name) === true
&& this.reg.getObject("XSLT", name) === undefined) {
const issue = Issue.atToken(file, tok, this.getDescription(name), this.getMetadata().key);
output.push(issue);
}
}
}
return output;
}
}
|