Fix linting with stdin (#1744)

This commit is contained in:
Jake Langford
2024-06-29 08:36:13 +01:00
committed by Nick Lockwood
parent 16840ac265
commit bb0a3acaab
+9 -2
View File
@@ -707,9 +707,16 @@ func processArguments(_ args: [String], environment: [String: String] = [:], in
if !dryrun, (try? String(contentsOf: outputURL)) != output {
try write(output, to: outputURL)
}
} else {
} else if !lint {
// Write to stdout
print(dryrun ? input : output, as: .raw)
} else if let reporterOutput = try reporter.write() {
if let reportURL = reportURL {
print("Writing report file to \(reportURL.path)", as: .info)
try reporterOutput.write(to: reportURL, options: .atomic)
} else {
print(String(decoding: reporterOutput, as: UTF8.self), as: .raw)
}
}
let exitCode: ExitCode
if lint, output != input {
@@ -794,7 +801,7 @@ func processArguments(_ args: [String], environment: [String: String] = [:], in
}
if let reporterOutput = try reporter.write() {
if let reportURL = reportURL {
print("Writing report file to \(reportURL.path)")
print("Writing report file to \(reportURL.path)", as: .info)
try reporterOutput.write(to: reportURL, options: .atomic)
} else {
print(String(decoding: reporterOutput, as: UTF8.self), as: .raw)