Created
December 4, 2025 10:25
-
-
Save andr3a88/b22dcf9e08f3f4d979314b0fa3b62a15 to your computer and use it in GitHub Desktop.
Swift lint configuration 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| disabled_rules: | |
| - force_cast | |
| - inclusive_language | |
| - static_over_final_class | |
| opt_in_rules: | |
| - trailing_whitespace | |
| - array_init | |
| - closure_spacing | |
| - closure_body_length | |
| - collection_alignment | |
| - contains_over_filter_is_empty | |
| - contains_over_filter_count | |
| - contains_over_first_not_nil | |
| - discouraged_object_literal | |
| - duplicate_enum_cases | |
| - empty_count | |
| - empty_string | |
| - empty_xctest_method | |
| - explicit_init | |
| - extension_access_modifier | |
| - fatal_error_message | |
| - file_name_no_space | |
| - first_where | |
| - flatmap_over_map_reduce | |
| - implicit_return | |
| - joined_default_parameter | |
| - last_where | |
| - let_var_whitespace | |
| - literal_expression_end_indentation | |
| - modifier_order | |
| - multiline_function_chains | |
| - operator_usage_whitespace | |
| - overridden_super_call | |
| - private_action | |
| - private_outlet | |
| - prohibited_super_call | |
| - quick_discouraged_call | |
| - implicit_optional_initialization | |
| - required_enum_case | |
| - sorted_imports | |
| - switch_case_on_newline | |
| - todo | |
| - toggle_bool | |
| - unowned_variable_capture | |
| - vertical_parameter_alignment_on_call | |
| - vertical_whitespace_closing_braces | |
| - comment_spacing | |
| - empty_collection_literal | |
| - implicit_getter | |
| - legacy_random | |
| - prefer_zero_over_explicit_init | |
| - redundant_nil_coalescing | |
| - sorted_first_last | |
| - yoda_condition | |
| - force_unwrapping | |
| - duplicated_key_in_dictionary_literal | |
| - empty_parentheses_with_trailing_closure | |
| - discouraged_none_name | |
| analyzer_rules: # Rules run by `swiftlint analyze` | |
| - unused_declaration | |
| - unused_import | |
| included: # paths to include during linting. `--path` is ignored if present. | |
| - ./ | |
| - ../AnyOtherFolder/ | |
| excluded: # paths to ignore during linting. Takes precedence over `included`. | |
| - ../Dangerfile.swift | |
| - ./Dangerfile.swift # Exclude pods folder when running from CI | |
| # These properties are marked as error by default. | |
| force_try: warning | |
| closure_body_length: | |
| warning: 60 | |
| error: 70 | |
| file_length: | |
| warning: 540 | |
| error: 550 | |
| ignore_comment_only_lines: true | |
| function_body_length: | |
| warning: 100 | |
| error: 150 | |
| type_body_length: | |
| warning: 500 | |
| error: 550 | |
| function_parameter_count: | |
| warning: 10 | |
| error: 15 | |
| line_length: | |
| warning: 170 | |
| error: 190 | |
| ignores_comments: true | |
| ignores_urls: true | |
| type_name: | |
| min_length: 4 | |
| max_length: | |
| warning: 55 | |
| error: 60 | |
| excluded: ["_", "T", "R", "S"] | |
| allowed_symbols: ["_", "T", "R", "S", "A", "ID", "URL", "OK", "TV", "CPU", "UI", "DB", "API", "XML", "JSON"] | |
| identifier_name: | |
| min_length: 3 | |
| max_length: | |
| warning: 55 | |
| error: 60 | |
| excluded: ["no", "on", "os", "js", "id", "to", "v1", "v2", "ok", "i", "a", "b"] | |
| large_tuple: | |
| warning: 3 | |
| error: 6 | |
| cyclomatic_complexity: | |
| ignores_case_statements: true | |
| reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, junit, html, emoji) | |
| custom_rules: | |
| double_space: # From https://github.com/IBM-Swift/Package-Builder | |
| include: "*.swift" | |
| name: "Double space" | |
| regex: "([a-z,A-Z] \\s+)" | |
| message: "Double space between keywords" | |
| match_kinds: keyword | |
| severity: warning | |
| mark_newline: | |
| include: "*.swift" | |
| name: "MARK new line" | |
| regex: "(^ *\\/\\/ MARK:\ [ a-zA-Z0-9=?.\\(\\)\\{\\}:,><!-]*\n *(?!(?:\\}|return))\\S+)" | |
| message: "// MARK: should have new line after" | |
| severity: warning | |
| new_line_between_import: | |
| name: "New line between import" | |
| regex: "import(.*?)\n\n+import" | |
| message: "No new line between import" | |
| severity: warning | |
| if_let_shorthand: | |
| name: "if_let_shorthand" | |
| regex: 'if let (.*) = \1([,\s])(?!as)' | |
| message: "Please use the if-let shorthand syntax" | |
| severity: warning | |
| guard_let_shorthand: | |
| name: "guard_let_shorthand" | |
| regex: 'guard let (.*) = \1([,\s])(?!as)' | |
| message: "Please use the guard-let shorthand syntax" | |
| severity: warning |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment