[CI] Add SwiftLint style gate (warnings-only)#38
Merged
Conversation
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
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds SwiftLint as a PR-time style gate, running on every PR into
mainand every push tomain. Reports warnings as inline annotations on the diff.Design choices
Warnings-only to start. The existing codebase is unaudited, so flipping the check to
--strictright 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: oncemainis warning-free under this ruleset, flip CI to--strictand 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
--reporter github-actions-logging.Files
.github/workflows/lint.yml— the workflow.swiftlint.yml— the rulesetRefs
Closes #34