Skip to content

Commit 7275d90

Browse files
committed
Emit unmodified source if allDisabled is true.
1 parent 1009582 commit 7275d90

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
@@ -106,6 +106,12 @@ public final class SwiftFormatter {
106106
// also does not touch an empty file even if the setting to add trailing newlines is enabled.)
107107
guard !source.isEmpty else { return }
108108

109+
// If allDisabled is set, just emit the source as-is.
110+
guard !configuration.allDisabled else {
111+
outputStream.write(source)
112+
return
113+
}
114+
109115
let sourceFile = try parseAndEmitDiagnostics(
110116
source: source,
111117
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)