Show how pre-commit can apply fixes and fail on errors (#4740)

This commit is contained in:
Christian Clauss 2023-02-04 13:39:25 +01:00 committed by GitHub
parent 843198d241
commit eaacd9873e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 2 deletions

View File

@ -371,12 +371,21 @@ Once [installed](https://pre-commit.com/#install), add this to the
```yaml
repos:
- repo: https://github.com/realm/SwiftLint
rev: 0.44.0
rev: 0.50.3
hooks:
- id: swiftlint
```
Adjust `rev` to the SwiftLint version of your choice.
Adjust `rev` to the SwiftLint version of your choice. `pre-commit autoupdate` can be used to update to the current version.
SwiftLint can be configured using `entry` to apply fixes and fail on errors:
```yaml
- repo: https://github.com/realm/SwiftLint
rev: 0.50.3
hooks:
- id: swiftlint
entry: swiftlint --fix --strict
```
## Rules