Add SwiftLint - #162
Closed
yysskk wants to merge 1 commit into
Closed
Conversation
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
Owner
Author
|
Closing in favor of the first-party toolchain formatter: the lint/format setup will use apple/swift-format ( |
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 linting to the harness so style and hygiene regressions are caught in CI rather than in review.
.swiftlint.ymlcoversSources,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 withwithExtendedLifetime((a, b, c))tuples (large_tuple), two-letter names likevcand the conventionalr/g/b/acolor components are allowed (identifier_name), and the line/file/type-length thresholds match the current shape of the code (160 / 600 / 350).SwiftLintonubuntu-latestusing the pinned official docker image (ghcr.io/realm/swiftlint:0.64.1) with--strict(warnings fail) and thegithub-actions-loggingreporter for inline annotations. Existing job names are untouched, so the required checks onmainare unaffected.TabView,SwipeMenuView, andSwipeMenuViewController.i→index,m→maskedCorners).= niloptional initializations in the options.// TODO: case infinitycomment (never implemented, no issue tracks it).Tests
swiftlint lint --strictpasses locally with zero violations (SwiftLint 0.64.1).