Skip to content

Commit 8976e50

Browse files
committed
Update SwiftLint config to use remote parent_config
- Use remote parent_config from swift-standards repo - Override type_name rule for test suites with lowercase function names - Updated .gitignore (synced from swift-standards)
1 parent 6cd2eb7 commit 8976e50

File tree

2 files changed

+11
-94
lines changed

2 files changed

+11
-94
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,7 @@ Thumbs.db
2323
!CODE_OF_CONDUCT.md
2424
!SECURITY.md
2525
!**/*.docc/**/*.md
26+
27+
28+
# SwiftLint Remote Config Cache
29+
.swiftlint/RemoteConfigCache

.swiftlint.yml

Lines changed: 7 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,9 @@
1-
# SwiftLint Configuration for swift-standards
2-
# Shared across all packages in the workspace
3-
# Optimized for library/framework development with Swift Testing
1+
# SwiftLint configuration for swift-iso-9899
2+
# Inherits from the shared parent configuration in swift-standards
43

5-
# Disabled rules
6-
disabled_rules:
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
26-
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-
41-
# Opt-in rules for code quality
42-
opt_in_rules:
43-
# Bug prevention
44-
- unused_optional_binding # Catch unused let bindings
45-
46-
# Code quality & cleanliness
47-
- implicit_optional_initialization # Don't initialize optionals to nil (formerly redundant_optional_initialization)
48-
- redundant_void_return # Don't write -> Void
49-
- empty_string # Use .isEmpty not == ""
50-
- vertical_whitespace # Consistent spacing
51-
52-
# Analyzer rules (require --analyze flag)
53-
analyzer_rules:
54-
- unused_import # Remove unnecessary imports
4+
parent_config: https://raw.githubusercontent.com/swift-standards/swift-standards/main/.swiftlint.yml
555

56-
# Performance optimizations
57-
- empty_count # Use .isEmpty instead of .count == 0
58-
- first_where # Prefer first(where:) over filter().first
59-
- last_where # Prefer last(where:) over filter().last
60-
- contains_over_range_nil_comparison # Better performance
61-
- sorted_first_last # Prefer sorted().first/last
62-
63-
# Style consistency
64-
- closure_spacing # Consistent closure formatting
65-
- operator_usage_whitespace # Consistent operator spacing
66-
67-
# Safety
68-
- array_init # Safer array initialization
69-
- fatal_error_message # Require messages in fatalError
70-
- legacy_random # Use modern random APIs
71-
- overridden_super_call # Ensure super is called when needed
72-
73-
# Paths
74-
included:
75-
- Sources
76-
- Tests
77-
78-
excluded:
79-
- .build
80-
- .swiftpm
81-
82-
# Rule configurations
83-
84-
# Allow longer functions for complex performance logic
85-
function_body_length:
86-
warning: 60
87-
error: 100
88-
89-
# Allow larger types for comprehensive test suites
90-
type_body_length:
91-
warning: 400
92-
error: 600
93-
94-
# Nesting depth
95-
nesting:
96-
type_level: 2
6+
# Package-specific overrides
7+
# Disable type_name validation because test suites use lowercase function names like "pow()", "sqrt()"
8+
disabled_rules:
9+
- type_name

0 commit comments

Comments
 (0)