File: Sources/Xproject/Services/PRReportService.swift
Lines: 758-778
PRReviewReporter is instantiated twice in both branches of the conditional. This can be simplified:
// Current (duplicated):
if config.inlineAnnotations {
let reviewReporter = PRReviewReporter(...)
if !annotations.isEmpty {
_ = try await reviewReporter.report(annotations)
} else {
try await reviewReporter.cleanup()
}
} else {
let reviewReporter = PRReviewReporter(...)
try await reviewReporter.cleanup()
}
// Suggested (simplified):
let reviewReporter = PRReviewReporter(
context: context,
identifier: identifier,
outOfRangeStrategy: .fallbackToComment
)
if config.inlineAnnotations && !annotations.isEmpty {
_ = try await reviewReporter.report(annotations)
} else {
try await reviewReporter.cleanup()
}
Originally identified in PR #29.
File:
Sources/Xproject/Services/PRReportService.swiftLines: 758-778
PRReviewReporteris instantiated twice in both branches of the conditional. This can be simplified:Originally identified in PR #29.