kyle-c
11/19/2017 - 12:10 PM

Swiftlint

Add swiftlint in an Xcode project

How to integrate SwiftLint in a project

  1. Add a new script in build phases

if which swiftlint >/dev/null; then
  swiftlint
else
  echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi
  1. Add a .swiftlint.yml file

disabled_rules: # some rules are only opt-in
#- empty_count
#- missing_docs
#- trailing_newline
- trailing_whitespace
- vertical_whitespace
#- todo
#- cyclomatic_complexity
#- function_body_length
#- file_length
#- legacy_constant
- line_length
#- empty_parentheses_with_trailing_closure
#- variable_name
#- type_body_length

# Find all the available rules by running:
# swiftlint rules

excluded: # paths to ignore during linting. Takes precedence over `included`.
- Pods

Documentation

https://github.com/realm/SwiftLint