Skip to content

chore: add SwiftLint 0.65.0 with pinned CI version#1043

Open
grdsdev wants to merge 6 commits into
mainfrom
claude/nervous-hopper-2c734b
Open

chore: add SwiftLint 0.65.0 with pinned CI version#1043
grdsdev wants to merge 6 commits into
mainfrom
claude/nervous-hopper-2c734b

Conversation

@grdsdev

@grdsdev grdsdev commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds SwiftLint 0.65.0 as a code-smell and correctness linter alongside the existing swift-format
  • No changes to Package.swift — downstream consumers are unaffected
  • Only the 25 rules that currently produce violations are disabled; the remaining ~75 default rules are enforced immediately
  • Each disabled rule is a follow-up PR opportunity: remove it from disabled_rules once the violations are fixed

What changed

File Purpose
.swiftlint.yml Config scoped to Sources/Tests. Lists only the 25 rules with existing violations in disabled_rules; everything else runs and passes.
.github/workflows/ci.yml New SwiftLint job pinned to 0.65.0 via portable_swiftlint.zip from GitHub releases, cached by version+OS, version-verified before running. Added to the ci-success required-jobs gate.
AGENTS.md Documents the linting workflow.

Design notes

swift-format stays the layout authority. Rules that overlap with swift-format (e.g. trailing_comma, opening_brace, line_length) are disabled to avoid conflicts between the two tools.

Pinned version for reproducibility. CI downloads the exact 0.65.0 binary from GitHub releases and caches it — no brew resolution, no version drift. To upgrade: bump SWIFTLINT_VERSION in the workflow and commit.

Incremental adoption. Rather than a baseline file (which stores absolute paths and breaks across machines), violations are tracked by disabling only the rules that fire. Enable rules one-by-one in follow-up PRs by removing entries from disabled_rules.

Currently disabled rules and their violation counts:

Rule Count
line_length 339
trailing_comma 139
identifier_name 128
non_optional_string_data_conversion 56
opening_brace 40
type_body_length 35
file_length 32
function_body_length 29
force_try 26
comment_spacing 19
redundant_discardable_let 9
force_cast 9
type_name 6
multiple_closures_with_trailing_closure 6
optional_data_string_conversion 5
implicit_optional_initialization 5
for_where 4
nesting 3
cyclomatic_complexity 3
orphaned_doc_comment 2
closure_parameter_position 2
todo 1
function_parameter_count 1
function_name_whitespace 1
class_delegate_protocol 1

Testing

  • swiftlint lint --strict → 0 violations, 0 serious in 211 files
  • SwiftLint CI job passes with pinned 0.65.0 binary

@grdsdev grdsdev requested a review from a team as a code owner June 29, 2026 09:09
@coveralls

coveralls commented Jun 29, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 28930530953

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage increased (+0.4%) to 83.384%

Details

  • Coverage increased (+0.4%) from the base build.
  • Patch coverage: 3 of 3 lines across 2 files are fully covered (100%).
  • 247 coverage regressions across 9 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

247 previously-covered lines in 9 files lost coverage.

File Lines Losing Coverage Coverage
Sources/RealtimeV2/RealtimeChannelV2.swift 129 67.38%
Sources/RealtimeV2/RealtimeClientV2.swift 44 86.76%
Sources/Auth/AuthClient.swift 32 87.22%
Sources/Auth/Types.swift 20 80.43%
Sources/Storage/StorageFileApi.swift 8 97.81%
Sources/Supabase/SupabaseClient.swift 7 67.18%
Sources/Auth/Internal/Keychain.swift 5 37.23%
Sources/Auth/Internal/JWTAlgorithm.swift 1 50.0%
Sources/Auth/Storage/KeychainLocalStorage.swift 1 41.67%

Coverage Stats

Coverage Status
Relevant Lines: 9449
Covered Lines: 7879
Line Coverage: 83.38%
Coverage Strength: 37.58 hits per line

💛 - Coveralls

@grdsdev grdsdev force-pushed the claude/nervous-hopper-2c734b branch 2 times, most recently from 9ed79f4 to b67820b Compare July 6, 2026 18:06
@grdsdev grdsdev changed the title chore: add SwiftLint with pinned version and baseline chore: add SwiftLint 0.65.0 with pinned CI version Jul 7, 2026
grdsdev added 2 commits July 7, 2026 05:22
Adds SwiftLint as a code-smell/correctness linter alongside swift-format.
No changes to Package.swift — downstream consumers are unaffected.

Setup:
- .swiftlint.yml: all default rules disabled; enable one-by-one in
  follow-up PRs as violations are fixed
- Makefile: adds `make lint` (strict) and `make lint-fix` (autocorrect)
- CI: new SwiftLint job pinned to 0.65.0 via portable_swiftlint.zip
  from GitHub releases, cached by version+OS, version-verified before
  running. Added to ci-success required-jobs gate.
- AGENTS.md: documents the linting workflow

Install locally: brew install swiftlint
@grdsdev grdsdev force-pushed the claude/nervous-hopper-2c734b branch from b67820b to a808b78 Compare July 7, 2026 08:24
Comment thread AGENTS.md
Comment thread .github/workflows/ci.yml
if: steps.cache-swiftlint.outputs.cache-hit != 'true'
run: |
curl -fL \
"https://github.com/realm/SwiftLint/releases/download/${SWIFTLINT_VERSION}/portable_swiftlint.zip" \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this should also be pinned somehow (if we want the same security as for the actions)? Because github releases can change...

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.

3 participants