mirror of
https://github.com/nicklockwood/SwiftFormat.git
synced 2026-05-17 10:30:35 +00:00
Fix linting with stdin (#1744)
This commit is contained in:
committed by
Nick Lockwood
parent
16840ac265
commit
bb0a3acaab
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user