-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pin SwiftLint #4258
Draft
JayShortway
wants to merge
14
commits into
main
Choose a base branch
from
pin-swiftlint
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Pin SwiftLint #4258
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
0a821c3
Installs SwiftLint through SPM.
JayShortway cc2ce28
CI no longer installs SwiftLint via Homebrew.
JayShortway 0565f33
Removes SwiftLint from the Brewfile.
JayShortway dfea1ec
Adds SwiftLint as an Xcode Package Dependency and uses it as a Build …
JayShortway 4892ba5
pre-commit.sh is adjusted to use SwiftLint as a Swift package plugin
JayShortway 43f2fc8
pre-commit.sh correctly prints SwiftLint version
JayShortway 1235b90
Cleans up the output from pre-commit.sh printing the SwiftLint version
JayShortway 12cf9eb
CI uses SwiftLint as a swift package plugin.
JayShortway 6022e17
Adds swift to dependabot.
JayShortway 5b75763
Revert "Adds SwiftLint as an Xcode Package Dependency and uses it as …
JayShortway cf1aa39
swiftlint.sh calls swiftlint as a swift package plugin.
JayShortway eb8e20c
Reverts unintended changes to the Brewfile.
JayShortway 8f0256a
Fixes swiftlint.sh using xcrun.
JayShortway 854cd35
Updates Package.resolved in the xcodeproj.
JayShortway File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,8 @@ let shouldIncludeDocCPlugin = environmentVariables["INCLUDE_DOCC_PLUGIN"] == "tr | |
var dependencies: [Package.Dependency] = [ | ||
.package(url: "[email protected]:Quick/Nimble.git", from: "10.0.0"), | ||
// SST requires iOS 13 starting from version 1.13.0 | ||
.package(url: "[email protected]:pointfreeco/swift-snapshot-testing.git", .upToNextMinor(from: "1.12.0")) | ||
.package(url: "[email protected]:pointfreeco/swift-snapshot-testing.git", .upToNextMinor(from: "1.12.0")), | ||
.package(url: "https://github.com/SimplyDanny/SwiftLintPlugins", exact: "0.57.0") | ||
] | ||
if shouldIncludeDocCPlugin { | ||
// Versions 1.4.0 and 1.4.1 are failing to compile, so we are pinning it to 1.3.0 for now | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Arm64 macs have this destination. | ||
HOMEBREW_BINARY_DESTINATION="/opt/homebrew/bin" | ||
if ! test -d $HOMEBREW_BINARY_DESTINATION; then | ||
# X86_64 macs have this destination | ||
HOMEBREW_BINARY_DESTINATION="/usr/local/bin" | ||
fi | ||
|
||
echo "Adding homebrew bin folder to PATH (${HOMEBREW_BINARY_DESTINATION})" | ||
PATH="${HOMEBREW_BINARY_DESTINATION}:${PATH}" | ||
|
||
if which swiftlint >/dev/null; then | ||
script_path="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" | ||
source_path="${script_path}/../" | ||
swiftlint_path="$(which swiftlint)" | ||
|
||
echo "linter path:" | ||
echo $swiftlint_path | ||
|
||
lint_command="${swiftlint_path} lint" | ||
echo "linter command: ${lint_command}" | ||
|
||
pushd "${source_path}" | ||
# Run swiftlint but filter out "Linting ..." to clean up output | ||
$lint_command 2>&1 | grep -v 'Linting ' | ||
popd | ||
else | ||
echo "Warning: SwiftLint not installed in ${HOMEBREW_BINARY_DESTINATION}, download from https://github.com/realm/SwiftLint" | ||
fi | ||
|
||
xcrun --sdk macosx swift package plugin swiftlint lint --quiet |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't work because somehow swift package plugins run for every module. Only the last of those runs will save the output file, causing issues to be lost.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running it with verbose output tells me it's running for each module, which map to the targets specified in our
Package.swift
:I think this is
swift package
that's running theplugin
command for each target. It seems to be happening outside ofswiftlint
's control. Not sure yet how to makeswift package
confine itself to a single target.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a convention to support a
--target
argument. SwiftLint's command plugin supports it partly. It passes the--target
argument on to the actualswiftlint
program, which doesn't recognize it and errors out.There’s a fork that fixes this issue. I’ve asked if they can propose their fix upstream.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0.57.1 includes a fix for this.