Skip to content

Commit c56057a

Browse files
committed
style(jobs): address the analyzer findings this PR introduced
S6667 (log in a catch should pass the caught exception) fired on the two cancellation logs — the deadline warning now has the exception in scope, so pass it; it also records where the run was when it was cut off. CA1861 (constant array argument) on the new store assertion. The remaining Sonar issues on ReportRunner.cs (S107/S125/IDE0008) sit on pre-existing lines this PR never touched and are left alone.
1 parent 242a5d8 commit c56057a

3 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/Jobs/NeoReports.Jobs/ReportJobWorker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public async Task RunAsync(
9393
// tripped and we still need to record the terminal state.
9494
await _store.UpdateStatusAsync(jobId, ReportJobStatus.Cancelled, reason, CancellationToken.None)
9595
.ConfigureAwait(false);
96-
_logger.LogInformation("Job {JobId} for report {Report} was cancelled ({Reason}).", jobId, reportName, reason);
96+
_logger.LogInformation(ex, "Job {JobId} for report {Report} was cancelled ({Reason}).", jobId, reportName, reason);
9797
}
9898
catch (Exception ex)
9999
{

src/NeoReports.Core/Pipeline/ReportRunner.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public async Task<ReportRunResult> RunAsync(
7070
catch (OperationCanceledException ex) when (deadlineCts is { IsCancellationRequested: true } && !cancellationToken.IsCancellationRequested)
7171
{
7272
logger.LogWarning(
73+
ex,
7374
"Report {Report} (job {JobId}) exceeded its {Deadline} deadline and was cancelled.",
7475
report.Name, jobId, report.Deadline);
7576
// Rethrown as a deadline-specific OperationCanceledException: the caller's own token is

tests/NeoReports.Core.UnitTests/Scheduling/FileScheduleOverrideStoreTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public async Task A_successful_save_leaves_no_temp_file_behind()
109109
// The write is staged through a unique temp file and moved into place; nothing may linger
110110
// (a stray temp would also have to stay out of ListAsync's "*.json" enumeration).
111111
Directory.EnumerateFiles(_directory, "*.tmp").ShouldBeEmpty();
112-
(await store.ListAsync(CancellationToken.None)).Select(x => x.ReportName).ShouldBe(new[] { "alpha" });
112+
(await store.ListAsync(CancellationToken.None)).ShouldHaveSingleItem().ReportName.ShouldBe("alpha");
113113
}
114114

115115
[Fact]

0 commit comments

Comments
 (0)