Skip to content

Commit b62635c

Browse files
committed
skip log event for no suppressed violations
1 parent ff2afe3 commit b62635c

3 files changed

Lines changed: 6 additions & 15 deletions

File tree

packages/code-analyzer-core/src/code-analyzer.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -412,12 +412,8 @@ export class CodeAnalyzer {
412412
// Note: Inline suppressions are now applied per-engine in runEngineAndValidateResults() before EngineResultsEvent is emitted
413413

414414
// Log aggregate suppression count if any violations were suppressed
415-
if (this.config.getSuppressionsEnabled()) {
416-
if (this.totalSuppressedViolations > 0) {
417-
this.emitLogEvent(LogLevel.Info, getMessage('SuppressedViolationsCount', this.totalSuppressedViolations));
418-
} else {
419-
this.emitLogEvent(LogLevel.Info, getMessage('NoViolationsSuppressed'));
420-
}
415+
if (this.config.getSuppressionsEnabled() && this.totalSuppressedViolations > 0) {
416+
this.emitLogEvent(LogLevel.Info, getMessage('SuppressedViolationsCount', this.totalSuppressedViolations));
421417
}
422418

423419
return runResults;

packages/code-analyzer-core/src/messages.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,7 @@ const MESSAGE_CATALOG : MessageCatalog = {
240240
`Since the engine '%s' emitted an error, the following temporary working folder will not be removed: %s`,
241241

242242
SuppressedViolationsCount:
243-
`%d violation(s) were suppressed by inline suppression markers.`,
244-
245-
NoViolationsSuppressed:
246-
`No violations were suppressed by inline suppression markers.`
243+
`%d violation(s) were suppressed by inline suppression markers.`
247244
}
248245

249246
/**

packages/code-analyzer-core/test/per-engine-suppressions.test.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ describe('Per-Engine Suppression Processing', () => {
163163
expect(suppressionLog).toBeDefined();
164164
});
165165

166-
it('should log "No violations were suppressed" when no suppressions apply', async () => {
166+
it('should not log suppression message when no suppressions apply', async () => {
167167
// Setup
168168
const config = CodeAnalyzerConfig.fromObject({
169169
suppressions: { disable_suppressions: false },
@@ -201,9 +201,7 @@ describe('Per-Engine Suppression Processing', () => {
201201
const ruleSelection = await codeAnalyzer.selectRules(['stubEngine1'], { workspace });
202202
await codeAnalyzer.run(ruleSelection, { workspace });
203203

204-
// Verify "No violations were suppressed" log was emitted
205-
expect(logEvents.length).toBeGreaterThan(0);
206-
const noSuppressionLog = logEvents.find(e => e.message.includes('No violations were suppressed'));
207-
expect(noSuppressionLog).toBeDefined();
204+
// Verify no suppression log was emitted (since no violations were suppressed)
205+
expect(logEvents.length).toBe(0);
208206
});
209207
});

0 commit comments

Comments
 (0)