Repository navigation
swift format lint in CI and verify.sh (#1165) - #1300
Merged
Merged
Conversation
scripts/swift-format-lint.sh runs `swift format lint --strict` on every tracked Swift file outside spikes/, in every verify.sh plan and in CI's package tests leg. .swift-format has the rules: four are off because the code breaks them widely (DoNotUseSemicolons, OrderedImports, OneVariableDeclarationPerLine, NoAccessLevelOnExtensionDeclaration), and layout isn't checked (--debug-disable-pretty-print), since the code is laid out by hand. Eleven places fixed by hand to keep three rules on, none changing behavior: `case let .x(y)` to `case .x(let y)`, a case with a value on its own line, and `forEach` to `for`. test-verify-plan.sh looked for the gate's old `needs` list, so any branch that touched ci.yml failed it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VCgWWseQZtUzcSRzjqqQJQ
Skeyelab
enabled auto-merge (squash)
December 3, 2026 06:35
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This was referenced Dec 3, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #1165
What
scripts/swift-format-lint.shrunsswift format lint --stricton every tracked Swift file outsidespikes/(422 files:App/,AppTests/,LiveActivity/,Watch/,Packages/, and the two Swift scripts). swift-format comes with the toolchain, so nothing to install. It changes no file, and any finding fails it.verify.shruns it in every plan, next to the spelling check. It takes about a second. Without a Swift toolchain it says so and passes..swift-formathas the config: 4 spaces, 130 columns,#ifblocks not indented, and the full rules list.The config, and why
Findings with swift-format's default config, before this PR (53,615 in all):
@testable importfirst)private extension)spikes/, which isn't checkedLayout isn't checked. With 4 spaces, 130 columns and
#ifblocks not indented, the layout findings drop from about 52,400 to about 3,200 (1,270 lines over 130 columns, 1,021 indentation, 745 line breaks, and some spacing and commas). The rest is how the code is laid out by hand: several short statements on a line, and wrapped arguments lined up under the first. swift-format has no setting for either, and it has no switch for single layout findings, so the script passes--debug-disable-pretty-print, which turns the layout half of the linter off and leaves the rules. The layout settings in.swift-formatstill serve Xcode's "Format with swift-format" and a later reformat.The rules list is complete on purpose. A rule left out of the list is off, and a rule name the toolchain doesn't know fails every file, so the list holds only rules that both CI's Xcode (Swift 6.3.3) and Swift 6.4.3 have.
Code changes
Eleven places, none changing behavior, to keep three rules on:
case let .x(y)tocase .x(let y):TakeTelemetry,TelemetrySinks(3),RecordScreen.DriveOnlyMoveOffer,WatchStatus.CodingKeys,Recorder.DeviceCopyDelete,LevelFeedTests.Outcome.buffers.forEach { $0.deallocate() }to aforloop:DriveSpeedTest,PeakMetersLevelTests.Also
scripts/test-verify-plan.shlooked for the gate's oldneedslist (beforescriptsjoined it), soverify.shfailed on any branch that touchedci.yml. It now looks for the current list.Checked
forEach. CI runs it with Xcode's swift-format.lockfis macOS only). This PR touches one line ofApp/RecordScreen.swift, so CI's macOS and iOS builds cover it.Later, each its own PR
OrderedImports(218),OneVariableDeclarationPerLine(161),DoNotUseSemicolons(820) orNoAccessLevelOnExtensionDeclaration(7), with the cleanup.swift format formatwith this config changes 276 of the 422 files, about 2,700 lines out and 5,600 in. It would split the one-line statements the code uses on purpose, so it is a style decision first.🤖 Generated with Claude Code
https://claude.ai/code/session_01VCgWWseQZtUzcSRzjqqQJQ