Skip to content

Commit 8bade83

Browse files
committed
Emit unmodified source if allDisabled is true.
1 parent 3e4c5d2 commit 8bade83

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Sources/SwiftFormat/API/SwiftFormatter.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ public final class SwiftFormatter {
111111
// also does not touch an empty file even if the setting to add trailing newlines is enabled.)
112112
guard !source.isEmpty else { return }
113113

114+
// If allDisabled is set, just emit the source as-is.
115+
guard !configuration.allDisabled else {
116+
outputStream.write(source)
117+
return
118+
}
119+
114120
let sourceFile = try parseAndEmitDiagnostics(
115121
source: source,
116122
operatorTable: .standardOperators,

Sources/swift-format/Frontend/Frontend.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,6 @@ class Frontend {
182182
return nil
183183
}
184184

185-
guard !configuration.allDisabled else {
186-
// Formatting is suppressed for this file.
187-
return nil
188-
}
189-
190185
return FileToProcess(
191186
fileHandle: sourceFile,
192187
url: url,

0 commit comments

Comments
 (0)