From de0b91cd5ade86ac1e4e4ad0eb86ee5dfeb15172 Mon Sep 17 00:00:00 2001 From: JP Simard Date: Thu, 13 Oct 2022 02:23:24 -0400 Subject: [PATCH] Print violations in realtime if progress with an output file (#4362) --- CHANGELOG.md | 3 +++ Source/swiftlint/Helpers/LintOrAnalyzeCommand.swift | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54b6982fc..1dd3a4671 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -146,6 +146,9 @@ only differ in trivia. [SimplyDanny](https://github.com/SimplyDanny) +* Print violations in realtime if `--progress` and `--output` are both set. + [JP Simard](https://github.com/jpsim) + #### Bug Fixes * Respect `validates_start_with_lowercase` option when linting function names. diff --git a/Source/swiftlint/Helpers/LintOrAnalyzeCommand.swift b/Source/swiftlint/Helpers/LintOrAnalyzeCommand.swift index f8a80682f..e076a1a95 100644 --- a/Source/swiftlint/Helpers/LintOrAnalyzeCommand.swift +++ b/Source/swiftlint/Helpers/LintOrAnalyzeCommand.swift @@ -272,7 +272,7 @@ private class LintOrAnalyzeResultBuilder { } func report(violations: [StyleViolation], realtimeCondition: Bool) { - if (reporter.isRealtime && !options.progress) == realtimeCondition { + if (reporter.isRealtime && (!options.progress || options.output != nil)) == realtimeCondition { let report = reporter.generateReport(violations) if !report.isEmpty { options.writeToOutput(report)