# Shared Swift 6 lint policy for Sine Macula applications and packages. # # Consumer-specific include paths do not belong here. Qlty determines the files # passed to SwiftLint, while the exclusions below protect direct CLI and Xcode # build-phase usage from generated and third-party code. # # Note that SwiftLint applies `excluded:` only when it walks a directory itself. # Qlty passes explicit file paths, so a consumer must also exclude generated and # third-party sources via `exclude_patterns` in its own .qlty/qlty.toml. excluded: - .build - build - DerivedData - Carthage - Pods - vendor - "**/Generated" - "**/Generated/**" reporter: xcode # SwiftLint's default rules remain enabled. These opt-in rules add checks with a # strong correctness, concurrency, safety, performance, or readability signal # without requiring a particular application architecture. opt_in_rules: - accessibility_label_for_image - accessibility_trait_for_button - anonymous_argument_in_multiline_closure - array_init - closure_body_length - closure_spacing - collection_alignment - contains_over_filter_count - contains_over_filter_is_empty - contains_over_first_not_nil - contains_over_range_nil_comparison - convenience_type - direct_return - discarded_notification_center_observer - discouraged_assert - discouraged_none_name - discouraged_optional_boolean - discouraged_optional_collection - empty_collection_literal - empty_count - empty_string - empty_xctest_method - enum_case_associated_values_count - expiring_todo - explicit_init - fallthrough - fatal_error_message - final_test_case - first_where - flatmap_over_map_reduce - force_unwrapping - function_default_parameter_at_end - identical_operands - implicitly_unwrapped_optional - incompatible_concurrency_annotation - joined_default_parameter - last_where - literal_expression_end_indentation - local_doc_comment - lower_acl_than_parent - file_header - missing_docs - modifier_order - no_empty_block - non_overridable_class_declaration - optional_enum_case_matching - override_in_extension - pattern_matching_keywords - prefer_condition_list - prefer_key_path - prefer_self_in_static_references - prefer_self_type_over_type_of_self - prefer_zero_over_explicit_init - private_subject - private_swiftui_state - reduce_into - redundant_nil_coalescing - redundant_type_annotation - return_value_from_void_function - shorthand_argument - shorthand_optional_binding - sorted_first_last - sorted_imports - static_operator - strict_fileprivate - superfluous_else - test_case_accessibility - toggle_bool - unavailable_function - unhandled_throwing_task - unneeded_parentheses_in_closure_argument - unowned_variable_capture - untyped_error_in_catch - unused_parameter - variable_shadowing - weak_delegate - xct_specific_matcher - yoda_condition # Thresholds intentionally distinguish a review signal from a hard ceiling. Qlty # preserves the warning/error severity in its findings. closure_body_length: warning: 50 error: 80 cyclomatic_complexity: warning: 10 error: 20 ignores_case_statements: false enum_case_associated_values_count: warning: 5 error: 6 file_length: warning: 500 error: 800 ignore_comment_only_lines: true function_body_length: warning: 50 error: 80 function_parameter_count: warning: 6 error: 8 ignores_default_parameters: true identifier_name: min_length: warning: 3 error: 2 max_length: warning: 50 error: 60 excluded: - id - x - y line_length: warning: 120 error: 160 ignores_urls: true ignores_function_declarations: false # SwiftFormat wraps `//` comments to this width but leaves `///` doc comments # alone, so exempting comments here would let an over-long documentation line # pass both tools. PHP and TypeScript hold comments to the limit too. ignores_comments: false ignores_interpolated_strings: true ignores_multiline_strings: true ignores_regex_literals: true nesting: type_level: warning: 2 function_level: warning: 3 check_nesting_in_closures_and_statements: true always_allow_one_type_in_functions: false ignore_typealiases_and_associatedtypes: true ignore_coding_keys: true type_body_length: warning: 300 error: 500 excluded_types: - extension - protocol type_name: min_length: warning: 3 error: 2 max_length: warning: 50 error: 60 # Match SwiftFormat's explicit no-trailing-comma policy. trailing_comma: mandatory_comma: false # The PHP standard requires an @copyright tag in every class docblock and the # TypeScript standard requires @copyright and @author, so a Swift file carries a # copyright header too. The pattern deliberately asserts only that the tag is # present: the holder, year and format stay the consuming project's to choose, # and SwiftFormat's `--header ignore` leaves an existing header untouched rather # than rewriting it to a template. file_header: required_pattern: '(?:\/\/|\/\*)(?s:.)*[Cc]opyright(?s:.)*' # PHP requires a docblock on every class and method, TypeScript requires a JSDoc # block with a description. Swift's equivalent is held to the public surface: # `open` and `public` declarations are the API a consumer reads, and demanding a # comment on every internal member would be noise the other two standards do not # generate either. missing_docs: warning: [open, public] excludes_extensions: true excludes_inherited_types: true excludes_trivial_init: true # A discarded throwing task can silently lose an operational failure. unhandled_throwing_task: severity: error