|
| 1 | +# Opt-In Rules |
| 2 | +opt_in_rules: |
| 3 | + - anonymous_argument_in_multiline_closure |
| 4 | + - array_init |
| 5 | + - attributes |
| 6 | + - closure_body_length |
| 7 | + - closure_end_indentation |
| 8 | + - closure_spacing |
| 9 | + - collection_alignment |
| 10 | + - comma_inheritance |
| 11 | + - conditional_returns_on_newline |
| 12 | + - contains_over_filter_count |
| 13 | + - contains_over_filter_is_empty |
| 14 | + - contains_over_first_not_nil |
| 15 | + - contains_over_range_nil_comparison |
| 16 | + - convenience_type |
| 17 | + - discouraged_none_name |
| 18 | + - discouraged_object_literal |
| 19 | + - discouraged_optional_boolean |
| 20 | + - discouraged_optional_collection |
| 21 | + - empty_collection_literal |
| 22 | + - empty_count |
| 23 | + - empty_string |
| 24 | + - enum_case_associated_values_count |
| 25 | + - explicit_init |
| 26 | + - fallthrough |
| 27 | + - file_header |
| 28 | + - file_name |
| 29 | + - file_name_no_space |
| 30 | + - first_where |
| 31 | + - flatmap_over_map_reduce |
| 32 | + - force_unwrapping |
| 33 | + - function_default_parameter_at_end |
| 34 | + - identical_operands |
| 35 | + - implicit_return |
| 36 | + - implicitly_unwrapped_optional |
| 37 | + - joined_default_parameter |
| 38 | + - last_where |
| 39 | + - legacy_multiple |
| 40 | + - let_var_whitespace |
| 41 | + - literal_expression_end_indentation |
| 42 | + - local_doc_comment |
| 43 | + - lower_acl_than_parent |
| 44 | + - missing_docs |
| 45 | + - modifier_order |
| 46 | + - multiline_arguments |
| 47 | + - multiline_arguments_brackets |
| 48 | + - multiline_function_chains |
| 49 | + - multiline_literal_brackets |
| 50 | + - multiline_parameters |
| 51 | + - multiline_parameters_brackets |
| 52 | + - no_extension_access_modifier |
| 53 | + - no_grouping_extension |
| 54 | + - no_magic_numbers |
| 55 | + - number_separator |
| 56 | + - operator_usage_whitespace |
| 57 | + - optional_enum_case_matching |
| 58 | + - prefer_self_in_static_references |
| 59 | + - prefer_self_type_over_type_of_self |
| 60 | + - prefer_zero_over_explicit_init |
| 61 | + - prohibited_interface_builder |
| 62 | + - redundant_nil_coalescing |
| 63 | + - redundant_type_annotation |
| 64 | + - return_value_from_void_function |
| 65 | + - shorthand_optional_binding |
| 66 | + - sorted_first_last |
| 67 | + - sorted_imports |
| 68 | + - static_operator |
| 69 | + - strict_fileprivate |
| 70 | + - switch_case_on_newline |
| 71 | + - toggle_bool |
| 72 | + - trailing_closure |
| 73 | + - type_contents_order |
| 74 | + - unneeded_parentheses_in_closure_argument |
| 75 | + - yoda_condition |
| 76 | + |
| 77 | +# Disabled Rules |
| 78 | +disabled_rules: |
| 79 | + - block_based_kvo |
| 80 | + - class_delegate_protocol |
| 81 | + - dynamic_inline |
| 82 | + - is_disjoint |
| 83 | + - no_fallthrough_only |
| 84 | + - notification_center_detachment |
| 85 | + - ns_number_init_as_function_reference |
| 86 | + - nsobject_prefer_isequal |
| 87 | + - private_over_fileprivate |
| 88 | + - redundant_objc_attribute |
| 89 | + - self_in_property_initialization |
| 90 | + - todo |
| 91 | + - unavailable_condition |
| 92 | + - valid_ibinspectable |
| 93 | + - xctfail_message |
| 94 | + |
| 95 | +# Custom Rules |
| 96 | +custom_rules: |
| 97 | + github_issue: |
| 98 | + name: 'GitHub Issue' |
| 99 | + regex: '//.(TODO|FIXME):.(?!.*(https://github\.com/david-swift/Dvandva/issues/\d))' |
| 100 | + message: 'The related GitHub issue must be included in a TODO or FIXME.' |
| 101 | + severity: warning |
| 102 | + |
| 103 | + fatal_error: |
| 104 | + name: 'Fatal Error' |
| 105 | + regex: 'fatalError.*\(.*\)' |
| 106 | + message: 'Fatal error should not be used.' |
| 107 | + severity: error |
| 108 | + |
| 109 | + enum_case_parameter: |
| 110 | + name: 'Enum Case Parameter' |
| 111 | + regex: 'case [a-zA-Z0-9]*\([a-zA-Z0-9\.<>?,\n\t =]+\)' |
| 112 | + message: 'The associated values of an enum case should have parameters.' |
| 113 | + severity: warning |
| 114 | + |
| 115 | + tab: |
| 116 | + name: 'Whitespaces Instead of Tab' |
| 117 | + regex: '\t' |
| 118 | + message: 'Spaces should be used instead of tabs.' |
| 119 | + severity: warning |
| 120 | + |
| 121 | + # Thanks to the creator of the SwiftLint rule |
| 122 | + # "empty_first_line" |
| 123 | + # https://github.com/coteditor/CotEditor/blob/main/.swiftlint.yml |
| 124 | + # in the GitHub repository |
| 125 | + # "CotEditor" |
| 126 | + # https://github.com/coteditor/CotEditor |
| 127 | + empty_first_line: |
| 128 | + name: 'Empty First Line' |
| 129 | + regex: '(^[ a-zA-Z ]*(?:protocol|extension|class|struct) (?!(?:var|let))[ a-zA-Z:]*\{\n *\S+)' |
| 130 | + message: 'There should be an empty line after a declaration' |
| 131 | + severity: error |
| 132 | + |
| 133 | +# Analyzer Rules |
| 134 | +analyzer_rules: |
| 135 | + - unused_declaration |
| 136 | + - unused_import |
| 137 | + |
| 138 | +# Options |
| 139 | +file_header: |
| 140 | + required_pattern: '(// swift-tools-version: .+)?//\n// .*.swift\n// Dvandva\n//\n// Created by .* on .*\.(\n// Edited by (.*,)+\.)*\n(\n// Thanks to .* for the .*:\n// ".*"\n// https://.* \(\d\d.\d\d.\d\d\))*//\n' |
| 141 | +missing_docs: |
| 142 | + warning: [internal, private] |
| 143 | + error: [open, public] |
| 144 | + excludes_extensions: false |
| 145 | + excludes_inherited_types: false |
| 146 | +type_contents_order: |
| 147 | + order: |
| 148 | + - case |
| 149 | + - type_alias |
| 150 | + - associated_type |
| 151 | + - type_property |
| 152 | + - instance_property |
| 153 | + - ib_inspectable |
| 154 | + - ib_outlet |
| 155 | + - subscript |
| 156 | + - initializer |
| 157 | + - deinitializer |
| 158 | + - subtype |
| 159 | + - type_method |
| 160 | + - view_life_cycle_method |
| 161 | + - ib_action |
| 162 | + - other_method |
0 commit comments