swift/swiftformat
Checks the layout of every Swift file against the shipped SwiftFormat rules.
Part of the swift configuration, at the recommended level. It runs at the commit stage, per file. It runs swiftformat. gspot check --fix fixes what it can.
One layout everywhere keeps a diff about the change and not about where a brace went.
What to do
Section titled “What to do”Run gspot check --fix.
Example
Section titled “Example”func greeting reports consecutiveSpaces. Run gspot check --fix to get func greeting.
Turn it off
Section titled “Turn it off”Turn it off for some files, or one of its lint rules, with a reason:
gspot ignore swift/swiftformat --paths "<glob>" --reason "<why>"gspot ignore swift/swiftformat --rule <rule> --reason "<why>"To silence one place, write a comment such as:
// swiftformat:disable:next redundantSelf - the closure needs self