Skip to content
This repository was archived by the owner on Apr 10, 2024. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 21 additions & 10 deletions src/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,23 +115,29 @@ export class Report {

output(): void {
for (const issue of this.issues) {
const properties: {[key: string]: string | number} = {}
if (issue.Severity === 'notice') {
continue; // Skip the issue if it's a notice
}

properties['file'] = issue.FilePath
const properties: {[key: string]: string | number} = {};
properties['file'] = issue.FilePath;
if (issue.Line) {
properties['line'] = issue.Line
properties['col'] = issue.Column
properties['line'] = issue.Line;
properties['col'] = issue.Column;
}

issueCommand(issue.Severity, properties, issue.output())
// Issue command for non-notice issues
issueCommand(issue.Severity, properties, issue.output());
}
}


issueOverThresholdIsExists(minimumSeverity: string): boolean {
const errorTarget = this.switchErrorTarget(minimumSeverity)
const errorTarget = this.switchErrorTarget(minimumSeverity);
return this.issues.some(i => i.Severity !== 'notice' && errorTarget.indexOf(i.Severity) !== -1);
}


return this.issues.filter(i => errorTarget.includes(i.Severity)).length > 0
}

private switchErrorTarget(minimumSeverity: string): Severity[] {
if (minimumSeverity === 'error') {
Expand All @@ -140,6 +146,11 @@ export class Report {
if (minimumSeverity === 'warning') {
return ['warning', 'error']
}
return ['notice', 'warning', 'error']
}
if (minimumSeverity === 'notice') {
return ['notice', 'warning', 'error']
}
return ['warning', 'error']
}

}