SwiftLintFix
is a Swift Package Manager plugin which makes it easy to run swiftlint and swiftformat.
It can be run manually from the command line or in Xcode, or automatically on commit.
Add the dependency to your Package.swift
dependencies: [
.package(url: "https://github.com/GoodHatsLLC/SwiftLintFix.git", from: "0.1.7")
]
If you use SwiftLintFix
in a library you might want to make it a conditional dependency to avoid exposing it to your users.
swift package plugin lintfix
You can configure any tooling to run SwiftLintFix
from the command line.
SwiftLintFix
direct supports use via pre-commit.
If you use it to manage your git
hooks you can simply add a section to your .pre-commit-config.yaml
file.
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/GoodHatsLLC/SwiftLintFix
rev: v0.1.8
hooks:
- id: swift_lintfix
SwiftLintFix
runs a default rule set for swiftlint
and swiftformat unless it finds their configuration
files at the root of your repo.
.swiftlint
.swiftformat
SwiftLintFix was initially forked from Airbnb's style guide.