Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
saponas committed Jul 20, 2018
1 parent 6af8f99 commit 1563539
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/client/linters/baseLinter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,21 +149,23 @@ export abstract class BaseLinter implements ILinter {
}

private parseLines(outputLines: string[], regEx: string): ILintMessage[] {
return outputLines
.filter((value, index) => index <= this.pythonSettings.linting.maxNumberOfProblems)
.map(line => {
try {
const msg = this.parseLine(line, regEx);
if (msg) {
return msg;
}
} catch (ex) {
this.logger.logError(`Linter '${this.info.id}' failed to parse the line '${line}.`, ex);
const messages: ILintMessage[] = [];
let messageCount: number = 0;
let i: number;
for (i = messageCount; i < outputLines.length && messageCount < this.pythonSettings.linting.maxNumberOfProblems; i += 1)
{
const line = outputLines[i];
try {
const msg = this.parseLine(line, regEx);
if (msg) {
messages.push(msg);
messageCount += 1;
}
return;
})
.filter(item => item !== undefined)
.map(item => item!);
} catch (ex) {
this.logger.logError(`Linter '${this.info.id}' failed to parse the line '${line}.`, ex);
}
}
return messages;
}

private displayLinterResultHeader(data: string) {
Expand Down

0 comments on commit 1563539

Please sign in to comment.