swift
Swift sources and their XCTest and Swift Testing tests: lint and analyzer rules for each level, one format, a clean build, no unused code, a reason on each disabled test, and a coverage floor. The Swift guide explains the setup.
Checks
Section titled “Checks”| Check | Stage | Level | What it does |
|---|---|---|---|
swift/swiftlint |
commit |
recommended |
Lints Swift files with the SwiftLint files of each scope and nested folder, and treats warnings as errors. |
swift/swiftformat |
commit |
recommended |
Checks the layout of every Swift file against the shipped SwiftFormat rules. |
swift/build |
push |
recommended |
Builds the package or Xcode scheme incrementally to report compiler errors. |
swift/swiftlint-analyze |
manual |
recommended |
Runs the SwiftLint analyzer rules over the compiler log of the build: unused imports and captured variables. |
swift/periphery |
push |
recommended |
Scans the built project for declarations nothing uses. |
swift/skip-reasons |
commit |
recommended |
Checks that skip calls and disabled traits name a nonempty reason, and unavailable tests carry an explanation. |
swift/coverage |
push |
recommended |
Measures each source target in Xcode projects and Swift packages against coverage.lines and its coverage.swift_target floor. |
Settings
Section titled “Settings”| Setting | What it sets |
|---|---|
coverage.lines |
The minimum percentage of source lines covered by tests. |
coverage.branches |
The minimum percentage of source branches covered by tests. |
coverage.functions |
The minimum percentage of source functions covered by tests. |
coverage.statements |
The minimum percentage of source statements covered by tests. |
coverage.swift_target |
Line coverage floors for named Swift targets. |
swift.xcode_project |
The Xcode project or workspace, relative to the repository root, which init fills in when it finds one; without it, the checks use the Swift package. |
swift.xcode_scheme |
The shared scheme the build, the analyzer, and Periphery use. |
swift.xcode_destination |
The xcodebuild destination. |
tools.swiftlint.always_keep_imports |
Imports the analyzer keeps although it sees no use of them. |
Selected when
Section titled “Selected when”gspot selects it in a scope with file extensions .swift, or project files Package.swift.
Rules for coding agents
Section titled “Rules for coding agents”| Rule file | Installed when |
|---|---|
.gspot/configurations/language/swift/rules/SWIFT-TESTS.md |
The repository has files marked swift-test, swift-test-target. |
.gspot/configurations/language/swift/rules/SWIFT.md |
Always |
.gspot/configurations/language/swift/rules/SWIFTUI.md |
The repository has files marked swift-import:SwiftUI. |
.gspot/configurations/language/swift/rules/UIKIT.md |
The repository has files marked swift-import:UIKit. |
Tools and versions
Section titled “Tools and versions”| Tool | Version |
|---|---|
| swiftlint | 0.63.2 |
| swiftformat | 0.61.1 |
| periphery | 3.6.0 |
| swift | Any, install it yourself |
| xcodebuild | Any, install it yourself |
Files gspot writes
Section titled “Files gspot writes”gspot writes .gspot/configurations/language/swift/swiftlint.yml, .gspot/configurations/language/swift/swiftformat, .gspot/configurations/language/swift/periphery.yml, and .gspot/configurations/language/swift/semgrep.yml (with the security configuration).
Kept out of Git
Section titled “Kept out of Git”.build, DerivedData, and Pods.