Skip to content

Conversation

iCharlesHu
Copy link
Contributor

This PR introduces a baseline .swift-format and enforce linting when testing.

It is NOT a goal of this PR to introduce a finalized styling. Instead, most rules in .swift-format are turned off to ensure the diff in this PR is minimal. We will introduce each rule individually with future PRs.

switch self {
case .string(let string):
#if os(Windows)
#if os(Windows)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sure we're very inconsistent about this one. I sort of like that #if is aligned differently - it calls out something that changes at a different time (compile time vs run time). Indenting them to me seems a little weird too, because we don't indent the lines under the 'else' like we would have if it were a traditional if { } block.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah fortunately the only settings are either

#if os(macOS)
var label = ""
#endif

or

#if os(macOS)
    var label = ""
#endif

I seem to see we use former more so I decided to go with that

}

internal func close() { /* No-op on Darwin */ }
internal func close() { /* No-op on Darwin */ }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious why this inserted an additional space.

@iCharlesHu iCharlesHu force-pushed the charles/introduce-swift-format branch from 60f19a9 to 47e015e Compare August 28, 2025 19:33
@iCharlesHu iCharlesHu force-pushed the charles/introduce-swift-format branch from 86dcc14 to 7cbb611 Compare August 28, 2025 20:37
@iCharlesHu iCharlesHu merged commit f0ba4f4 into swiftlang:main Aug 28, 2025
39 checks passed
@iCharlesHu iCharlesHu deleted the charles/introduce-swift-format branch August 28, 2025 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants