Gitlab allows you to easily measure and report code quality of your merge requests to see your linting or other code issues right in every merge request you make in a nice and concise way.

I have been using SwiftLint for a very long time now in my iOS projects so I decided to integrate it to the Gitlab code quality flow.
This is quite easy because SwifLint can generate a Code Climate format that Gitlab understands. No need for any custom format conversion or data transformation.
To set it up in Gitlab you need to modify your .gitlab-ci.yml
file. First include the code quality template
include:
- template: Code-Quality.gitlab-ci.yml
and then add a new job called code_quality
, it needs to have this exact name to match the included template
code_quality:
dependencies: []
stage: linting
artifacts:
paths:
- codequality_report.json
reports:
codequality: codequality_report.json
script:
- swiftlint --reporter codeclimate > codequality_report.json
tags:
- iOS-arm
This works for a simple project. In my projects I usually use an iOS application project and a few smaller framework projects that the iOS application uses, so instead of swiftlint --reporter codeclimate > codequality_report.json
I call a custom shell script