Fix 7 specific SwiftLint violation types across the codebase:
explicit_acl- Add access control keywordsexplicit_top_level_acl- Add access control to top-level typestype_contents_order- Reorganize type members in correct ordermultiline_arguments_brackets- Move closing brackets to new linesline_length- Break lines over 108 charactersconditional_returns_on_newline- Move return statements to new linesdiscouraged_optional_boolean- SKIPPED per user decision
1. SyncEngine.swift ✅
- Fixed
explicit_acl: Addedinternalto properties (cloudKitService, pipeline) - Fixed
type_contents_order: Reorganized to put all nested types (SyncOptions, SyncResult, DetailedSyncResult, TypeSyncResult) before instance properties - Fixed
line_length: Changed line 194 to use multi-line string literal - Key change: Type structure now follows: nested types → properties → initializer → methods
2. ExportCommand.swift ✅
- Fixed
explicit_acl: Addedinternalto properties in nested structs - Fixed
type_contents_order: Moved all nested types (ExportData, RecordExport, ExportError) to top of enum - Fixed
conditional_returns_on_newline: Line 85 (now 113) guard statement - Key change: Nested struct properties needed to be
internal(notprivate) for Codable memberwise initializer
3. VirtualBuddyFetcher.swift ✅
- Fixed
explicit_acl: Addedinternalto struct, typealias, initializers, and functions - Fixed
explicit_top_level_acl: Addedinternalto VirtualBuddyFetcher and VirtualBuddyFetcherError - Fixed
line_length: Split two long print statements (lines 96, 113) - Fixed
multiline_arguments_brackets: URLComponents initializer now has closing bracket on new line - Key change: All public-facing types and methods now explicitly
internal
4. BushelCloudKitService.swift ✅
- Fixed
type_contents_order: Movedserviceinstance property afterrecordTypestype property - Fixed
line_length: Line 207-208 split using multi-line string literal with backslash continuation - Fixed
multiline_arguments_brackets: Line 184 executeBatchOperations call now has closing bracket on new line - Key change: Static properties must come before instance properties
5. PEMValidator.swift ✅
- Fixed
explicit_acl: Addedinternalto static func validate - Fixed
explicit_top_level_acl: Addedinternalto PEMValidator enum - Fixed
line_length: Lines 57, 66, 89 all split using multi-line string literals - Key change: All three error suggestion strings converted to multi-line format for readability
1. DataSourcePipeline+Deduplication.swift ✅
- Fixed
explicit_acl: Addedinternalto 4 deduplication functions (lines 36, 59, 168, 182) - Skipped:
discouraged_optional_boolean(7 violations) - intentional tri-state Bool? for signing status - Key change: All deduplication methods now have explicit access control
2. XcodeReleasesFetcher.swift ✅
- Fixed
type_contents_order: Movedinit()after all nested types (was at line 50, now at line 126) - Fixed
conditional_returns_on_newline: Line 175 guard statement now has return on new line - Key change: Nested types → init → methods ordering now correct
3. MrMacintoshFetcher.swift ✅
- Fixed
explicit_acl: Addedinternalto FetchError enum (line 227) and loggingCategory (line 235) - Fixed
conditional_returns_on_newline: Three guard statements (lines 98, 114, 118) now have returns on new lines - Key change: All 5 guard early returns now properly formatted
4. SwiftVersionFetcher.swift ✅
- Fixed
explicit_acl: Addedinternalto struct, typealias, fetch method, and FetchError enum (lines 39, 40, 56, 104) - Fixed
explicit_top_level_acl: Addedinternalto top-level struct (line 39) - Fixed
multiline_arguments_brackets: Line 87 closing bracket moved to new line - Key change: Consistent internal access control throughout
5. MESUFetcher.swift ✅
- Fixed
explicit_acl: Addedinternalto FetchError enum (line 117) - Fixed
line_length: Line 69 comment split into two lines - Key change: Long plist structure comment now readable within line limit
1. ConfigurationLoader.swift ✅
- Fixed
explicit_acl: Addedinternalto 8 functions (lines 74, 79, 87, 98, 119, 143, 155, 167) - Functions fixed: readString, readInt, readDouble, read(:ConfigKey), read(:ConfigKey), read(:OptionalConfigKey), read(:OptionalConfigKey), read(_:OptionalConfigKey)
- Key change: All configuration reader helper methods now have explicit access control
2. ConfigurationKeys.swift ✅
- Fixed
multiline_arguments_brackets: Line 101 closing bracket moved to new line - Key change: Multi-line ConfigKey initialization now properly formatted
3. CloudKitConfiguration.swift ✅
- Fixed
line_length: Line 110 error message split using multi-line string literal - Key change: Long error message for invalid CLOUDKIT_ENVIRONMENT now readable
1. RestoreImageRecord+CloudKit.swift ✅
- Fixed
type_contents_order: MovedtoCloudKitFields()instance method after static methods - Order now: cloudKitRecordType (type property) → from/formatForDisplay (static methods) → toCloudKitFields (instance method)
- Key change: Instance methods now properly placed after type methods
2. XcodeVersionRecord+CloudKit.swift ✅
- Fixed
type_contents_order: MovedtoCloudKitFields()instance method after static methods - Fixed
multiline_arguments_brackets: Two FieldValue.Reference calls (lines 62, 70) now have closing brackets on new lines - Key change: Both type order and multiline formatting corrected
3. SwiftVersionRecord+CloudKit.swift ✅
- Fixed
type_contents_order: MovedtoCloudKitFields()instance method after static methods - Key change: Consistent ordering with other CloudKitRecord conformances
4. DataSourceMetadata+CloudKit.swift ✅
- Fixed
type_contents_order: MovedtoCloudKitFields()instance method after static methods - Key change: All CloudKit extension files now follow same pattern
5. FieldValue+URL.swift ✅
- Fixed
type_contents_order: MovedurlValueproperty beforeinit(url:)initializer - Order now: instance properties → initializers (correct Swift convention)
- Key change: Properties must come before initializers
1. ConsoleOutput.swift ✅
- Fixed
conditional_returns_on_newline: Line 45 guard statement now has return on new line - Key change: Verbose mode check now properly formatted
2. SyncEngine+Export.swift ✅
- Fixed
line_length: Line 86 split using multi-line string literal with backslash continuation - Fixed
type_contents_order: MovedExportResultstruct beforeexport()method (nested types before methods) - Key change: Correct ordering of subtypes → methods in extension
3. IPSWFetcher.swift ✅
- Fixed
explicit_acl: Addedinternalto struct, typealias, and fetch method - Fixed
multiline_arguments_brackets: URLSession.fetchLastModified call closing bracket moved to new line - Key change: Complete access control coverage
4. DataSourcePipeline.swift ✅
- Fixed
explicit_acl: Addedinternalto configuration property and fetchWithMetadata method - Fixed
type_contents_order: Reorganized to subtypes → properties → init → methods - Fixed
conditional_returns_on_newline: Line 149 guard statement - Fixed
line_length: Line 182 print statement split - Key change: Major reorganization for correct type ordering
5. DataSourcePipeline+Fetchers.swift ✅
- Fixed
explicit_acl: Addedinternalto fetchRestoreImages, fetchXcodeVersions, fetchSwiftVersions methods - Key change: All fetcher orchestration methods now explicit
6. DataSourcePipeline+ReferenceResolution.swift ✅
- Fixed
explicit_acl: Addedinternalto resolveXcodeVersionReferences method - Fixed
conditional_returns_on_newline: Line 60 guard statement - Key change: Reference resolution logic properly formatted
7-15. AppleDB Data Source Models ✅
- AppleDBEntry.swift: Added
internalto all 9 properties, moved CodingKeys before properties - AppleDBHashes.swift: Added
internalto 2 properties - AppleDBLink.swift: Added
internalto 3 properties - AppleDBSource.swift: Added
internalto 6 properties - GitHubCommit.swift: Added
internalto 2 properties - GitHubCommitsResponse.swift: Added
internalto 2 properties - GitHubCommitter.swift: Added
internalto 1 property - SignedStatus.swift: Added
internalto 3 functions (init, encode, isSigned) - Key change: All AppleDB Codable models now have explicit access control with correct type ordering
16-20. TheAppleWiki Data Source Models ✅
- IPSWParser.swift: Added
internalto 2 properties and 1 function, fixed 1 conditional return, fixed 1 multiline bracket - IPSWVersion.swift: Added
internalto 10 properties and 2 computed properties, fixed 1 conditional return - ParseContent.swift: Added
internalto 2 properties - ParseResponse.swift: Added
internalto 1 property - TextContent.swift: Added
internalto 1 property, moved CodingKeys before property - Key change: Wikipedia parser models fully compliant with access control rules
21-26. Fetcher Reorganization ✅
- XcodeReleasesFetcher.swift: Reorganized nested types before properties (8+ type_contents_order fixes)
- SwiftVersionFetcher.swift: Reordered nested types → type properties → methods
- MESUFetcher.swift: Reordered nested types → initializer → methods
- AppleDBFetcher.swift: Fixed multiline bracket + reorganized type/instance properties → type/instance methods
- MrMacintoshFetcher.swift: Reordered nested types → methods (5 violations)
- TheAppleWikiFetcher.swift: Fixed multiline bracket in fetchLastModified call
- Key change: All fetchers now follow consistent structure: nested types → properties → init → methods
27-64. Complete Test Suite ✅
-
Mocks/ (8 files): MockAppleDBFetcher, MockIPSWFetcher, MockMESUFetcher, MockSwiftVersionFetcher, MockXcodeReleasesFetcher, MockCloudKitService, MockURLProtocol, MockFetcherError
- Added
internalto all struct/class/enum declarations - Added
internalto all properties and methods - Fixed 2 conditional_returns_on_newline in MockCloudKitService
- Added
-
Utilities/ (3 files): TestFixtures, FieldValue+Assertions, MockRecordInfo
- Added
internalto all static properties (33 fixtures in TestFixtures) - Fixed 2 multiline_arguments_brackets
- Fixed 1 type_contents_order (moved url() helper after all static properties)
- Fixed 2 duplicate access modifiers (private internal → private)
- Added
-
Models/ (4 files): RestoreImageRecordTests, XcodeVersionRecordTests, SwiftVersionRecordTests, DataSourceMetadataTests
- Added
internalto all test structs and methods
- Added
-
CloudKit/ (2 files): MockCloudKitServiceTests, PEMValidatorTests
- Added
internalto all test structs and methods
- Added
-
Configuration/ (2 files): ConfigurationLoaderTests, FetchConfigurationTests
- Added
internalto all test structs and methods - Fixed 1 type_contents_order (moved createLoader helper after nested types)
- Fixed 1 duplicate access modifier
- Added
-
DataSources/ (11 files): All deduplication, merge, and fetcher tests
- Added
internalto all test structs and methods - Fixed 2 multiline_arguments_brackets in VirtualBuddyFetcherTests
- Added
-
ErrorHandling/ (4 files): All error handling tests
- Added
internalto all test structs and methods
- Added
-
Extensions/ (1 file): FieldValueURLTests
- Added
internalto all test methods - Fixed 1 line_length (split long URL string)
- Added
-
ConfigKeyKitTests/ (4 files): ConfigKeyTests, ConfigKeySourceTests, NamingStyleTests, OptionalConfigKeyTests
- Added
internalto all test structs and methods - Fixed 2 multiline_arguments_brackets in ConfigKeyTests
- Added
Key change: All 390+ explicit_acl violations in test files resolved
65. ConfigKey.swift ✅
- Fixed
type_contents_order: MovedboolDefaultproperty before initializers (lines 139, 154) - Key change: Properties now correctly appear before initializers in Bool extension
- Total files fixed: ~65 files
- explicit_acl violations fixed: 400+
- type_contents_order violations fixed: 30+
- conditional_returns_on_newline violations fixed: 10+
- line_length violations fixed: 5+
- multiline_arguments_brackets violations fixed: 15+
- Build status: ✅ All builds successful
- Final verification: ✅ 0 remaining violations for target rules
- internal - Default for most declarations (structs, classes, functions, properties)
- public - Only for:
- CloudKitRecord protocol conformances (in Extensions/*+CloudKit.swift)
- Public APIs explicitly exported (BushelCloudKitService, SyncEngine, commands)
- private - File-scoped utilities and nested helper types
Correct order within a type:
type_property(static let/var)subtype(nested types)instance_property(let/var)initializer(init)type_method(static func)other_method(instance func)
// Before (too long)
print("Very long message with \(interpolation) and more \(stuff)")
// After (split with string concatenation)
print(
"Very long message with \(interpolation) " +
"and more \(stuff)"
)
// OR use multi-line string literal for logging
logger.debug(
"""
Very long message with \(interpolation) \
and more \(stuff)
"""
)// Before
guard condition else { return }
// After
guard condition else {
return
}// Before
let obj = SomeType(
arg1: value1,
arg2: value2)
// After
let obj = SomeType(
arg1: value1,
arg2: value2
)-
Codable Structs: When adding access control to Codable struct properties, they must be
internal(notprivate) for the memberwise initializer to work. -
OSLogMessage: Cannot use string concatenation (+) with Logger.debug(). Must use multi-line string literals with
\continuation instead. -
Discouraged Optional Boolean: We're skipping all 13 violations in
DataSourcePipeline+Deduplication.swiftas the tri-state Bool? is intentional for signing status (true/false/unknown). -
Build Status: After each file fix, run
swift buildto verify. All changes so far compile successfully.
After each phase:
- Run
LINT_MODE=STRICT ./Scripts/lint.shto verify fixes - Run
swift buildto ensure no compilation errors - Run
swift testto ensure tests still pass
- Phase 1: 2 files (~30 minutes)
- Phase 2: 5 files (~45 minutes)
- Phase 3: 3 files (~20 minutes)
- Phase 4: 5 files (~30 minutes)
- Phase 5: ~60 test files (~90 minutes using bulk pattern matching)
Total remaining: ~3-4 hours of focused work
- Before: ~900 total violations
- After ALL Phases: ~300 violations (all out-of-scope items)
- Target violations FIXED:
explicit_acl: ~450 violations fixedtype_contents_order: ~40 violations fixedconditional_returns_on_newline: ~15 violations fixedline_length: ~10 violations fixedmultiline_arguments_brackets: ~20 violations fixedexplicit_top_level_acl: ~5 violations fixed
- Total fixed: ~540 violations across 83 files
- SyncEngine.swift
- ExportCommand.swift
- VirtualBuddyFetcher.swift
- BushelCloudKitService.swift
- PEMValidator.swift
- DataSourcePipeline+Deduplication.swift
- XcodeReleasesFetcher.swift
- MrMacintoshFetcher.swift
- SwiftVersionFetcher.swift
- MESUFetcher.swift
- ConfigurationLoader.swift
- ConfigurationKeys.swift
- CloudKitConfiguration.swift
- RestoreImageRecord+CloudKit.swift
- XcodeVersionRecord+CloudKit.swift
- SwiftVersionRecord+CloudKit.swift
- DataSourceMetadata+CloudKit.swift
- FieldValue+URL.swift
Source Files (21): 19. ConsoleOutput.swift 20. SyncEngine+Export.swift 21. IPSWFetcher.swift 22. DataSourcePipeline.swift 23. DataSourcePipeline+Fetchers.swift 24. DataSourcePipeline+ReferenceResolution.swift 25-32. AppleDB Models (8 files) 33-37. TheAppleWiki Models (5 files) 38-43. Fetchers (6 files: Xcode, Swift, MESU, AppleDB, MrMacintosh, TheAppleWiki) 44. ConfigKey.swift
Test Files (38+ files): 45-52. Mocks (8 files) 53-55. Utilities (3 files) 56-59. Models Tests (4 files) 60-61. CloudKit Tests (2 files) 62-63. Configuration Tests (2 files) 64-74. DataSources Tests (11 files) 75-78. ErrorHandling Tests (4 files) 79. Extensions Tests (1 file) 80-83. ConfigKeyKit Tests (4 files)
-
✅ Phase 1 Complete! All 5 high-impact files have been fixed.
-
✅ Phase 2 Complete! All 5 data source files have been fixed.
-
✅ Phase 3 Complete! All 3 configuration files have been fixed.
-
✅ Phase 4 Complete! All 5 CloudKit extension files have been fixed.
-
✅ Phase 5 Complete! All ~65 remaining source and test files have been fixed.
file_lengthviolations (requires splitting files)file_types_orderviolations (4 total, per user decision)function_body_lengthviolations (requires refactoring logic)cyclomatic_complexityviolations (requires simplifying logic)discouraged_optional_boolean(intentional design)force_unwrappingviolations (requires architectural changes)missing_docsviolations (requires writing documentation)
- Original plan:
/Users/leo/.claude/plans/expressive-cuddling-walrus.md - SwiftLint rules: https://realm.github.io/SwiftLint/
- Type contents order: Nested types → Properties → Initializers → Methods