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 1x 10997x 10997x 10997x 10997x 32795x 32795x 32795x 32795x 32795x 32795x 32795x 32795x 32795x 32795x 32795x 32795x 32795x 32795x 10997x 10997x 10445x 10445x 10997x 10997x 260x 260x 10997x 10997x 263x 263x 10997x 10997x 329x 329x 329x 329x 5x 5x 5x 5x 79x 1x 1x 79x 5x 329x 329x 329x 10997x 10997x | import {Issue} from "../issue"; import {IRule, IRuleMetadata, RuleTag} from "./_irule"; import {IObject} from "../objects/_iobject"; import {IRegistry} from "../_iregistry"; import {BasicRuleConfig} from "./_basic_rule_config"; import {CDSMetadataExtension, DataDefinition} from "../objects"; import {CDSLexer} from "../cds/cds_lexer"; import {Comment} from "../abap/1_lexer/tokens"; export class CDSCommentStyleConf extends BasicRuleConfig { } export class CDSCommentStyle implements IRule { private conf = new CDSCommentStyleConf(); public getMetadata(): IRuleMetadata { return { key: "cds_comment_style", title: "CDS Comment Style", shortDescription: `Check for obsolete comment style`, extendedInformation: `Check for obsolete comment style Comments starting with "--" are considered obsolete https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abencds_general_syntax_rules.htm`, tags: [RuleTag.SingleFile], badExample: "-- this is a comment", goodExample: "// this is a comment", }; } public getConfig() { return this.conf; } public setConfig(conf: CDSCommentStyleConf) { this.conf = conf; } public initialize(_reg: IRegistry): IRule { return this; } public run(object: IObject): Issue[] { const issues: Issue[] = []; if ((object.getType() === "DDLS" && object instanceof DataDefinition) || (object.getType() === "DDLX" && object instanceof CDSMetadataExtension)) { const file = object.findSourceFile(); if (file === undefined) { return issues; } const tokens = CDSLexer.run(file); for (const t of tokens) { if (t instanceof Comment && t.getStr().startsWith("--")) { issues.push(Issue.atToken(file, t, `Use "//" for comments instead of "--"`, this.getMetadata().key, this.getConfig().severity)); } } } return issues; } } |