From fa2b7a1f549743a859320e14b30cf7ab466baef1 Mon Sep 17 00:00:00 2001 From: shay-legit Date: Wed, 27 Mar 2024 16:33:31 +0200 Subject: [PATCH 1/5] fix/ignore-notice-test --- src/report.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/report.ts b/src/report.ts index 975cbc20..6167fa90 100644 --- a/src/report.ts +++ b/src/report.ts @@ -115,6 +115,9 @@ export class Report { output(): void { for (const issue of this.issues) { + if (issue.Severity === 'notice') { + continue; + } const properties: {[key: string]: string | number} = {} properties['file'] = issue.FilePath From 85cf6ed018a96ae2d98a793c023a535e97917aad Mon Sep 17 00:00:00 2001 From: Benjie-legit Date: Mon, 8 Apr 2024 17:02:55 +0300 Subject: [PATCH 2/5] test --- src/report.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/report.ts b/src/report.ts index 6167fa90..30df6134 100644 --- a/src/report.ts +++ b/src/report.ts @@ -115,9 +115,6 @@ export class Report { output(): void { for (const issue of this.issues) { - if (issue.Severity === 'notice') { - continue; - } const properties: {[key: string]: string | number} = {} properties['file'] = issue.FilePath @@ -138,11 +135,16 @@ export class Report { private switchErrorTarget(minimumSeverity: string): Severity[] { if (minimumSeverity === 'error') { - return ['error'] + return ['error']; } if (minimumSeverity === 'warning') { - return ['warning', 'error'] + return ['warning', 'error']; } - return ['notice', 'warning', 'error'] - } + if (minimumSeverity === 'notice') { + return ['notice', 'warning', 'error']; + } + return ['warning', 'error']; } + +} + From bc51a059743b38205e924a2ede6f234b2474b24a Mon Sep 17 00:00:00 2001 From: Benjie-legit Date: Mon, 8 Apr 2024 17:04:05 +0300 Subject: [PATCH 3/5] test --- src/report.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/report.ts b/src/report.ts index 30df6134..0fc35e54 100644 --- a/src/report.ts +++ b/src/report.ts @@ -135,15 +135,15 @@ export class Report { private switchErrorTarget(minimumSeverity: string): Severity[] { if (minimumSeverity === 'error') { - return ['error']; + return ['error'] } if (minimumSeverity === 'warning') { - return ['warning', 'error']; + return ['warning', 'error'] } if (minimumSeverity === 'notice') { - return ['notice', 'warning', 'error']; + return ['notice', 'warning', 'error'] } - return ['warning', 'error']; + return ['warning', 'error'] } } From 360a165ebfb634af1db74ea8e7d2a58c8dbb5af6 Mon Sep 17 00:00:00 2001 From: Benjie-legit Date: Mon, 8 Apr 2024 17:33:22 +0300 Subject: [PATCH 4/5] test --- src/report.ts | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/report.ts b/src/report.ts index 0fc35e54..94f32f05 100644 --- a/src/report.ts +++ b/src/report.ts @@ -114,25 +114,30 @@ export class Report { } output(): void { - for (const issue of this.issues) { - const properties: {[key: string]: string | number} = {} + for (const issue of this.issues) { + if (issue.Severity === 'notice') { + continue; // Skip notices + } - properties['file'] = issue.FilePath - if (issue.Line) { - properties['line'] = issue.Line - properties['col'] = issue.Column - } + const properties: {[key: string]: string | number} = {}; - issueCommand(issue.Severity, properties, issue.output()) + properties['file'] = issue.FilePath; + if (issue.Line) { + properties['line'] = issue.Line; + properties['col'] = issue.Column; } + + issueCommand(issue.Severity, properties, issue.output()); } +} issueOverThresholdIsExists(minimumSeverity: string): boolean { - const errorTarget = this.switchErrorTarget(minimumSeverity) + const errorTarget = this.switchErrorTarget(minimumSeverity); - return this.issues.filter(i => errorTarget.includes(i.Severity)).length > 0 + return this.issues.filter(i => i.Severity !== 'notice' && errorTarget.includes(i.Severity)).length > 0; } + private switchErrorTarget(minimumSeverity: string): Severity[] { if (minimumSeverity === 'error') { return ['error'] From 1e2437020c43a19580380a8fe91ffbdabb852241 Mon Sep 17 00:00:00 2001 From: Benjie-legit Date: Mon, 8 Apr 2024 17:55:16 +0300 Subject: [PATCH 5/5] test --- src/report.ts | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/report.ts b/src/report.ts index 94f32f05..3c991ca6 100644 --- a/src/report.ts +++ b/src/report.ts @@ -114,28 +114,29 @@ export class Report { } output(): void { - for (const issue of this.issues) { - if (issue.Severity === 'notice') { - continue; // Skip notices - } + for (const issue of this.issues) { + if (issue.Severity === 'notice') { + continue; // Skip the issue if it's a notice + } - const properties: {[key: string]: string | number} = {}; + const properties: {[key: string]: string | number} = {}; + properties['file'] = issue.FilePath; + if (issue.Line) { + properties['line'] = issue.Line; + properties['col'] = issue.Column; + } - properties['file'] = issue.FilePath; - if (issue.Line) { - properties['line'] = issue.Line; - properties['col'] = issue.Column; + // Issue command for non-notice issues + issueCommand(issue.Severity, properties, issue.output()); } - - 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 => i.Severity !== 'notice' && errorTarget.includes(i.Severity)).length > 0; - } private switchErrorTarget(minimumSeverity: string): Severity[] {