stripe-ios/.swiftlint.yml

107 lines
2.5 KiB
YAML

# .swiftlint.yml
#
# Goals:
# - Decrease number of `disabled_rules` that we agree with as a team
# - Increase number of `opt_in_rules` that we agree with as a team
# - Increase number of `custom_rules` that we agree with as a team
# - Avoid rule customization unless increasing strictness that we agree with as a team
#
# Useful rules reference: https://github.com/realm/SwiftLint/blob/master/Rules.md
disabled_rules:
- cyclomatic_complexity # This finds some hairy methods
- file_length
- force_cast
- function_body_length # Interesting overlap between these violations and cyclomatic_complexity
- operator_whitespace
- todo
- type_body_length
- void_function_in_ternary
- force_try
- opening_brace
- closing_brace
- function_parameter_count
- multiple_closures_with_trailing_closure
- inclusive_language
- line_length
- xctfail_message
- no_fallthrough_only
- closure_parameter_position
# Rules to potentially enable in the future
- shorthand_operator
- for_where
- empty_count
- overridden_super_call
- redundant_string_enum_value
- class_delegate_protocol
- reduce_boolean
- unused_setter_value
- notification_center_detachment
- private_outlet
opt_in_rules:
- colon
- comma
- control_statement
# - force_unwrapping # Enable one day...
- joined_default_parameter
- leading_whitespace
- legacy_cggeometry_functions
- legacy_constant
- multiline_parameters
- overridden_super_call
- private_outlet
- prohibited_super_call
- redundant_nil_coalescing
- return_arrow_whitespace
- sorted_imports
- statement_position
- trailing_newline
- trailing_semicolon
- trailing_whitespace
- closure_spacing
# Rules to potentially enable in the future
# - weak_delegate
# - discouraged_object_literal
# - unowned_variable_capture
# - single_test_class
excluded:
- Package.swift
- Pods
- Carthage
- Tests/installation_tests
- vendor
- build*
- .build
identifier_name:
allowed_symbols: _
min_length: 1
max_length: 100
validates_start_with_lowercase: false
large_tuple:
warning: 4 # It would be nice to lower this number
error: 5
nesting:
type_level:
warning: 4
error: 5
type_name:
allowed_symbols: _`
min_length: 1
max_length: 100
validates_start_with_lowercase: false
vertical_whitespace:
max_empty_lines: 1
trailing_comma:
mandatory_comma: true
generic_type_name:
max_length: 30 # Maybe remove after initial cleanup.