Skip to content

Enable every SwiftLint opt-in rule and fix every violation - #392

Merged
alexkroman merged 12 commits into
mainfrom
chore/swiftlint-all-opt-in
Nov 25, 2026
Merged

alexkroman merged 12 commits into
mainfrom
chore/swiftlint-all-opt-in

Conversation

@alexkroman

Copy link
Copy Markdown
Collaborator

Draft, to merge last. This touches 844 files, so it conflicts with every PR in flight. It gets a final rebase onto main and is marked ready once the other open PRs have merged.

Enables every SwiftLint opt-in rule (opt_in_rules: [all], 237 lint rules) plus the analyzer rules, and fixes every violation. That was 17,182 violations across the enabled rules.

Config (.swiftlint.yml)

A rule is excluded only for a stated reason, written beside it:

  • It contradicts swift-format's output (swift-format owns layout): line_length, trailing_comma, opening_brace, contrasted_opening_brace, sorted_imports.
  • It contradicts another enabled rule (the side kept is the codebase's):
    • explicit_type_interface vs redundant_type_annotation
    • explicit_acl, explicit_top_level_acl and extension_access_modifier vs no_extension_access_modifier
    • explicit_enum_raw_value and raw_value_for_camel_cased_codable_enum vs redundant_string_enum_value
    • prefixed_toplevel_constant vs lowerCamelCase constants
    • no_grouping_extension vs one extension per conformance
    • required_deinit vs no_empty_block
  • It conflicts with a repo convention:
    • prefer_nimble and nimble_operator: the tests use Swift Testing and add no dependencies.
    • sorted_enum_cases: case order is behavior (CaseIterable picker order, implicit raw values).
    • no_magic_numbers: it flags the named constants themselves.
    • discouraged_default_parameter: defaulted parameters are the injection seams.

Analyzer rules: capture_variable, typesafe_array_init and unused_import.

  • explicit_self is off: it contradicts redundant_self.
  • unused_declaration is off: periphery already gates unused code, across the app and the tests, and this extra analyzer pass made SourceKit segfault in most local ios-check runs.

The fixes

  • About 90% are mechanical, from swiftlint --fix and a SwiftSyntax pass. That covers member and type ordering, one declaration per file (about 230 types split into their own files), argument and parameter wrapping, and case bodies and returns on their own lines.
  • The rest are by hand: doc comments, closure parameter names, shadowing, extracted helpers.

Visible but behavior-preserving:

  • Some private/fileprivate members widened to module-internal where a split-out file needs them. Nothing became public.
  • Defaulted parameters moved last, with every call site updated.
  • none enum cases renamed. Every one is an in-memory enum (PressHandshake's action, SignInSession.Load, SelectionRead, DictationKeyGate.Action, MeetingAutoRecord.Action); none is persisted. The persisted SoundPack.silent keeps its id "none".
  • Unneeded throws/async removed from witnesses and stubs.

30 suppressions remain, each with a reason in the code. Example: async_without_await on the URLSession delegates, where a synchronous method would never be called.

Accessibility lint findings:

  • Decorative images are hidden from VoiceOver, and the one meaningful setup checkmark is labelled "Done".
  • The share-sheet image (a Transferable, not a view) can't take the rule's fix, so it carries a suppression with the reason.
  • So does the window-wide defocus tap in ReadyView: the button trait would make VoiceOver announce the whole window as a button.

Also included:

  • check.sh's Mac periphery scan gets --clean-build, as the iPhone scan has. After file splits and renames, a reused index reported about 60 live declarations as unused.
  • Docs, scripts, skills and agents are updated for the renamed files.
  • scripts/design-tokens.swift now emits lint-clean tokens.

Verification

  • Full scripts/check.sh on the agent's commit (BLURT_SIM_DEVICE="iPhone 17"): exit 0.
    • Engine coverage 93.16%, both sanitizer runs pass.
    • 374 iOS tests, BlurtiOSCore coverage 95.71%.
    • swiftlint, swiftlint analyze, swift-format, periphery, prettier and markdownlint pass.
  • After the follow-up commit: whole-repo swiftlint --strict is clean, shellcheck and shfmt are clean, and the invariants (14) hold.
  • Mac UI tests: this draft's CI is their first run.

One known risk I can't fully rule out by reading: stored properties initialize in declaration order, and type_contents_order reordered members. If a reordered property's initializer had a side effect, behavior could change. The suites pass, but this is the change to watch.

🤖 Generated with Claude Code

alexkroman-assembly and others added 9 commits November 24, 2026 19:46
.swiftlint.yml now runs `opt_in_rules: [all]` plus every analyzer rule
(capture_variable, typesafe_array_init, unused_declaration, unused_import;
explicit_self is the one left out, as it contradicts redundant_self). The
rules still disabled are each listed with a one-line reason: those whose
fixes swift-format undoes (contrasted_opening_brace, sorted_imports,
opening_brace, line_length, trailing_comma), those that contradict another
enabled rule (explicit_type_interface, explicit_acl, explicit_top_level_acl,
extension_access_modifier, explicit_enum_raw_value,
raw_value_for_camel_cased_codable_enum, prefixed_toplevel_constant,
no_grouping_extension, required_deinit), and those that conflict with a repo
convention or settled decision (prefer_nimble, nimble_operator,
sorted_enum_cases, no_magic_numbers, discouraged_default_parameter).
trailing_whitespace and statement_position are back on: the tree was
already clean of both.

The fixes are mechanical and change no behaviour: one declaration per file
(with the file named for it), type and file contents in SwiftLint's order,
one argument/parameter per line once a list wraps, a switch case's body and
a conditional return on their own lines, explicit closure parameter names,
doc comments on public API, comments in empty blocks, `let` hoisted out of
case patterns, unneeded throws/async removed (the nonisolated ones that keep
work off the caller's actor are spelled `@concurrent` instead), and the
unused imports the analyzer found. A few rules are suppressed line by line,
each with its reason, where the fix would change behaviour (URLSession's
async delegate methods, NSString-only APIs, tri-state Bools read from the
Accessibility API or a launch flag).

The seven accessibility findings: decorative images are hidden from
VoiceOver, a setup step's checkmark is labelled "Done", and the ready
window's tap gesture keeps no button trait, since it only releases the
search field's focus.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…scan

unused_declaration duplicates periphery (which also sees the test target,
so it needed suppressions for test-only helpers), and the extra analyzer
pass made SourceKit segfault in most ios-check runs. Its two suppressions
go with it.

The Mac periphery scan gets --clean-build, as the iPhone scan has: after
this branch's file splits and renames, a reused index reported ~60 live
declarations as unused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Wrapping arguments one per line made three near-identical blocks
token-identical, so jscpd flagged them:
- KeyboardLifecycleTests.eventually now delegates to the suite-wide until.
- searchMenu calls searchBounded with its own pressable predicate (the
  default stays the general isPressable).
- StyleProfileStore and TextShortcutStore write through JSONText.write,
  which keeps the failable encode's reasoning in one place; the profile
  store still posts its change notification only when the write happened.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rom a blurt checkout

The file splits gave each new file the original's whole import header;
the newly enabled `unused_import` analyzer rule flagged 86 of them.
Two test files needed CGFloat, which Foundation only re-exports, so they
import CoreGraphics, as KeepOpenTests already does.

The committed pbxproj named the repo-root folder reference after the
worktree directory rather than `blurt`, which CI reads as drift.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main's changes land in #392's layout: hunks whose code #392 split into
other files were ported there by hand, and main's new code (the
accessibility audits, the clock seams, TranscriptWriter) is brought
under the all-opt-in rules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
swiftlint analyze's unused_import counted CoreGraphics as unused: it only
re-exports CGFloat.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The cancelled-paste test reuses GatedInjector rather than a private
copy of it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alexkroman
alexkroman marked this pull request as ready for review November 25, 2026 07:18
@alexkroman
alexkroman enabled auto-merge November 25, 2026 07:18
alexkroman-assembly and others added 3 commits November 25, 2026 03:17
…pt-in

# Conflicts:
#	App/BlurtiOS/BlurtiOS/Sources/DictationCoordinator+Commands.swift
#	App/BlurtiOS/BlurtiOS/Sources/DictationCoordinator.swift
#	App/BlurtiOS/BlurtiOSCore/KeyboardRelayInjector.swift
#	App/BlurtiOS/BlurtiOSTests/DictationCoordinatorTests+Dictation.swift
#	App/BlurtiOS/BlurtiOSTests/DictationCoordinatorTests.swift
#	App/BlurtiOS/BlurtiOSUITests/AccessibilityAuditTests.swift
swiftlint analyze's unused_import counted Foundation as unused: it only
re-exports Dispatch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alexkroman
alexkroman added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit 1b17eab Nov 25, 2026
16 checks passed
@alexkroman
alexkroman deleted the chore/swiftlint-all-opt-in branch November 25, 2026 13:11
alexkroman pushed a commit that referenced this pull request Nov 25, 2026
Splits the AssemblyAI integration into three library products so the SDK
can be used on its own and another provider can sit beside the engine:

- AssemblyAI: the pure SDK. DictationClient (streaming upload plus the
  413 /v1/transcribe fallback, warm-up and metrics), SpeechClient (TTS),
  GatewayChatClient (LLM Gateway), the realtime, async, OAuth and
  key-validation clients. No Blurt code.
- BlurtEngine: provider-neutral. TranscriberProtocol and
  TranscriberError, SpeechSynthesizing, ChatCompleting with ChatRequest
  and ChatReply, GatewayConnection and GatewayClient, KeyValidation,
  SpeechServices, LiveTurn and KeyTermList. Imports neither other module.
- BlurtAssemblyAI: the adapter that applies Blurt's policy to the SDK:
  AssemblyAITranscriber, AssemblyAISpeechSynthesizer, AssemblyAIChat,
  SpeechServices.assemblyAI(), FileTranscriber, the account and sign-in
  code, and UserAgent.

The Mac and iPhone apps import BlurtAssemblyAI where they compose the
provider, and BlurtEngine everywhere else.

Rebased onto main after #392 turned on every SwiftLint opt-in rule:
the split files follow one declaration per file, one argument per line
once wrapped, and swiftlint's member order. Includes Alex's
simplification of the split (one key-term parser, one User-Agent stamp).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1V4svBfswwXUrVzCKq
alexkroman pushed a commit that referenced this pull request Nov 25, 2026
Splits the AssemblyAI integration into three library products so the SDK
can be used on its own and another provider can sit beside the engine:

- AssemblyAI: the pure SDK. DictationClient (streaming upload plus the
  413 /v1/transcribe fallback, warm-up and metrics), SpeechClient (TTS),
  GatewayChatClient (LLM Gateway), the realtime, async, OAuth and
  key-validation clients. No Blurt code.
- BlurtEngine: provider-neutral. TranscriberProtocol and
  TranscriberError, SpeechSynthesizing, ChatCompleting with ChatRequest
  and ChatReply, GatewayConnection and GatewayClient, KeyValidation,
  SpeechServices, LiveTurn and KeyTermList. Imports neither other module.
- BlurtAssemblyAI: the adapter that applies Blurt's policy to the SDK:
  AssemblyAITranscriber, AssemblyAISpeechSynthesizer, AssemblyAIChat,
  SpeechServices.assemblyAI(), FileTranscriber, the account and sign-in
  code, and UserAgent.

The Mac and iPhone apps import BlurtAssemblyAI where they compose the
provider, and BlurtEngine everywhere else; CI's ios-build builds the
BlurtAssemblyAI scheme beside BlurtEngine's. The split files follow the
all-opt-in SwiftLint rules from #392. Includes Alex's simplification of
the split (one key-term parser, one User-Agent stamp).

Also on the iPhone:
- Labels whose title can wrap use WrappingLabelStyle (BlurtDesign), so
  the consent sheet's disclosures, Settings' "How fast can you type?"
  and Home's return hint can't come out a line short at AX XXXL.
- The accessibility audit's default-size "Dynamic Type unsupported" is
  checked rather than taken on its word (ScalingCheck): it fails only if
  the same text is no taller at AX XXXL, ending the CI-only misreading of
  Settings' last rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1V4svBfswwXUrVzCKq
alexkroman pushed a commit that referenced this pull request Nov 25, 2026
Splits the AssemblyAI integration into three library products so the SDK
can be used on its own and another provider can sit beside the engine:

- AssemblyAI: the pure SDK. DictationClient (streaming upload plus the
  413 /v1/transcribe fallback, warm-up and metrics), SpeechClient (TTS),
  GatewayChatClient (LLM Gateway), the realtime, async, OAuth and
  key-validation clients. No Blurt code.
- BlurtEngine: provider-neutral. TranscriberProtocol and
  TranscriberError, SpeechSynthesizing, ChatCompleting with ChatRequest
  and ChatReply, GatewayConnection and GatewayClient, KeyValidation,
  SpeechServices, LiveTurn and KeyTermList. Imports neither other module.
- BlurtAssemblyAI: the adapter that applies Blurt's policy to the SDK:
  AssemblyAITranscriber, AssemblyAISpeechSynthesizer, AssemblyAIChat,
  SpeechServices.assemblyAI(), FileTranscriber, the account and sign-in
  code, and UserAgent.

The Mac and iPhone apps import BlurtAssemblyAI where they compose the
provider, and BlurtEngine everywhere else; CI's ios-build builds the
BlurtAssemblyAI scheme beside BlurtEngine's. The split files follow the
all-opt-in SwiftLint rules from #392. Includes Alex's simplification of
the split (one key-term parser, one User-Agent stamp).

Also on the iPhone:
- Labels whose title can wrap use WrappingLabelStyle (BlurtDesign), so
  the consent sheet's disclosures, Settings' "How fast can you type?"
  and Home's return hint can't come out a line short at AX XXXL.
- The accessibility audit's default-size "Dynamic Type unsupported" is
  checked rather than taken on its word (ScalingCheck): it fails only if
  the same text is no taller at AX XXXL, ending the CI-only misreading of
  Settings' last rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1V4svBfswwXUrVzCKq
alexkroman pushed a commit that referenced this pull request Nov 25, 2026
Splits the AssemblyAI integration into three library products so the SDK
can be used on its own and another provider can sit beside the engine:

- AssemblyAI: the pure SDK. DictationClient (streaming upload plus the
  413 /v1/transcribe fallback, warm-up and metrics), SpeechClient (TTS),
  GatewayChatClient (LLM Gateway), the realtime, async, OAuth and
  key-validation clients. No Blurt code.
- BlurtEngine: provider-neutral. TranscriberProtocol and
  TranscriberError, SpeechSynthesizing, ChatCompleting with ChatRequest
  and ChatReply, GatewayConnection and GatewayClient, KeyValidation,
  SpeechServices, LiveTurn and KeyTermList. Imports neither other module.
- BlurtAssemblyAI: the adapter that applies Blurt's policy to the SDK:
  AssemblyAITranscriber, AssemblyAISpeechSynthesizer, AssemblyAIChat,
  SpeechServices.assemblyAI(), FileTranscriber, the account and sign-in
  code, and UserAgent.

The Mac and iPhone apps import BlurtAssemblyAI where they compose the
provider, and BlurtEngine everywhere else; CI's ios-build builds the
BlurtAssemblyAI scheme beside BlurtEngine's. The split files follow the
all-opt-in SwiftLint rules from #392. Includes Alex's simplification of
the split (one key-term parser, one User-Agent stamp).

Also on the iPhone:
- Labels whose title can wrap use WrappingLabelStyle (BlurtDesign), so
  the consent sheet's disclosures, Settings' "How fast can you type?"
  and Home's return hint can't come out a line short at AX XXXL.
- The accessibility audit's default-size "Dynamic Type unsupported" is
  checked rather than taken on its word (ScalingCheck): it fails only if
  the same text is no taller at AX XXXL, ending the CI-only misreading of
  Settings' last rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1V4svBfswwXUrVzCKq
alexkroman pushed a commit that referenced this pull request Nov 25, 2026
Splits the AssemblyAI integration into three library products so the SDK
can be used on its own and another provider can sit beside the engine:

- AssemblyAI: the pure SDK. DictationClient (streaming upload plus the
  413 /v1/transcribe fallback, warm-up and metrics), SpeechClient (TTS),
  GatewayChatClient (LLM Gateway), the realtime, async, OAuth and
  key-validation clients. No Blurt code.
- BlurtEngine: provider-neutral. TranscriberProtocol and
  TranscriberError, SpeechSynthesizing, ChatCompleting with ChatRequest
  and ChatReply, GatewayConnection and GatewayClient, KeyValidation,
  SpeechServices, LiveTurn and KeyTermList. Imports neither other module.
- BlurtAssemblyAI: the adapter that applies Blurt's policy to the SDK:
  AssemblyAITranscriber, AssemblyAISpeechSynthesizer, AssemblyAIChat,
  SpeechServices.assemblyAI(), FileTranscriber, the account and sign-in
  code, and UserAgent.

The Mac and iPhone apps import BlurtAssemblyAI where they compose the
provider, and BlurtEngine everywhere else; CI's ios-build builds the
BlurtAssemblyAI scheme beside BlurtEngine's. The split files follow the
all-opt-in SwiftLint rules from #392. Includes Alex's simplification of
the split (one key-term parser, one User-Agent stamp).

Also on the iPhone:
- Labels whose title can wrap use WrappingLabelStyle (BlurtDesign), so
  the consent sheet's disclosures, Settings' "How fast can you type?"
  and Home's return hint can't come out a line short at AX XXXL.
- The accessibility audit's default-size "Dynamic Type unsupported" is
  checked rather than taken on its word (ScalingCheck): it fails only if
  the same text is no taller at AX XXXL, ending the CI-only misreading of
  Settings' last rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1V4svBfswwXUrVzCKq
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.

2 participants