Skip to content

style: apply swiftformat across the codebase#30

Merged
ElonPark merged 1 commit into
mainfrom
chore/apply-swiftformat
Jul 15, 2026
Merged

style: apply swiftformat across the codebase#30
ElonPark merged 1 commit into
mainfrom
chore/apply-swiftformat

Conversation

@ElonPark

@ElonPark ElonPark commented Jul 15, 2026

Copy link
Copy Markdown
Member

What

Run swiftformat . across the codebase (153 files) with the house-style configuration (2-space indent, 120-column limit). Notable mechanical changes:

  • import sorting (testable-bottom), attribute placement (prev-line), multiline string re-indentation, trailing commas in multi-element lists
  • Swift Testing test names converted to raw identifiers by swiftTestingTestCaseNames (e.g. func testPolymorphicEnumValue()func `polymorphic enum value`())

The .swiftformat / .swiftlint.yml configuration files themselves are intentionally not part of this PR.

Manual accompaniments (kept the build green)

  • CodingUserInfoKey.resilientDecodingErrorReporter is written as : CodingUserInfoKey = .init(...)! — the propertyTypes rule miscompiles the multiline = CodingUserInfoKey(...)! form into a tuple (SwiftFormat 0.62.1 bug). The .init form is stable under re-runs.
  • The @DefaultCodable test doubles are wrapped in swiftformat:disable propertyTypes regions — an explicit type annotation breaks the wrapper's generic parameter inference.

Verification

  • swiftformat . is idempotent on the final tree.
  • swift test passes in debug (303) and release (295) configurations.

Notes

https://claude.ai/code/session_017kn3Hf2khxiFy1TqimTGx9

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Too many files!

This PR contains 151 files, which is 1 over the limit of 150.

To get a review, narrow the scope:
• coderabbit review --type committed # exclude uncommitted changes
• coderabbit review --dir # limit to a subdirectory
• coderabbit review --base # compare against a closer base

Upgrade to a paid plan to raise the limit.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: ASSERTIVE

Plan: Pro

Run ID: d03d511d-8feb-4cc3-9a3a-751bc49cfbf3

📥 Commits

Reviewing files that changed from the base of the PR and between b337468 and 23dbcef.

