|
| 1 | +disabled_rules: # rule identifiers to exclude from running |
| 2 | + - trailing_whitespace |
| 3 | + - class_delegate_protocol |
| 4 | +opt_in_rules: # some rules are only opt-in |
| 5 | + - array_init |
| 6 | + - closure_spacing |
| 7 | + - closure_body_length |
| 8 | + - collection_alignment |
| 9 | + - contains_over_range_nil_comparison |
| 10 | + - contains_over_filter_count |
| 11 | + - contains_over_filter_is_empty |
| 12 | + - contains_over_first_not_nil |
| 13 | + - discouraged_object_literal |
| 14 | + - discouraged_optional_boolean |
| 15 | + - empty_collection_literal |
| 16 | + - empty_string |
| 17 | + - empty_count |
| 18 | + - empty_xctest_method |
| 19 | + - enum_case_associated_values_count |
| 20 | + - explicit_init |
| 21 | + - implicit_return |
| 22 | + - implicitly_unwrapped_optional |
| 23 | + - identical_operands |
| 24 | + - force_unwrapping |
| 25 | + - first_where |
| 26 | + - fatal_error_message |
| 27 | + - for_where |
| 28 | + - flatmap_over_map_reduce |
| 29 | + - generic_type_name |
| 30 | + - modifier_order |
| 31 | + - joined_default_parameter |
| 32 | + - extension_access_modifier |
| 33 | + - fallthrough |
| 34 | + - closure_end_indentation |
| 35 | + - attributes |
| 36 | + - let_var_whitespace |
| 37 | + - last_where |
| 38 | + - legacy_multiple |
| 39 | + - legacy_random |
| 40 | + - multiline_parameters |
| 41 | + - multiline_literal_brackets |
| 42 | + - number_separator |
| 43 | + - private_action |
| 44 | + - prefer_zero_over_explicit_init |
| 45 | + - prefer_self_type_over_type_of_self |
| 46 | + - overridden_super_call |
| 47 | + - prohibited_super_call |
| 48 | + - redundant_nil_coalescing |
| 49 | + - switch_case_on_newline |
| 50 | + - trailing_closure |
| 51 | + - vertical_parameter_alignment_on_call |
| 52 | + - literal_expression_end_indentation |
| 53 | + - lower_acl_than_parent |
| 54 | + - operator_usage_whitespace |
| 55 | + - operator_whitespace |
| 56 | + - quick_discouraged_call |
| 57 | + - untyped_error_in_catch |
| 58 | + - multiline_function_chains |
| 59 | + - file_name |
| 60 | + - file_name_no_space |
| 61 | + - file_types_order |
| 62 | + - convenience_type |
| 63 | + - reduce_into |
| 64 | + - redundant_type_annotation |
| 65 | + - single_test_class |
| 66 | + - sorted_first_last |
| 67 | + - static_operator |
| 68 | + - toggle_bool |
| 69 | + - trailing_comma |
| 70 | + - unavailable_function |
| 71 | + - unneeded_parentheses_in_closure_argument |
| 72 | + - unowned_variable_capture |
| 73 | + - yoda_condition |
| 74 | + - vertical_whitespace |
| 75 | + - vertical_whitespace_between_cases |
| 76 | + - vertical_whitespace_closing_braces |
| 77 | + - vertical_whitespace_opening_braces |
| 78 | + |
| 79 | +included: |
| 80 | + - ./Projects/ |
| 81 | + |
| 82 | +attributes: |
| 83 | + always_on_same_line: ["@State", "@ObservedObject", "@MainActor", "@Binding", "@Published"] |
| 84 | + always_on_line_above: [] |
| 85 | + severity: warning |
| 86 | + |
| 87 | +# configurable rules can be customized from this configuration file |
| 88 | +# binary rules can set their severity level |
| 89 | +cyclomatic_complexity: |
| 90 | + - 15 |
| 91 | + - 20 |
| 92 | + |
| 93 | +force_cast: warning # implicitly |
| 94 | +force_try: |
| 95 | + severity: warning # explicitly |
| 96 | +# rules that have both warning and error levels, can set just the warning level |
| 97 | +# implicitly |
| 98 | +line_length: 250 |
| 99 | +# they can set both implicitly with an array |
| 100 | +type_body_length: |
| 101 | + - 300 # warning |
| 102 | + - 400 # error |
| 103 | +function_body_length: |
| 104 | + - 100 |
| 105 | + - 200 |
| 106 | +# or they can set both explicitly |
| 107 | +file_length: |
| 108 | + warning: 500 |
| 109 | + error: 1200 |
| 110 | + ignore_comment_only_lines: true |
| 111 | +# naming rules can set warnings/errors for min_length and max_length |
| 112 | +# additionally they can set excluded names |
| 113 | +type_name: |
| 114 | + min_length: 3 # only warning |
| 115 | + max_length: # warning and error |
| 116 | + warning: 50 |
| 117 | + error: 60 |
| 118 | + excluded: |
| 119 | + - iPhone # excluded via string |
| 120 | + - In |
| 121 | + - Out |
| 122 | + - Err |
| 123 | + - Bit |
| 124 | + - Bits |
| 125 | + - Geo |
| 126 | + - Lan |
| 127 | + - Tag |
| 128 | + - Box |
| 129 | + - Id |
| 130 | + |
| 131 | +identifier_name: |
| 132 | + min_length: # only min_length |
| 133 | + error: 2 # only error |
| 134 | + max_length: |
| 135 | + warning: 50 |
| 136 | + error: 60 |
| 137 | + excluded: # excluded via string array |
| 138 | + - id |
| 139 | + - URL |
| 140 | + - op |
| 141 | + - x |
| 142 | + - y |
| 143 | + - ex |
| 144 | + - pk |
| 145 | + - vm |
| 146 | + |
| 147 | +large_tuple: |
| 148 | + warning: 3 |
| 149 | + error: 4 |
| 150 | + |
| 151 | +nesting: |
| 152 | + type_level: 3 |
| 153 | + |
| 154 | +custom_rules: |
| 155 | + comments_space: # From https://github.com/brandenr/swiftlintconfig |
| 156 | + name: "Space After Comment" |
| 157 | + regex: "(^ *//\\w+)" |
| 158 | + message: "There should be a space after //" |
| 159 | + severity: warning |
| 160 | + |
| 161 | + double_space: # From https://github.com/IBM-Swift/Package-Builder |
| 162 | + include: "*.swift" |
| 163 | + name: "Double space" |
| 164 | + regex: "([a-z,A-Z] \\s+)" |
| 165 | + message: "Double space between keywords" |
| 166 | + match_kinds: keyword |
| 167 | + severity: warning |
| 168 | + |
| 169 | + new_line_between_import: |
| 170 | + name: "New line between import" |
| 171 | + regex: "import(.*?)\n\n+import" |
| 172 | + message: "No new line between import" |
| 173 | + severity: warning |
| 174 | + |
| 175 | + # numbers_smell: |
| 176 | + # regex: '(return |case |\w\(|: |\?\? |\, |== |<=? |>=? |\+= |\-= |\/= |\*= |%= |\w\.\w+ = )\(*\d{2,}' |
| 177 | + # message: "Numbers smell; define a constant instead." |
| 178 | + # severity: warning |
| 179 | + |
| 180 | + auto_generated_leftovers: |
| 181 | + regex: 'func [^\n]*\{\n(\s*super\.[^\n]*\n(\s*\/\/[^\n]*\n)*|(\s*\/\/[^\n]*\n)+)\s*\}' |
| 182 | + message: "Delete auto-generated functions that you don't use" |
| 183 | + severity: warning |
| 184 | + |
| 185 | + # empty_line_after_guard: |
| 186 | + # regex: '(^ *guard[ a-zA-Z0-9=?.\(\),><!]*\{[ a-zA-Z0-9=?.\(\),><!]*\}\n *(?!(?:return|guard))\S+)' |
| 187 | + # message: "There should be an empty line after a guard" |
| 188 | + # severity: error |
| 189 | + |
| 190 | + empty_line_after_super: |
| 191 | + name: "Empty Line After Super" |
| 192 | + regex: '(^ *super\.[ a-zA-Z0-9=?.\(\)\{\}:,><!]*\n *(?!(?:\}|return))\S+)' |
| 193 | + message: "There should be an empty line after super" |
| 194 | + severity: error |
| 195 | + |
| 196 | + multiple_empty_lines: |
| 197 | + name: "Multiple Empty Lines" |
| 198 | + regex: '((?:\s*\n){3,})' |
| 199 | + message: "There are too many line breaks" |
| 200 | + severity: error |
| 201 | + |
| 202 | + protocol_conformance: |
| 203 | + included: ".*.swift" |
| 204 | + name: "Protocol Conformance" |
| 205 | + message: "Protocol conformance should be declared in separate extensions in the same file" |
| 206 | + regex: "(class|struct|extension)[[:space:]]+(?i:(?![^d]*delegate:))[^'\"()<>{},!?:]+:([^'\"<>(){},!?:]+,)+[^'\"<>(){},!?:]*\\{" |
| 207 | + match_kinds: |
| 208 | + - keyword |
| 209 | + severity: warning |
0 commit comments