Skip to content

Add SwiftLint - #162

Closed
yysskk wants to merge 1 commit into
mainfrom
ci/swiftlint
Closed

Add SwiftLint#162
yysskk wants to merge 1 commit into
mainfrom
ci/swiftlint

Conversation

@yysskk

@yysskk yysskk commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Summary

Adds linting to the harness so style and hygiene regressions are caught in CI rather than in review.

  • .swiftlint.yml covers Sources, Tests, and the example app. The config deviates from SwiftLint's defaults only where this codebase's structure is deliberate, with a comment for each: option types nest by component (nesting: type_level: 3), tests keep windows alive with withExtendedLifetime((a, b, c)) tuples (large_tuple), two-letter names like vc and the conventional r/g/b/a color components are allowed (identifier_name), and the line/file/type-length thresholds match the current shape of the code (160 / 600 / 350).
  • CI job SwiftLint on ubuntu-latest using the pinned official docker image (ghcr.io/realm/swiftlint:0.64.1) with --strict (warnings fail) and the github-actions-logging reporter for inline annotations. Existing job names are untouched, so the required checks on main are unaffected.
  • Violation fixes the default rules caught, all behavior-preserving:
    • Wrapped the remaining 160+ character lines (the worst was 301 characters) in TabView, SwipeMenuView, and SwipeMenuViewController.
    • Renamed single-letter locals (iindex, mmaskedCorners).
    • Dropped redundant = nil optional initializations in the options.
    • Removed the stale 2017 // TODO: case infinity comment (never implemented, no issue tracks it).
    • Trailing whitespace/newline fixes.

Tests

  • swiftlint lint --strict passes locally with zero violations (SwiftLint 0.64.1).
  • All 70 package tests and 8 example tests pass locally on the iPhone 17 simulator (Xcode 26.5).

Add a .swiftlint.yml covering the package sources, tests, and the
example app, and a SwiftLint CI job (pinned docker image, --strict so
warnings fail). The config deviates from the defaults only where the
codebase's structure is deliberate: option types nest by component,
tests keep windows alive with withExtendedLifetime tuples, and the
UIColor tests use conventional r/g/b/a component names.

Fix the violations the defaults caught:
- wrap the remaining 160+ character lines
- rename single-letter locals (i, m)
- drop redundant '= nil' optional initializations
- remove the stale 2017 'case infinity' TODO
- trailing whitespace/newline fixes
@yysskk

yysskk commented Jul 7, 2026

Copy link
Copy Markdown
Owner Author

Closing in favor of the first-party toolchain formatter: the lint/format setup will use apple/swift-format (swift format from the Swift 6 toolchain) instead of SwiftLint. The unrelated code fixes from this branch (line wrapping, naming, stale TODO) will be carried over to the replacement PR.

@yysskk yysskk closed this Jul 7, 2026
@yysskk
yysskk deleted the ci/swiftlint branch July 7, 2026 14:16
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