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 67 68 69 70 71 72 73 74 75 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 11000x 11000x 11000x 11000x 32797x 32797x 32797x 32797x 32797x 32797x 32797x 32797x 32797x 32797x 11000x 11000x 10444x 10444x 11000x 11000x 260x 260x 11000x 11000x 276x 276x 276x 276x 270x 270x 6x 6x 276x 6x 276x 5x 5x 2x 2x 5x 6x 6x 6x 6x 3x 3x 3x 6x 6x 3x 3x 3x 3x 6x 3x 6x 6x 6x 11000x 11000x | import * as Expressions from "../abap/2_statements/expressions"; import {Issue} from "../issue"; import {ABAPRule} from "./_abap_rule"; import {BasicRuleConfig} from "./_basic_rule_config"; import {RuleTag, IRuleMetadata} from "./_irule"; import {ABAPFile} from "../abap/abap_file"; import {Version} from "../version"; export class Parser702ChainingConf extends BasicRuleConfig { } export class Parser702Chaining extends ABAPRule { private conf = new Parser702ChainingConf(); public getMetadata(): IRuleMetadata { return { key: "parser_702_chaining", title: "Parser Error, bad chanining on 702", shortDescription: `ABAP on 702 does not allow for method chaining with IMPORTING/EXPORTING/CHANGING keywords, this rule finds these and reports errors. Only active on target version 702 and below.`, tags: [RuleTag.Syntax, RuleTag.SingleFile], }; } public getConfig() { return this.conf; } public setConfig(conf: Parser702ChainingConf) { this.conf = conf; } public runParsed(file: ABAPFile) { const issues: Issue[] = []; if (this.reg.getConfig().getVersion() !== Version.v702 && this.reg.getConfig().getVersion() !== Version.v700) { return []; } const stru = file.getStructure(); if (stru === undefined) { return []; } for (const chain of stru.findAllExpressions(Expressions.MethodCallChain)) { const calls = chain.findDirectExpressions(Expressions.MethodCall); if (calls.length < 2) { continue; } for (const call of calls) { const callParam = call.findDirectExpression(Expressions.MethodCallParam); if (callParam === undefined) { continue; } const param = callParam.findDirectExpression(Expressions.MethodParameters); if (param === undefined) { continue; } if (param.findDirectTokenByText("IMPORTING") || param.findDirectTokenByText("CHANGING") || param.findDirectTokenByText("EXCEPTIONS")) { const message = "This kind of method chaining not possible in 702"; const issue = Issue.atPosition(file, param.getFirstToken().getStart(), message, this.getMetadata().key, this.conf.severity); issues.push(issue); } } } return issues; } } |