|
| 1 | +--- |
| 2 | +title:SwiftLint |
| 3 | +sidebar_label:SwiftLint |
| 4 | +description:CodeRabbit's guide to SwiftLint. |
| 5 | +sidebar_position:7 |
| 6 | +--- |
| 7 | + |
| 8 | +[SwiftLint](https://realm.github.io/SwiftLint/) is a linter for Swift. |
| 9 | + |
| 10 | +##Files |
| 11 | + |
| 12 | +SwiftLint will run on files with the following extensions: |
| 13 | + |
| 14 | +-`.swift` |
| 15 | + |
| 16 | +##Configuration |
| 17 | + |
| 18 | +Ruff supports the following config files: |
| 19 | + |
| 20 | +-`.swiftlint.yaml` |
| 21 | +-`.swiftlint.yml` |
| 22 | +- User-defined config file set at`reviews.tools.swiftlint.config_file` in your project's`.coderabbit.yaml` file or setting the "Review → Tools → SwiftLint → Config File" field in CodeRabbit's settings page. |
| 23 | + |
| 24 | +CodeRabbit will use the following settings if no config file is found: |
| 25 | + |
| 26 | +```yaml |
| 27 | +disabled_rules: |
| 28 | + -closure_body_length |
| 29 | + -cyclomatic_complexity |
| 30 | + -enum_case_associated_values_count |
| 31 | + -file_length |
| 32 | + -function_body_length |
| 33 | + -function_parameter_count |
| 34 | + -large_tuple |
| 35 | + -line_length |
| 36 | + -nesting |
| 37 | + -type_body_length |
| 38 | + -attributes |
| 39 | + -closing_brace |
| 40 | + -closure_end_indentation |
| 41 | + -closure_parameter_position |
| 42 | + -closure_spacing |
| 43 | + -collection_alignment |
| 44 | + -colon |
| 45 | + -comma |
| 46 | + -comma_inheritance |
| 47 | + -computed_accessors_order |
| 48 | + -conditional_returns_on_newline |
| 49 | + -control_statement |
| 50 | + -custom_rules |
| 51 | + -direct_return |
| 52 | + -empty_enum_arguments |
| 53 | + -empty_parameters |
| 54 | + -empty_parentheses_with_trailing_closure |
| 55 | + -explicit_self |
| 56 | + -file_header |
| 57 | + -file_types_order |
| 58 | + -identifier_name |
| 59 | + -implicit_getter |
| 60 | + -implicit_return |
| 61 | + -inclusive_language |
| 62 | + -indentation_width |
| 63 | + -leading_whitespace |
| 64 | + -let_var_whitespace |
| 65 | + -literal_expression_end_indentation |
| 66 | + -modifier_order |
| 67 | + -multiline_arguments |
| 68 | + -multiline_arguments_brackets |
| 69 | + -multiline_function_chains |
| 70 | + -multiline_literal_brackets |
| 71 | + -multiline_parameters |
| 72 | + -multiline_parameters_brackets |
| 73 | + -multiple_closures_with_trailing_closure |
| 74 | + -no_space_in_method_call |
| 75 | + -non_overridable_class_declaration |
| 76 | + -number_separator |
| 77 | + -opening_brace |
| 78 | + -operator_usage_whitespace |
| 79 | + -operator_whitespace |
| 80 | + -optional_enum_case_matching |
| 81 | + -period_spacing |
| 82 | + -prefer_self_in_static_references |
| 83 | + -prefer_self_type_over_type_of_self |
| 84 | + -prefixed_toplevel_constant |
| 85 | + -protocol_property_accessors_order |
| 86 | + -redundant_discardable_let |
| 87 | + -redundant_self_in_closure |
| 88 | + -return_arrow_whitespace |
| 89 | + -self_binding |
| 90 | + -shorthand_argument |
| 91 | + -shorthand_operator |
| 92 | + -single_test_class |
| 93 | + -sorted_enum_cases |
| 94 | + -sorted_imports |
| 95 | + -statement_position |
| 96 | + -superfluous_else |
| 97 | + -switch_case_alignment |
| 98 | + -switch_case_on_newline |
| 99 | + -trailing_closure |
| 100 | + -trailing_comma |
| 101 | + -trailing_newline |
| 102 | + -trailing_whitespace |
| 103 | + -type_contents_order |
| 104 | + -unneeded_parentheses_in_closure_argument |
| 105 | + -unused_optional_binding |
| 106 | + -vertical_parameter_alignment |
| 107 | + -vertical_parameter_alignment_on_call |
| 108 | + -vertical_whitespace |
| 109 | + -vertical_whitespace_between_cases |
| 110 | + -vertical_whitespace_closing_braces |
| 111 | + -vertical_whitespace_opening_braces |
| 112 | + -void_return |
| 113 | +``` |
| 114 | +
|
| 115 | +## Links |
| 116 | +
|
| 117 | +- [SwiftLint Configuration](https://github.com/realm/SwiftLint?tab=readme-ov-file#configuration) |