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 65 66 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 11654x 11654x 11654x 11654x 34800x 34800x 34800x 34800x 34800x 34800x 34800x 11654x 11654x 11142x 11142x 11654x 11654x 239x 239x 11654x 11654x 253x 253x 253x 253x 253x 252x 252x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 11654x | import {Issue} from "../issue";
import {ABAPRule} from "./_abap_rule";
import {Version} from "../version";
import {Target} from "../abap/2_statements/expressions";
import {BasicRuleConfig} from "./_basic_rule_config";
import {RuleTag} from "./_irule";
import {ABAPFile} from "../abap/abap_file";
export class InlineDataOldVersionsConf extends BasicRuleConfig {
}
export class InlineDataOldVersions extends ABAPRule {
private conf = new InlineDataOldVersionsConf();
public getMetadata() {
return {
key: "inline_data_old_versions",
title: "Inline data, old versions",
shortDescription: `Checks for inline data declarations in older releases. Only active for versions less than v740sp02`,
tags: [RuleTag.Syntax, RuleTag.SingleFile],
};
}
public getConfig() {
return this.conf;
}
public setConfig(conf: InlineDataOldVersionsConf) {
this.conf = conf;
}
public runParsed(file: ABAPFile) {
const issues: Issue[] = [];
if (this.reg.getConfig().getVersion() >= Version.v740sp02
|| this.reg.getConfig().getVersion() === Version.OpenABAP
|| this.reg.getConfig().getVersion() === Version.Cloud) {
return [];
}
for (const statement of file.getStatements()) {
// when parsed in old versions these expressions are NOT InlineData
for (const target of statement.findAllExpressions(Target)) {
const tokens = target.getAllTokens();
if (tokens.length !== 4) {
continue;
}
if (!tokens[0].getStr().match(/DATA/i)) {
continue;
}
if (tokens[1].getStr() !== "(") {
continue;
}
if (tokens[3].getStr() !== ")") {
continue;
}
const message = "Inline DATA not possible in " + this.reg.getConfig().getVersion();
const issue = Issue.atToken(file, tokens[0], message, this.getMetadata().key, this.conf.severity);
issues.push(issue);
}
}
return issues;
}
} |