Revision control

Copy as Markdown

only_rules: # Only enforce these rules, ignore all others
- accessibility_label_for_image
- accessibility_trait_for_button
- attribute_name_spacing
- balanced_xctest_lifecycle
- blanket_disable_command
- class_delegate_protocol
- closing_brace
- closure_body_length
- closure_end_indentation
- closure_parameter_position
- closure_spacing
- collection_alignment
- colon
- comma
- comma_inheritance
- comment_spacing
- compiler_protocol_init
- computed_accessors_order
- contains_over_filter_count
- contains_over_filter_is_empty
- contains_over_first_not_nil
- contains_over_range_nil_comparison
- control_statement
- custom_rules
- convenience_type
# - cyclomatic_complexity
# - deployment_target
# - direct_return
# - discarded_notification_center_observer
- discouraged_assert
# - discouraged_default_parameter
# - discouraged_direct_init
# - discouraged_none_name
# - discouraged_object_literal
# - discouraged_optional_collection
- duplicate_conditions
- duplicate_enum_cases
- duplicate_imports
- dynamic_inline
- empty_collection_literal
- empty_count
- empty_enum_arguments
- empty_parameters
- empty_parentheses_with_trailing_closure
- empty_string
- empty_xctest_method
# - enum_case_associated_values_count
- explicit_init
# - fallthrough
# - fatal_error_message
- file_header
# - file_name
# - file_name_no_space
# - file_types_order
# - final_test_case
- first_where
# - flatmap_over_map_reduce
- for_where
- force_cast
- force_try
# - force_unwrapping
- function_body_length
# - function_default_parameter_at_end
- function_name_whitespace
# - function_parameter_count
# - generic_type_name
# - ibinspectable_in_extension
# - identical_operands
- implicit_getter
- implicit_optional_initialization
- implicitly_unwrapped_optional
- inclusive_language
- invalid_swiftlint_command
# - invisible_character
# - is_disjoint
# - joined_default_parameter
- large_tuple
- last_where
- leading_whitespace
- legacy_cggeometry_functions
- legacy_constant
- legacy_constructor
- legacy_hashing
# - legacy_multiple
- legacy_nsgeometry_functions
# - legacy_objc_type
# - legacy_random
# - legacy_uigraphics_function
# - let_var_whitespace
- line_length
# - literal_expression_end_indentation
# - local_doc_comment
# - lower_acl_than_parent
- mark
- modifier_order
- multiline_arguments
# - multiline_function_chains
# - multiline_literal_brackets
- multiline_parameters
# - multiline_parameters_brackets
# - multiple_closures_with_trailing_closure
# - nesting
# - nimble_operator
# - no_empty_block
# - no_fallthrough_only
# - no_grouping_extension
# - no_magic_numbers
- no_space_in_method_call
# - non_optional_string_data_conversion
# - notification_center_detachment
- ns_number_init_as_function_reference
# - nslocalizedstring_key
# - nsobject_prefer_isequal
# - number_separator
- opening_brace
# - operator_usage_whitespace
# - optional_data_string_conversion
- orphaned_doc_comment
- overridden_super_call
# - override_in_extension
# - period_spacing
# - prefer_asset_symbols
# - prefer_condition_list
# - prefer_self_in_static_references
# - prefer_self_type_over_type_of_self
- prefer_type_checking
# - prefer_zero_over_explicit_init
# - private_action
# - private_outlet
- private_over_fileprivate
# - private_subject
# - private_swiftui_state
# - private_unit_test
# - prohibited_interface_builder
# - prohibited_super_call
- protocol_property_accessors_order
# - reduce_boolean
# - reduce_into
- redundant_discardable_let
# - redundant_final
# - redundant_nil_coalescing
- redundant_objc_attribute
# - redundant_self
# - redundant_sendable
# - redundant_set_access_control
- redundant_string_enum_value
- redundant_type_annotation
- redundant_void_return
# - required_enum_case
- return_arrow_whitespace
# - return_value_from_void_function
# - self_binding
# - self_in_property_initialization
# - shorthand_argument
# - shorthand_operator
# - shorthand_optional_binding
# - sorted_enum_cases
# - sorted_first_last
- statement_position
# - static_operator
# - static_over_final_class
# - strict_fileprivate
# - strong_iboutlet
- switch_case_alignment
- syntactic_sugar
# - toggle_bool
# - trailing_closure
- trailing_newline
- trailing_semicolon
- trailing_whitespace
# - type_body_length
# - type_contents_order
# - type_name
# - typesafe_array_init
- unavailable_condition
# - unavailable_function
# - unhandled_throwing_task
- unneeded_break_in_switch
# - unneeded_escaping
- unneeded_override
# - unneeded_parentheses_in_closure_argument
- unneeded_synthesized_initializer
# - unneeded_throws_rethrows
# - unowned_variable_capture
# - untyped_error_in_catch
# - unused_closure_parameter
# - unused_control_flow_label
# - unused_declaration
# - unused_enumerated
- unused_optional_binding
# - unused_parameter
- unused_setter_value
# - valid_ibinspectable
# - variable_shadowing
- vertical_parameter_alignment
- vertical_parameter_alignment_on_call
- vertical_whitespace
- vertical_whitespace_closing_braces
- vertical_whitespace_opening_braces
- void_function_in_ternary
- void_return
# - weak_delegate
# - xct_specific_matcher
# - xctfail_message
- yoda_condition
line_length:
warning: 125
ignores_urls: true
ignores_interpolated_strings: true
closure_body_length:
warning: 34
error: 34
function_body_length:
warning: 98
error: 98
file_header:
required_string: |
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/
redundant_type_annotation:
consider_default_literal_types_redundant: true
# `balanced_xctest_lifecycle` requires a `tearDown` for every `setUp` (and vice versa), which
# means one half of the pair is sometimes an empty passthrough to super. Exempt the XCTest
# life cycle methods so the two rules don't contradict each other.
unneeded_override:
excluded_methods:
- setUp
- setUpWithError
- tearDown
- tearDownWithError
custom_rules:
# Targeting a specific device breaks as soon as a new device ships. Disable it explicitly with
# `// swiftlint:disable:next no_is_duo` where there is no trait-based alternative.
no_is_duo:
name: "No isDuo"
regex: '\bisDuo\b'
match_kinds:
- identifier
message: "Prefer using size classes and device traits over targeting specific devices"
severity: error
analyzer_rules: # Rules run by `swiftlint analyze`
- unused_import
excluded: # paths to ignore during linting. Takes precedence over `included`.
- .git/
# Firefox specific
- build/
- .build/
- "**/.build"
- firefox-ios/Client/Assets/Search/get_supported_locales.swift
- firefox-ios/Client/Generated
- firefox-ios/fastlane/
- firefox-ios/Source/ExcludedFolder
- firefox-ios/Source/ExcludedFile.swift
- firefox-ios/Storage/ThirdParty/SwiftData.swift
- firefox-ios/Sync/Generated/Metrics.swift
- firefox-ios/Storage/Generated/Metrics.swift
- firefox-ios/ThirdParty
- test-fixtures/tmp
- firefox-ios/firefox-ios-tests/Tests/UITests/
- l10n-screenshots-dd/
- DerivedData/
# Package.swift files need a custom header for swift-tools-version so must be excluded due to file_header rule. Ignore at all levels.
- "**/Package.swift"
- BrowserKit/Sources/Shared/Deferred/
- BrowserKit/.build/
- firefox-ios/Build/Intermediates.noindex/Client.build/Fennec-iphoneos/WidgetKitExtension.build/DerivedSources/IntentDefinitionGenerated/WidgetIntents/*
# Focus specific
- focus-ios/Blockzilla/Generated
- focus-ios-tests/tools/Localizations
# Application-services specific
- MozillaRustComponents/
- LocalizationTools
- firefoxios-l10n
# Local git worktrees checked out alongside the repo, not part of the tracked source tree
- .claude/worktrees
included:
- /Users/vagrant/git
- .
# reporter: "json" # reporter type (xcode, json, csv, checkstyle)
reporter: "xcode" # reporter type (xcode, json, csv, checkstyle)