nicklockwood / SwiftFormat

A command-line tool and Xcode Extension for formatting Swift code
MIT License
7.62k stars 623 forks source link

Linting is broken when using stdin #1741

Closed jakenvac closed 3 days ago

jakenvac commented 4 days ago

When running in lint mode with content from stdin, the output is incorrect.

For example, when running cat Package.swift | swiftformat --lint --reporter json stdout is just th contents of Package.swift, while stderr is the correct "Source input did not pass lint check." etc. The actual lint output, regardless of if there is a reporter set or not, is nowhere to be seen.

image

However, it behaves as expected when reading the file directly.

image

I'm planning on having a go at fixing this, however I'm not too familiar with the codebase, so if anyone gets to it before me, thanks!