Stricter SwiftLint rules and automatic fixing when available
SwiftLint is great, but we do not currently use it to it's full potential.
Autocorrection
SwiftLint supports, via swiftlint autocorrect
, autocorrection of some trivial lint errors (such as spacing). This command should be run automatically at some point (e.g. at build time).
Stricter rules
Here are some (categorized) rules to add:
Supports autocorrect
- closure_spacing
- closure_end_indentation
- literal_expression_end_indentation
- operator_usage_whitespace
- unused_import
- explicit_self
- modifier_order
- toggle_bool
Rejected
Does not support autocorrect
- multiline_function_chains
- closing_brace_spacing
- closure_body_length
- unused_declaration
- vertical_parameter_alignment_on_call
- collection_alignment
- identical_operands
- let_var_whitespace
- attributes
- lower_acl_than_parent
- strict_fileprivate
- overridden_super_call
- unowned_variable_capture
Rejected
- indentation_width (conflicts with alignment rules)
- multiline_arguments
- multiline_parameters
- type_contents_order
Patch strategy
To avoid having an enormous patch that will be impossible to rebase the second someone merges something onto master, this will be the patch strategy:
- Initial patch :
swiftlint autocorrect
implemented, and automatic rules present in .swiftlint.yml (other rules are commented) - Subsequent patches : gradually uncomment manual rules and implement them