Skip to content
Pablo Villar edited this page Oct 24, 2016 · 2 revisions

We use SwiftLint to lint our codebases.

To install it in your machine:

brew install swiftlint

To configure it, create a .swiftlint.yml at the root level of your repository, containing this:

disabled_rules:
  - force_cast
  - force_try
  - line_length
  - todo
  - trailing_whitespace
  - statement_position
  - type_name
  - valid_docs
  - variable_name
exclude:
  - Pods

⚠️ Make sure there is an end of line character at the end of the file.

To run it:

cd your_repo_location
swiftlint

You can also add this script under your project's build phases (add run script phase):

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

to get immediate feedback when building locally: Immediate Feedback

Clone this wiki locally