swiftlint: clear line length, attributes, extension modifiers, indentation (351 → 40) #20
No reviewers
Labels
No labels
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
key-store/key.store!20
Loading…
Reference in a new issue
No description provided.
Delete branch "swiftlint-mechanical-fixes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Empties the four rules you asked to keep enforcing, taking first-party violations 351 → 40.
line_lengthattributesno_extension_access_modifierindentation_widthtype_contents_order(100) dropped fromonly_ruleswith its now-inert config block. Line length was already 120 — nothing to bump; the 47 were genuinely over (median 132, max 190).Two things needed care, not a corrector
Extension access.
private extension Foo { func bar() }≠extension Foo { private func bar() }— the first gives members file-wide reach for same-file callers, the second scopes them to the extension. Members lifted out of aprivate extensionare thereforefileprivate(never narrower than before);public extensionmembers are restatedpublicso the API surface is unchanged.swiftc -parsecannot catch this — it's a visibility error, not syntax — so Build: Apple is the real check here.Multiline strings. Indentation inside a string literal is content. The SQL in
KeyStoreAgentLiveStorewould have been rewritten by the rule, soinclude_multiline_strings: falserather than reflowing query text.How lines were wrapped
Call argument lists split on top-level commas (quote/bracket-aware),
@convention(c)signatures split across parameters, conformance lists one per line, one nested tuple extracted to atypealias, and two prose strings converted to multiline literals with\continuations so the string stays byte-identical.Verified:
swiftc -parseclean on 38/38 modified files, lint re-run after each stage, no rule regressed.Remaining 40 left alone:
legacy_objc_type(13),anonymous_argument_in_multiline_closure(13),unavailable_function(6),async_without_await(5).🤖 Generated with Claude Code
Takes the first-party violation count from 351 to 40 and empties the four rules you asked to keep enforcing. line_length 47 -> 0 attributes 37 -> 0 no_extension_access_modifier 33 -> 0 indentation_width 31 -> 0 `type_contents_order` (100) is dropped from `only_rules`, along with its now-inert configuration block. Line length was already 120, so nothing needed bumping -- the 47 violations were genuinely over it (median 132, max 190). Two things needed care rather than a corrector: `private extension Foo { func bar() }` is not the same as `extension Foo { private func bar() }`. The first gives members file-wide reach for same-file callers; the second scopes them to the extension. Members lifted out of a `private extension` are therefore `fileprivate`, which is never narrower than what they had. `public extension` members are restated `public` so the API surface is unchanged. `swiftc -parse` cannot catch this class of mistake -- it is a visibility error, not a syntax one -- so CI's Build: Apple job is the real check. Indentation inside a multiline string literal is content, not code: the SQL laid out for readability in KeyStoreAgentLiveStore would have been rewritten by the rule. Configured `include_multiline_strings: false` instead of reflowing the query text. Long lines were wrapped structurally -- call argument lists split on top-level commas (quote- and bracket-aware), `@convention(c)` C function-pointer signatures split across parameters, conformance lists one per line, and one nested tuple type extracted to a `typealias`. Two long prose strings became multiline literals with `\` continuations so the resulting string is byte-identical. Every modified file checked with `swiftc -parse` (38/38 clean) and the lint re-run after each stage to confirm no rule regressed. Remaining 40 are a different shape and left alone: legacy_objc_type (13), anonymous_argument_in_multiline_closure (13), unavailable_function (6), async_without_await (5). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>