Skip to content

[CI] Add SwiftLint style gate (warnings-only)#38

Merged
Jam-Cai merged 2 commits into
FuJacob:mainfrom
Jam-Cai:ci/swiftlint-style-gate
Apr 22, 2026
Merged

[CI] Add SwiftLint style gate (warnings-only)#38
Jam-Cai merged 2 commits into
FuJacob:mainfrom
Jam-Cai:ci/swiftlint-style-gate

Conversation

@Jam-Cai

@Jam-Cai Jam-Cai commented Apr 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds SwiftLint as a PR-time style gate, running on every PR into main and every push to main. Reports warnings as inline annotations on the diff.

Design choices

Warnings-only to start. The existing codebase is unaudited, so flipping the check to --strict right now would fail unrelated PRs on style noise the author didn't introduce. The graduation plan lives in both the workflow file and .swiftlint.yml: once main is warning-free under this ruleset, flip CI to --strict and fail on any warning.

Initial ruleset is intentionally loose. Disabled: file_length, type_body_length, function_body_length, todo. These would flag legitimately long coordinators and every in-flight TODO marker; retrofitting them is a separate conversation, not a prerequisite for landing lint.

Opt-in rules focus on real footguns. empty_count, empty_string, first_where, last_where, contains_over_*, redundant_nil_coalescing, closure_spacing, explicit_init, implicit_return, toggle_bool. No pure-style opt-ins yet.

What you'll see after merge

  • A SwiftLint check on every PR. Findings appear as inline annotations on the PR diff via --reporter github-actions-logging.
  • No blocking failures — warnings don't fail the check until the graduation step.

Files

  • .github/workflows/lint.yml — the workflow
  • .swiftlint.yml — the ruleset

Refs

Closes #34

Introduces a warnings-only SwiftLint check on every PR into main, plus an
initial .swiftlint.yml tuned to catch real footguns without nitpicking
the existing unaudited baseline.

- Workflow reports via github-actions-logging so warnings appear inline on
  the diff, not buried in the run log.
- Ruleset intentionally loose: disables file/type/function length and TODO
  warnings for now, since retrofitting them touches every file.
- Graduation path documented in both files: flip CI to `--strict` once main
  is warning-free, then re-audit disabled_rules.

Refs #34
@Jam-Cai Jam-Cai changed the title ci: Add SwiftLint style gate (warnings-only) [CI] Add SwiftLint style gate (warnings-only) Apr 22, 2026
force_cast and force_try ship at error severity by default, which makes
swiftlint exit non-zero and fail the CI step regardless of our stated
"warnings-only" intent. On the current baseline, force_cast fires 4
times — enough to red-wash every PR.

Explicit demotion here; re-promote when CI flips to --strict (graduation
plan documented in the file header and the workflow).

Verified locally:
  swiftlint lint --config .swiftlint.yml --quiet
  # exit 0, 65 warnings, 0 errors
@Jam-Cai Jam-Cai merged commit dec3223 into FuJacob:main Apr 22, 2026
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.

CI: SwiftLint style gate on PRs

1 participant