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 21102x 21102x 21102x 21102x 184283x 184283x 184283x 184283x 184283x 184283x 184283x 184283x 184283x 184283x 21102x 21102x 383x 383x 21102x 21102x 20205x 20205x 21102x 21102x 374x 374x 21102x 21102x 593x 593x 593x 13x 13x 580x 593x 635x 635x 609x 609x 609x 7355x 2x 2x 2x 2x 2x 7355x 609x 635x 580x 580x 580x 21102x 21102x | import {Issue} from "../issue";
import {BasicRuleConfig} from "./_basic_rule_config";
import {IObject} from "../objects/_iobject";
import {IRule, IRuleMetadata, RuleTag} from "./_irule";
import {IRegistry} from "../_iregistry";
import {MIMEObject, WebMIME} from "../objects";
export class LineBreakStyleConf extends BasicRuleConfig {
}
export class LineBreakStyle implements IRule {
private conf = new LineBreakStyleConf();
public getMetadata(): IRuleMetadata {
return {
key: "line_break_style",
title: "Makes sure line breaks are consistent",
shortDescription: `Enforces LF as newlines in ABAP and XML files
abapGit does not work with CRLF`,
extendedInformation: `SMIM and W3MI files are not checked.`,
tags: [RuleTag.Whitespace, RuleTag.SingleFile],
};
}
public initialize(_reg: IRegistry) {
return this;
}
public getConfig() {
return this.conf;
}
public setConfig(conf: LineBreakStyleConf) {
this.conf = conf;
}
public run(obj: IObject): Issue[] {
const output: Issue[] = [];
if (obj instanceof MIMEObject || obj instanceof WebMIME) {
return output;
}
for (const file of obj.getFiles()) {
const filename = file.getFilename();
if (filename.endsWith(".abap") || filename.endsWith(".xml")) {
if (filename.endsWith(".xslt.source.xml")) {
continue;
}
const rows = file.getRawRows();
for (let i = 0; i < rows.length; i++) {
if (rows[i].endsWith("\r") === true) {
const message = "Line contains carriage return";
const issue = Issue.atRow(file, i + 1, message, this.getMetadata().key, this.conf.severity);
output.push(issue);
break; // only one finding per file
}
}
}
}
return output;
}
} |