Skip to main content

SwiftLint

SwiftLint checks the source code for programmatic as well as stylistic errors. This is helpful in identifying some common and uncommon mistakes that are made during coding. This step installs SwiftLint and runs SwiftLint with the given options.

Prerequisites

Before running the SwiftLint step, you must complete certain prerequisites, as detailed in the table below:

Prerequisite Workflow StepDescription
Git CloneThis step will clone your repository. After this step works, the variable $AC_REPOSITORY_DIR will be created. This variable is the required input variable for SwiftLint.
Cocoapods InstallThis step will install the dependencies in the project before SwiftLint can run.
Screenshot
danger

If you are using CocoaPods, note that this step is dependent on the CocoaPods Install step. Otherwise, the SwiftLint component will fail, and the pipeline will break.

caution

If you are using Swift Package Manager (SPM), do not use this step. SPM packages will be compiled in other steps that work with Xcode, such as Xcodebuild for Devices.

If you have SPM in your project and you are using the SwiftLint component in your workflow, the Linter component will give an error because it cannot find the required dependencies.

Input Variables

This step contains some input variable(s). It needs these variable(s) to work. The table below gives explanation for this variable(s).

Screenshot
Variable NameDescriptionStatus
$AC_REPOSITORY_DIRSpecifies the cloned repository directory.Required
$AC_LINT_PATHThis is the path of SwiftLint dependency. It comes from the Xcode Build Phase section.Optional
$AC_LINT_RANGEWith the Range option, you can run SwiftLint on your entire project or only on changes in PR. Default is all.Optional
$AC_LINT_CONFIGSpecifies the linting configuration file. For example: /.swiftlint.ymlOptional
$AC_LINT_REPORTERYou can change the report type with the Reporter Format option. This option supports extensions such as html, json, junit, etc. The default is Xcode.Optional
$AC_LINT_STRICTIf there is a failure in the running lint, you can break the pipeline with the Strict option. The default value is NO.Optional
$AC_LINT_QUIETIf you want the logs to be simpler, you can make the report file simpler with the Quiet Mode feature.Optional

Output Variables

The output(s) resulting from the operation of this component are as follows:

Variable NameDescription
AC_LINT_OUTPUT_PATHThe path of the SwiftLint results output file. After SwiftLint runs, all results will be written in a .txt file. It can be found in the download artifacts.

To access the source code of this component, please use the following link:

Preview of GitHub - appcircleio/appcircle-swiftlint-component