Skip to content

Commit 51aac55

Browse files
committed
chore: update infrastructure configuration
- Update .swift-format configuration - Update .swiftlint.yml rules - Remove .spi.yml (not needed for compatibility wrapper) These changes align with the project's current structure and ensure consistent formatting/linting across the codebase.
1 parent dde3c47 commit 51aac55

File tree

3 files changed

+94
-53
lines changed

3 files changed

+94
-53
lines changed

.spi.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

.swift-format

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
{
22
"version": 1,
3-
"lineLength": 100,
3+
"lineLength": 120,
44
"indentation": {
55
"spaces": 4
66
},
7+
"tabWidth": 8,
78
"maximumBlankLines": 1,
89
"respectsExistingLineBreaks": true,
910
"lineBreakBeforeControlFlowKeywords": false,
10-
"lineBreakBeforeEachArgument": true,
11-
"lineBreakBeforeEachGenericRequirement": true,
11+
"lineBreakBeforeEachArgument": false,
12+
"lineBreakBeforeEachGenericRequirement": false,
1213
"prioritizeKeepingFunctionOutputTogether": true,
1314
"indentConditionalCompilationBlocks": true,
14-
"indentSwitchCaseLabels": false,
15-
"spacesAroundRangeFormationOperators": false,
15+
"lineBreakAroundMultilineExpressionChainComponents": false,
1616
"fileScopedDeclarationPrivacy": {
1717
"accessLevel": "private"
1818
},
1919
"rules": {
2020
"AllPublicDeclarationsHaveDocumentation": false,
2121
"AlwaysUseLowerCamelCase": true,
22-
"AmbiguousTrailingClosureOverload": true,
22+
"AmbiguousTrailingClosureOverload": false,
2323
"BeginDocumentationCommentWithOneLineSummary": false,
2424
"DoNotUseSemicolons": true,
2525
"DontRepeatTypeInStaticProperties": true,
@@ -31,7 +31,7 @@
3131
"NeverUseForceTry": false,
3232
"NeverUseImplicitlyUnwrappedOptionals": false,
3333
"NoAccessLevelOnExtensionDeclaration": true,
34-
"NoBlockComments": false,
34+
"NoBlockComments": true,
3535
"NoCasesWithOnlyFallthrough": true,
3636
"NoEmptyTrailingClosureParentheses": true,
3737
"NoLabelsInCasePatterns": true,
@@ -43,11 +43,10 @@
4343
"OnlyOneTrailingClosureArgument": true,
4444
"OrderedImports": true,
4545
"ReturnVoidInsteadOfEmptyTuple": true,
46-
"UseEarlyExits": false,
4746
"UseLetInEveryBoundCaseVariable": true,
4847
"UseShorthandTypeNames": true,
4948
"UseSingleLinePropertyGetter": true,
50-
"UseSynthesizedInitializer": false,
49+
"UseSynthesizedInitializer": true,
5150
"UseTripleSlashForDocumentationComments": true,
5251
"UseWhereClausesInForLoops": false,
5352
"ValidateDocumentationComments": false

.swiftlint.yml

Lines changed: 86 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,97 @@
1+
# SwiftLint Configuration for swift-standards
2+
# Shared across all packages in the workspace
3+
# Optimized for library/framework development with Swift Testing
4+
5+
# Disabled rules
16
disabled_rules:
2-
- line_length
3-
- identifier_name
4-
- nesting
5-
- type_name
6-
- explicit_enum_raw_value
7-
- file_length
8-
- function_body_length
9-
- redundant_discardable_let # Preserve 'let _ =' in result builder contexts (required for Swift 6.0+)
7+
# Type inference & Swift idioms
8+
- explicit_type_interface # Type inference is idiomatic Swift
9+
- explicit_init # Prefer MyType() over MyType.init()
10+
- extension_access_modifier # Prefer access on members, not extensions
11+
- explicit_acl # Don't require `internal` everywhere
12+
13+
# Development flexibility
14+
- todo # TODOs are fine in development
15+
- force_cast # Sometimes needed in tests
16+
- force_try # Sometimes needed in tests
17+
18+
# Length restrictions (swift-format handles line length)
19+
- line_length # HTML attributes can be 300+ chars; swift-format handles this
20+
- file_length # Comprehensive test files are long
21+
22+
# Domain complexity
23+
- cyclomatic_complexity # Lookup tables and parsing logic have inherent complexity
24+
- function_parameter_count # Time/Date/RFC initializers legitimately need many parameters
25+
- large_tuple # Component tuples are acceptable for internal use
1026

27+
# Documentation patterns
28+
- file_header # No consistent pattern across packages
29+
- missing_docs # Documentation via code comments, not strictly required
30+
31+
# Swift Testing compatibility
32+
- identifier_name # Swift Testing uses backtick names with spaces
33+
- type_name # @Suite uses descriptive names with spaces
34+
35+
# False positives for our patterns
36+
- optional_data_string_conversion # False positive on [UInt8] -> String conversion
37+
- for_where # Not always clearer than for+if
38+
- contains_over_first_not_nil # False positives on custom firstIndex implementations
39+
- sorted_imports # Handled by swift-format's OrderedImports rule
40+
- trailing_comma # Handled by swift-format (adds trailing commas for better diffs)
41+
42+
# Opt-in rules for code quality
1143
opt_in_rules:
12-
- empty_count
13-
- explicit_init
14-
- sorted_imports
15-
- force_cast
16-
- force_try
17-
- closure_spacing
18-
- operator_usage_whitespace
19-
- private_outlet
20-
- redundant_nil_coalescing
21-
- empty_string
22-
- literal_expression_end_indentation
23-
- single_test_class
24-
- sorted_first_last
25-
- vertical_whitespace
26-
- strict_fileprivate
27-
- legacy_random
28-
- no_extension_access_modifier
29-
- colon
30-
- trailing_comma
31-
44+
# Bug prevention
45+
- unused_optional_binding # Catch unused let bindings
46+
47+
# Code quality & cleanliness
48+
- implicit_optional_initialization # Don't initialize optionals to nil (formerly redundant_optional_initialization)
49+
- redundant_void_return # Don't write -> Void
50+
- empty_string # Use .isEmpty not == ""
51+
- vertical_whitespace # Consistent spacing
52+
53+
# Analyzer rules (require --analyze flag)
54+
analyzer_rules:
55+
- unused_import # Remove unnecessary imports
56+
57+
# Performance optimizations
58+
- empty_count # Use .isEmpty instead of .count == 0
59+
- first_where # Prefer first(where:) over filter().first
60+
- last_where # Prefer last(where:) over filter().last
61+
- contains_over_range_nil_comparison # Better performance
62+
- sorted_first_last # Prefer sorted().first/last
63+
64+
# Style consistency
65+
- closure_spacing # Consistent closure formatting
66+
- operator_usage_whitespace # Consistent operator spacing
67+
68+
# Safety
69+
- array_init # Safer array initialization
70+
- fatal_error_message # Require messages in fatalError
71+
- legacy_random # Use modern random APIs
72+
- overridden_super_call # Ensure super is called when needed
73+
74+
# Paths
3275
included:
33-
- Package.swift
3476
- Sources
3577
- Tests
3678

3779
excluded:
38-
- Carthage
39-
- Pods
40-
- fastlane
41-
- build
80+
- .build
81+
- .swiftpm
4282

43-
analyzer_rules:
44-
- unused_import
83+
# Rule configurations
84+
85+
# Allow longer functions for complex performance logic
86+
function_body_length:
87+
warning: 60
88+
error: 100
4589

46-
colon:
47-
apply_to_dictionaries: true
90+
# Allow larger types for comprehensive test suites
91+
type_body_length:
92+
warning: 400
93+
error: 600
4894

49-
vertical_whitespace:
50-
max_empty_lines: 1
95+
# Nesting depth
96+
nesting:
97+
type_level: 2

0 commit comments

Comments
 (0)