swift/swiftlint-analyze
Runs the SwiftLint analyzer rules over the compiler log of the build: unused imports and captured variables.
Part of the swift configuration, at the recommended level. It runs only when gspot check --only swift/swiftlint-analyze names it, once per scope. It runs swiftlint. It needs a build of the project. It runs on macOS.
An unused import slows the build and hides the real dependencies, and a captured variable can keep an object alive or read a stale value.
What to do
Section titled “What to do”Remove what the rule names. List an import that the analyzer flags in error under tools.swiftlint.always_keep_imports.
Example
Section titled “Example”An import that no compiled Swift source uses reports a finding. Remove the import.
Turn it off
Section titled “Turn it off”Turn it off for some files, with a reason:
gspot ignore swift/swiftlint-analyze --paths "<glob>" --reason "<why>"To silence one place, write a comment such as:
// swiftlint:disable:next force_unwrapping - the URL is a literal