Open
Conversation
- Add SwiftLint dependency to enable linting on build/test - Add minimal SwiftLint config - Create SwiftLint baseline to capture existing violations - Add MacOS .macOS(.v12) to allow test builds with SwiftLint
This commit adds a Brewfile so that anyone working on the project can easily install SwiftLint using Homebrew with `brew bundle`. This isn't a dependency for linting, but makes working with the SwiftLint CLI way more convenient.
f65175e to
f4d313a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds SwiftLint via SwiftLintPlugs as a SPM dependency.
.swiftlint.ymlis a super minimal configuration to lint everything except./.buildand to useBaseline.jsonto ignore violations. All existing violations are captured inBaseline.jsonmeaning no violations are fixed in this PR and no violations should be found when the linter runs. Any newly introduced violations should be caught.SwiftLint will run on build or test and will raise warnings/errors.
Run manually with
swift package plugin swiftlintor install the SwiftLint executable (e.g. from Homebrew).This PR also introduces a
Brewfilewithswiftlintas the only current brew. This will install the SwiftLint binary when runningbrew bundle.Editor Config Changes
By default, Xcode does not remove whitespace from lines that contain only whitespace. Trailing whitespace on empty lines is a linter violation. To prevent life from being sad, it's best to configure Xcode to trim whitespace only lines.
Xcode > Settings > Editing > Enable "Trim whitespace-only lines"