|
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 |
6 | 1 | 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 |
| 2 | + - line_length |
| 3 | + - identifier_name |
| 4 | + - nesting |
| 5 | + - type_name |
| 6 | + - explicit_enum_raw_value |
| 7 | + - file_length |
| 8 | + - function_body_length |
| 9 | + - function_parameter_count # Allow 6+ parameters for DateTime and Area factory methods |
| 10 | + - type_body_length # Comprehensive test suites can be longer than 250 lines |
| 11 | + - trailing_comma # Conflicts with swift-format which prefers trailing commas |
| 12 | + - redundant_discardable_let # Preserve 'let _ =' in result builder contexts (required for Swift 6.0+) |
26 | 13 |
|
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 |
43 | 14 | opt_in_rules: |
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 |
| 15 | + - empty_count |
| 16 | + - explicit_init |
| 17 | + - sorted_imports |
| 18 | + - force_cast |
| 19 | + - force_try |
| 20 | + - closure_spacing |
| 21 | + - operator_usage_whitespace |
| 22 | + - private_outlet |
| 23 | + - redundant_nil_coalescing |
| 24 | + - empty_string |
| 25 | + - literal_expression_end_indentation |
| 26 | + - single_test_class |
| 27 | + - sorted_first_last |
| 28 | + - vertical_whitespace |
| 29 | + - strict_fileprivate |
| 30 | + - legacy_random |
| 31 | + - no_extension_access_modifier |
| 32 | + - colon |
| 33 | + |
75 | 34 | included: |
| 35 | + - Package.swift |
76 | 36 | - Sources |
77 | 37 | - Tests |
78 | 38 |
|
79 | 39 | excluded: |
80 | | - - .build |
81 | | - - .swiftpm |
| 40 | + - Carthage |
| 41 | + - Pods |
| 42 | + - fastlane |
| 43 | + - build |
82 | 44 |
|
83 | | -# Rule configurations |
84 | | - |
85 | | -# Allow longer functions for complex performance logic |
86 | | -function_body_length: |
87 | | - warning: 60 |
88 | | - error: 100 |
| 45 | +analyzer_rules: |
| 46 | + - unused_import |
89 | 47 |
|
90 | | -# Allow larger types for comprehensive test suites |
91 | | -type_body_length: |
92 | | - warning: 400 |
93 | | - error: 600 |
| 48 | +colon: |
| 49 | + apply_to_dictionaries: true |
94 | 50 |
|
95 | | -# Nesting depth |
96 | | -nesting: |
97 | | - type_level: 2 |
| 51 | +vertical_whitespace: |
| 52 | + max_empty_lines: 1 |
0 commit comments