Skip to content

Instantly share code, notes, and snippets.

@tylermilner
Last active May 5, 2021 20:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tylermilner/f33e33e3b4f23d8c6b2fdd4f87af98a1 to your computer and use it in GitHub Desktop.
Save tylermilner/f33e33e3b4f23d8c6b2fdd4f87af98a1 to your computer and use it in GitHub Desktop.
Default SwiftLint repo-wide configuration file. Put this at the root directory of your repository and tweak for your needs.
# Turn off default SwiftLint rules
disabled_rules:
- trailing_whitespace # Disables SwiftLint complaining about whitespace characters on empty lines
- todo # Disables auto-warning of TODO statements
# Turn on extra SwiftLint rules
opt_in_rules:
- array_init
- attributes
- closure_end_indentation
- closure_spacing
- contains_over_first_not_nil
- convenience_type
- discouraged_optional_boolean
- discouraged_optional_collection
- empty_count
- empty_string
- empty_xctest_method
- explicit_init
- fallthrough
- fatal_error_message
- file_header
- file_name
- first_where
- force_unwrapping
- function_default_parameter_at_end
- implicit_return
- implicitly_unwrapped_optional
- joined_default_parameter
- let_var_whitespace
- literal_expression_end_indentation
- modifier_order
- multiline_arguments
- multiline_function_chains
- multiline_parameters
- number_separator
- object_literal
- operator_usage_whitespace
- overridden_super_call
- override_in_extension
- pattern_matching_keywords
- private_action
- private_outlet
- prohibited_super_call
- redundant_nil_coalescing
- required_enum_case
- single_test_class
- sorted_first_last
- sorted_imports
- strict_fileprivate
- switch_case_on_newline
- trailing_closure
- unavailable_function
- unneeded_parentheses_in_closure_argument
- unowned_variable_capture
- untyped_error_in_catch
- vertical_parameter_alignment_on_call
- yoda_condition
# Omit directories from SwiftLint checks
excluded:
- Pods # Don't lint anything coming in through Cocoapods
# Custom rules
custom_rules:
# Warns for usage of improper year format (e.g. MM/dd/YYYY instead of MM/dd/yyyy)
YYYY_considered_harmful: # rule identifier
name: "YYYY considered harmful" # rule name. optional.
regex: "(YYYY)" # matching pattern
message: "YYYY means week-year; you probably want yyyy" # violation message. optional.
severity: error # violation severity. optional.
# Rule configuration
line_length: 240 # Max line length before warning (default is 120)
identifier_name:
max_length:
warning: 50
error: 60
excluded:
- id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment