Skip to content

style: apply swiftformat wrapIfStatementBodies to main - #50

Open
arkavo-com wants to merge 1 commit into
mainfrom
chore/swiftformat-wrap-if-bodies
Open

style: apply swiftformat wrapIfStatementBodies to main#50
arkavo-com wants to merge 1 commit into
mainfrom
chore/swiftformat-wrap-if-bodies

Conversation

@arkavo-com

Copy link
Copy Markdown
Contributor

Summary

swiftformat --lint . has been failing on main since the wrapIfStatementBodies rule tightened in a newer swiftformat (reproduces locally on 0.63.0). The failure is 2/55 files, entirely in KASDiscovery.swift and TDF/TDFCBORFormat.swift.

The last green lint run was #48, under an older swiftformat binary. Every PR since — including #49, which was markdown-only — has carried a red X that had nothing to do with its own diff. This clears it.

What changed

  • swiftformat . applied verbatim (the repo's .swiftformat already pins --swiftversion 6.2, so a local run matches the CI invocation exactly).
  • One manual touch-up: wrapping the single-line if bodies in isBlockedV4 / isBlockedIP left the CIDR comments dangling after the closing brace (} // 10.0.0.0/8), which reads worse than the original. Those comments move above their if instead. Comment placement only — no condition or control-flow change to the SSRF blocklist.

No logic changes anywhere.

Verification

  • swiftformat --lint .0/55 files require formatting (was 2/55)
  • swift build → clean
  • swift test → exit 0, "All tests passed"

Alternative considered

Adding --disable wrapIfStatementBodies to .swiftformat would also make CI green and would preserve the more compact if cond { return true } early-return style, which is arguably more readable for a blocklist. Applying the rule was chosen instead so the repo stays on stock swiftformat defaults — happy to flip to the disable if you'd rather keep the one-liners.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Fob1ho6LWHE6tddJJWaCrP

`swiftformat --lint .` has been failing on main since the rule tightened
in a newer swiftformat (reproduces on 0.63.0): 2/55 files, all in
KASDiscovery.swift and TDF/TDFCBORFormat.swift. The last green lint run
was #48 under an older binary, so every PR since has carried a red X
unrelated to its own diff.

Applies `swiftformat .` verbatim, plus one manual touch-up: wrapping the
single-line `if` bodies in isBlockedV4/isBlockedIP left their CIDR
comments dangling after the closing brace (`} // 10.0.0.0/8`), so those
comments move above their `if` instead. Comment movement only, no
condition or control-flow change.

No logic changes. swift build and swift test pass; `swiftformat --lint .`
now reports 0/55 files requiring formatting.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fob1ho6LWHE6tddJJWaCrP
@gitar-bot

gitar-bot Bot commented Sep 5, 2026

Copy link
Copy Markdown
CI failed: CI failure in the Swift integration tests caused by formatting or compilation issues introduced when applying swiftformat wrapIfStatementBodies rules.

Overview

1 log error pattern analyzed indicating a build or test failure in the xtest workflow step during SDK/SDK-to-platform integration tests after applying swiftformat updates.

Failures

Swift SDK Build / Test Failure (confidence: medium)

  • Type: build
  • Affected jobs: 101236159845
  • Related to change: yes
  • Root cause: The swiftformat changes (wrapIfStatementBodies) or associated changes introduced a compilation issue or test setup failure during the execution of platform integration tests.
  • Suggested fix: Review the Swift code changes in the PR, ensure all formatting changes are syntactically valid, and verify compatibility with the configured Swift toolchain.

Summary

  • Change-related failures: 1 build/test failure related to Swift formatting updates.
  • Infrastructure/flaky failures: None.
  • Recommended action: Inspect the Swift compilation and xtest logs to address any syntax or formatting regressions introduced by the swiftformat commit.
Code Review ✅ Approved

Applies swiftformat with the wrapIfStatementBodies rule to fix linting failures on main. Resolves 2/55 files requiring formatting; comment placement adjusted in the SSRF blocklist for readability. No logic changes, and verification confirms swiftformat --lint passes with clean build and tests.

Tip

Comment Gitar fix CI to trigger a fix.

Was this helpful? React with 👍 / 👎 | Gitar

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