Adding a linter, SwiftLint

Linting your code is an essential step in ensuring the style is consistent across contributors but also over time. Alongside Jazzy, realm also maintains the excellent SwiftLint tool. It is written in Swift and installable through Swift Package Manager (SPM). Now, SPM is not able to install CLI tools. We often turn to Gems or Homebrew to install those. Luckily, thanks to the vibrant Swift community, we can use Mint, the pure SPM for CLI tools.

  1. In the .gitlab-ci.yml file, you can add the following to create a lint step:
test:    image: swift:4.2.1    script:    - swift package update    - swift test## Add linter steplint:    image: swift:4.2.1    before_script:        # Keep the current directory in a variable    - export PWD=$(pwd) # Install ...

Get Hands-On Design Patterns with Swift now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.