Skip to content

Commit 3f50c4e

Browse files
authored
Merge pull request swiftlang#155 from dylansturg/quieter_formatting
Don't propagate the diagnostic engine when formatting.
2 parents 70a543a + 3594003 commit 3f50c4e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Sources/swift-format/Run.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ func formatMain(
7777
configuration: Configuration, sourceFile: FileHandle, assumingFilename: String?, inPlace: Bool,
7878
debugOptions: DebugOptions, diagnosticEngine: DiagnosticEngine
7979
) -> Int {
80-
let formatter = SwiftFormatter(configuration: configuration, diagnosticEngine: diagnosticEngine)
80+
// Even though `diagnosticEngine` is defined, it's use is reserved for fatal messages. Pass nil
81+
// to the formatter to suppress other messages since they will be fixed or can't be automatically
82+
// fixed anyway.
83+
let formatter = SwiftFormatter(configuration: configuration, diagnosticEngine: nil)
8184
formatter.debugOptions = debugOptions
8285
let assumingFileURL = URL(fileURLWithPath: assumingFilename ?? "<stdin>")
8386

0 commit comments

Comments
 (0)