📒 Files selected for processing (151)
  • Package.swift
  • Sources/KarrotCodableKit/AnyCodable/AnyCodable.swift
  • Sources/KarrotCodableKit/AnyCodable/AnyDecodable.swift
  • Sources/KarrotCodableKit/AnyCodable/AnyEncodable.swift
  • Sources/KarrotCodableKit/BetterCodable/DataValue/DataValue.swift
  • Sources/KarrotCodableKit/BetterCodable/DateValue/DateValue.swift
  • Sources/KarrotCodableKit/BetterCodable/DateValue/KeyedEncodingContainer+OptionalDateValue.swift
  • Sources/KarrotCodableKit/BetterCodable/DateValue/OptionalDateValue.swift
  • Sources/KarrotCodableKit/BetterCodable/DateValue/Strategy/ISO8601Strategy.swift
  • Sources/KarrotCodableKit/BetterCodable/DateValue/Strategy/ISO8601WithFractionalSecondsStrategy.swift
  • Sources/KarrotCodableKit/BetterCodable/DateValue/Strategy/RFC3339NanoStrategy.swift
  • Sources/KarrotCodableKit/BetterCodable/DateValue/Strategy/RFC3339Strategy.swift
  • Sources/KarrotCodableKit/BetterCodable/Defaults/DefaultCodable.swift
  • Sources/KarrotCodableKit/BetterCodable/Defaults/DefaultEmptyDictionary.swift
  • Sources/KarrotCodableKit/BetterCodable/Defaults/Extenstions/KeyedDecodingContainer+DefaultCodable.swift
  • Sources/KarrotCodableKit/BetterCodable/LosslessValue/KeyedEncodingContainer+OptionalLosslessValue.swift
  • Sources/KarrotCodableKit/BetterCodable/LosslessValue/LosslessArray.swift
  • Sources/KarrotCodableKit/BetterCodable/LosslessValue/LosslessValue.swift
  • Sources/KarrotCodableKit/BetterCodable/LosslessValue/OptionalLosslessValue.swift
  • Sources/KarrotCodableKit/BetterCodable/LossyValue/KeyedEncodingContainer+LossyOptional.swift
  • Sources/KarrotCodableKit/BetterCodable/LossyValue/LossyArray.swift
  • Sources/KarrotCodableKit/BetterCodable/LossyValue/LossyDictionary.swift
  • Sources/KarrotCodableKit/CustomCodable/CodingKeyStyle.swift
  • Sources/KarrotCodableKit/CustomCodable/Interface/CodableKey.swift
  • Sources/KarrotCodableKit/CustomCodable/Interface/CustomCodable.swift
  • Sources/KarrotCodableKit/CustomCodable/Interface/CustomDecodable.swift
  • Sources/KarrotCodableKit/CustomCodable/Interface/CustomEncodable.swift
  • Sources/KarrotCodableKit/Encodable+ToDictionary.swift
  • Sources/KarrotCodableKit/PolymorphicCodable/DefaultEmptyPolymorphicArrayValue.swift
  • Sources/KarrotCodableKit/PolymorphicCodable/Extensions/Decoder+Polymorphic.swift
  • Sources/KarrotCodableKit/PolymorphicCodable/Extensions/Encoder+Polymorphic.swift
  • Sources/KarrotCodableKit/PolymorphicCodable/Extensions/KeyedDecodingContainer+DefaultEmptyPolymorphicArrayValue.swift
  • Sources/KarrotCodableKit/PolymorphicCodable/Extensions/KeyedDecodingContainer+LossyOptionalPolymorphicValue.swift
  • Sources/KarrotCodableKit/PolymorphicCodable/Extensions/KeyedDecodingContainer+OptionalPolymorphicArrayValue.swift
  • Sources/KarrotCodableKit/PolymorphicCodable/Extensions/KeyedDecodingContainer+OptionalPolymorphicLossyArrayValue.swift
  • Sources/KarrotCodableKit/PolymorphicCodable/Extensions/KeyedDecodingContainer+OptionalPolymorphicValue.swift
  • Sources/KarrotCodableKit/PolymorphicCodable/Extensions/KeyedDecodingContainer+PolymorphicLossyArrayValue.swift
  • Sources/KarrotCodableKit/PolymorphicCodable/Extensions/KeyedEncodingContainer+LossyOptionalPolymorphicValue.swift
  • Sources/KarrotCodableKit/PolymorphicCodable/Extensions/KeyedEncodingContainer+OptionalPolymorphicArrayValue.swift
  • Sources/KarrotCodableKit/PolymorphicCodable/Extensions/KeyedEncodingContainer+OptionalPolymorphicLossyArrayValue.swift
  • Sources/KarrotCodableKit/PolymorphicCodable/Extensions/KeyedEncodingContainer+OptionalPolymorphicValue.swift
  • Sources/KarrotCodableKit/PolymorphicCodable/Interface/PolymorphicCodable.swift
  • Sources/KarrotCodableKit/PolymorphicCodable/Interface/PolymorphicCodableStrategyProviding.swift
  • Sources/KarrotCodableKit/PolymorphicCodable/Interface/PolymorphicDecodable.swift
  • Sources/KarrotCodableKit/PolymorphicCodable/Interface/PolymorphicEncodable.swift
  • Sources/KarrotCodableKit/PolymorphicCodable/Interface/UnnestedPolymorphicCodable.swift
  • Sources/KarrotCodableKit/PolymorphicCodable/Interface/UnnestedPolymorphicDecodable.swift
  • Sources/KarrotCodableKit/PolymorphicCodable/LossyOptionalPolymorphicValue.swift
  • Sources/KarrotCodableKit/PolymorphicCodable/OptionalPolymorphicArrayValue.swift
  • Sources/KarrotCodableKit/PolymorphicCodable/OptionalPolymorphicValue.swift
  • Sources/KarrotCodableKit/PolymorphicCodable/PolymorphicArrayValue.swift
  • Sources/KarrotCodableKit/PolymorphicCodable/PolymorphicValue.swift
  • Sources/KarrotCodableKit/Resilient/ErrorReporting.swift
  • Sources/KarrotCodableKit/Resilient/ResilientDecodingOutcome.swift
  • Sources/KarrotCodableKitMacros/CustomCodableMacros/CodableKeyMacro.swift
  • Sources/KarrotCodableKitMacros/CustomCodableMacros/CustomCodableMacro.swift
  • Sources/KarrotCodableKitMacros/CustomCodableMacros/CustomDecodableMacro.swift
  • Sources/KarrotCodableKitMacros/CustomCodableMacros/CustomEncodableMacro.swift
  • Sources/KarrotCodableKitMacros/Extensions/String+SnakeCase.swift
  • Sources/KarrotCodableKitMacros/PolymorphicCodableMacros/PolymorphicCodableMacro.swift
  • Sources/KarrotCodableKitMacros/PolymorphicCodableMacros/PolymorphicCodableStrategyMacro.swift
  • Sources/KarrotCodableKitMacros/PolymorphicCodableMacros/PolymorphicDecodableMacro.swift
  • Sources/KarrotCodableKitMacros/PolymorphicCodableMacros/PolymorphicEncodableMacro.swift
  • Sources/KarrotCodableKitMacros/Supports/AccessLevelModifier.swift
  • Sources/KarrotCodableKitMacros/Supports/Diagnostics.swift
  • Sources/KarrotCodableKitMacros/Supports/Factory/CodingKeysSyntaxFactory.swift
  • Sources/KarrotCodableKitMacros/Supports/Factory/PolymorphicEnumCodableFactory.swift
  • Sources/KarrotCodableKitMacros/Supports/Factory/PolymorphicExtensionFactory.swift
  • Sources/KarrotCodableKitMacros/Supports/Factory/UnnestedPolymorphicCodeGenerator.swift
  • Sources/KarrotCodableKitMacros/Supports/Factory/UnnestedPolymorphicMethodGenerator.swift
  • Sources/KarrotCodableKitMacros/Supports/PolymorphicMacroArgumentValidator.swift
  • Sources/KarrotCodableKitMacros/Supports/PropertyAnalyzer.swift
  • Sources/KarrotCodableKitMacros/Supports/PropertyDiagnosticHelper.swift
  • Sources/KarrotCodableKitMacros/Supports/SyntaxHelper.swift
  • Sources/KarrotCodableKitMacros/Supports/UnnestedPolymorphicValidation.swift
  • Sources/KarrotCodableKitMacros/UnnestedPolymorphicCodableMacro/BaseUnnestedPolymorphicMacro.swift
  • Sources/KarrotCodableKitMacros/UnnestedPolymorphicCodableMacro/UnnestedPolymorphicCodableMacro.swift
  • Sources/KarrotCodableKitMacros/UnnestedPolymorphicCodableMacro/UnnestedPolymorphicDecodableMacro.swift
  • Tests/KarrotCodableKitTests/AnyCodable/AnyCodableTests.swift
  • Tests/KarrotCodableKitTests/AnyCodable/AnyDecodableTests.swift
  • Tests/KarrotCodableKitTests/AnyCodable/AnyEncodableTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/DataValue/DataValueResilientTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/DataValue/DataValueTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/DateValue/DateValueResilientTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/DateValue/DateValueTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/DateValue/OptionalDateValueOmitNilTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/DateValue/OptionalDateValueResilientTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/DateValue/OptionalDateValueTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/DateValue/RFC3339StrategyTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/Defaults/DefaulEmptyDictionaryTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/Defaults/DefaultCodableResilientTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/Defaults/DefaultCodableTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/Defaults/DefaultEmptyArrayTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/Defaults/DefaultEmptyStringTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/Defaults/DefaultFalseTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/Defaults/DefaultTrueTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/Defaults/DefaultZeroDoubleTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/Defaults/DefaultZeroFloatTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/Defaults/DefaultZeroIntTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/LosslessValue/LosslessArrayResilientTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/LosslessValue/LosslessArrayTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/LosslessValue/LosslessCustomValueTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/LosslessValue/LosslessValueResilientTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/LosslessValue/LosslessValueTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/LosslessValue/OptionalLosslessValueOmitNilTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/LosslessValue/OptionalLosslessValueResilientTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/LosslessValue/OptionalLosslessValueTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/LossyValue/LossyArrayResilientTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/LossyValue/LossyArrayTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/LossyValue/LossyDictionaryResilientTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/LossyValue/LossyDictionaryTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/LossyValue/LossyOptionalOmitNilTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/LossyValue/LossyOptionalTests.swift
  • Tests/KarrotCodableKitTests/BetterCodable/RawRepresentableTests.swift
  • Tests/KarrotCodableKitTests/Encodable+ToDictionaryTests.swift
  • Tests/KarrotCodableKitTests/PolymorphicCodable/ArrayValue/DefaultEmptyPolymorphicArrayValueResilientTests.swift
  • Tests/KarrotCodableKitTests/PolymorphicCodable/ArrayValue/DefaultEmptyPolymorphicArrayValueTests.swift
  • Tests/KarrotCodableKitTests/PolymorphicCodable/ArrayValue/LossyArrayDecodeIfPresentTests.swift
  • Tests/KarrotCodableKitTests/PolymorphicCodable/ArrayValue/LossyArrayRecoveryPolicyTests.swift
  • Tests/KarrotCodableKitTests/PolymorphicCodable/ArrayValue/PolymorphicArrayValueResilientTests.swift
  • Tests/KarrotCodableKitTests/PolymorphicCodable/ArrayValue/PolymorphicLossyArrayValueResilientTests.swift
  • Tests/KarrotCodableKitTests/PolymorphicCodable/ArrayValue/PolymorphicLossyArrayValueTests.swift
  • Tests/KarrotCodableKitTests/PolymorphicCodable/Enum/PolymorphicEnumCodableTests.swift
  • Tests/KarrotCodableKitTests/PolymorphicCodable/Enum/PolymorphicEnumDecodableTests.swift
  • Tests/KarrotCodableKitTests/PolymorphicCodable/OptionalPolymorphicArrayValueResilientTests.swift
  • Tests/KarrotCodableKitTests/PolymorphicCodable/OptionalPolymorphicArrayValueTests.swift
  • Tests/KarrotCodableKitTests/PolymorphicCodable/OptionalPolymorphicLossyArrayValueTests.swift
  • Tests/KarrotCodableKitTests/PolymorphicCodable/OptionalValue/LossyOptionalPolymorphicValueResilientTests.swift
  • Tests/KarrotCodableKitTests/PolymorphicCodable/OptionalValue/LossyOptionalPolymorphicValueTests.swift
  • Tests/KarrotCodableKitTests/PolymorphicCodable/OptionalValue/OptionalPolymorphicValueResilientTests.swift
  • Tests/KarrotCodableKitTests/PolymorphicCodable/OptionalValue/OptionalPolymorphicValueTests.swift
  • Tests/KarrotCodableKitTests/PolymorphicCodable/TestDoubles/PolymorphicValueCodableDummy.swift
  • Tests/KarrotCodableKitTests/PolymorphicCodable/TestDoubles/PolymorphicValueDecodableDummy.swift
  • Tests/KarrotCodableKitTests/PolymorphicCodable/TestDoubles/UnnestedPolymorphicCodableDummy.swift
  • Tests/KarrotCodableKitTests/PolymorphicCodable/TestDoubles/UnnestedPolymorphicCodableStrategy.swift
  • Tests/KarrotCodableKitTests/PolymorphicCodable/TestDoubles/UnnestedPolymorphicDecodableDummy.swift
  • Tests/KarrotCodableKitTests/PolymorphicCodable/UnnestedPolymorphicTests/UnnestedPolymorphicCodableTests.swift
  • Tests/KarrotCodableKitTests/PolymorphicCodable/UnnestedPolymorphicTests/UnnestedPolymorphicDecodableTests.swift
  • Tests/KarrotCodableKitTests/PolymorphicCodable/Value/PolymorphicValueResilientTests.swift
  • Tests/KarrotCodableKitTests/PolymorphicCodable/Value/PolymorphicValueTests.swift
  • Tests/KarrotCodableMacrosTests/CustomCodableMacros/CustomCodableMacroTests.swift
  • Tests/KarrotCodableMacrosTests/CustomCodableMacros/CustomDecodableMacroTests.swift
  • Tests/KarrotCodableMacrosTests/CustomCodableMacros/CustomEncodableMacroTests.swift
  • Tests/KarrotCodableMacrosTests/Extenstions/StringSnakeCaseTests.swift
  • Tests/KarrotCodableMacrosTests/Extenstions/TrimmingBackticksTests.swift
  • Tests/KarrotCodableMacrosTests/PolymorphicCodableMacrosTests/PolymorphicCodableMacroTests.swift
  • Tests/KarrotCodableMacrosTests/PolymorphicCodableMacrosTests/PolymorphicCodableStrategyProvidingMacroTests.swift
  • Tests/KarrotCodableMacrosTests/PolymorphicCodableMacrosTests/PolymorphicDeodableMacroTests.swift
  • Tests/KarrotCodableMacrosTests/PolymorphicCodableMacrosTests/PolymorphicEncodableMacroTests.swift
  • Tests/KarrotCodableMacrosTests/UnnestedPolymorphicCodableMacroTests/UnnestedPolymorphicCodableMacroTests.swift
  • Tests/KarrotCodableMacrosTests/UnnestedPolymorphicCodableMacroTests/UnnestedPolymorphicDecodableMacroTests.swift

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/apply-swiftformat

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ElonPark
ElonPark force-pushed the chore/apply-swiftformat branch from 702a376 to be82c62 Compare July 15, 2026 14:56
@ElonPark ElonPark changed the title chore: add SwiftFormat/SwiftLint configs and apply swiftformat style: apply swiftformat across the codebase Jul 15, 2026
Run swiftformat with the new project configuration. Notable mechanical
changes include import sorting, attribute placement, multiline string
indentation, trailing commas in multi-element lists, and Swift Testing
test names converted to raw identifiers by swiftTestingTestCaseNames.

Two manual accompaniments keep the build green:

- CodingUserInfoKey.resilientDecodingErrorReporter is written as
  `: CodingUserInfoKey = .init(...)!` because the propertyTypes rule
  miscompiles the multiline `= CodingUserInfoKey(...)!` form into a
  tuple.
- The @DefaultCodable test doubles are wrapped in
  `swiftformat:disable propertyTypes` regions, since an explicit type
  annotation breaks the wrapper's generic parameter inference.

swift test passes in both debug (303) and release (295) configurations.

Claude-Session: https://claude.ai/code/session_017kn3Hf2khxiFy1TqimTGx9
@ElonPark
ElonPark force-pushed the chore/apply-swiftformat branch from be82c62 to 23dbcef Compare July 15, 2026 15:02
Base automatically changed from fix/polymorphic-lossy-array-null-outcome to main July 15, 2026 15:13
@ElonPark ElonPark self-assigned this Jul 15, 2026
@ElonPark
ElonPark merged commit d055480 into main Jul 15, 2026
4 checks passed
@ElonPark
ElonPark deleted the chore/apply-swiftformat branch July 15, 2026 15:14
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