Skip to content

style: format with swift-format and check it in CI - #133

Merged
ykisana merged 3 commits into
mainfrom
style/swift-format
Nov 19, 2026
Merged

ykisana merged 3 commits into
mainfrom
style/swift-format

Conversation

@ykisana

@ykisana ykisana commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Adds swift-format, which ships with Xcode, so there's no new dependency. The PR has three commits:

  1. .swift-format config: Apple's defaults, with the 4-space indentation the code already uses and a 150-character line length.
  2. One-time reformat:
    • Touches 187 Swift files (+1,103 / −760).
    • Mostly wraps long argument lists and fixes spacing, blank lines and import order.
    • One forEach became a for loop by hand in FakeLocationProvider, the only warning the formatter can't fix itself.
    • No other files change: the project file and the string catalog are untouched.
  3. Format CI job and docs:
    • A Format CI job runs xcrun swift-format lint --strict (under a second) on every push and PR to main.
    • AGENTS.md now says to format before committing. In Xcode, Editor › Structure › Format File with swift-format uses the same config.

Verified:

  • Strict lint passes on the branch.
  • Before the hand-written for loop change, the reformatted code passed all 904 unit tests locally. This PR's CI runs them again with that change.

After merge:

  • Add a .git-blame-ignore-revs file listing the squash commit, so git blame and GitHub skip the reformat. Its hash only exists once this is merged.
  • Add Format to the main ruleset's required checks. Doing it now would block open PRs whose branches don't have the job yet.

Rebasing open branches onto this: keep your side of any conflict, then run xcrun swift-format format -i -r -p ..

Co-authored-by: Claude Code (Claude Opus 5.5)

Apple's defaults, with the 4-space indentation the code already uses
and a 150-character line length.
Generated by xcrun swift-format format -i -r -p . with the new config,
plus one forEach turned into a for loop in FakeLocationProvider, the
only warning the formatter can't fix itself.
A Format job runs swift-format lint --strict on every push and PR to
main. AGENTS.md tells contributors and agents to format before
committing.
@ykisana
ykisana merged commit 795fd80 into main Nov 19, 2026
4 checks passed
@ykisana
ykisana deleted the style/swift-format branch November 19, 2026 01:35
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.

1 participant