-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b11f03f
commit 63997e5
Showing
5 changed files
with
75 additions
and
32 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// main.swift | ||
// Plugins/SwiftLint | ||
// | ||
// Created by Lukas Pistrol on 23.06.22. | ||
// | ||
|
||
import PackagePlugin | ||
|
||
@main | ||
struct SwiftLintPlugin: BuildToolPlugin { | ||
func createBuildCommands(context: PluginContext, target: Target) async throws -> [Command] { | ||
return [ | ||
.buildCommand( | ||
displayName: "Running SwiftLint for \(target.name)", | ||
executable: try context.tool(named: "swiftlint").path, | ||
arguments: [ | ||
"lint", | ||
"--in-process-sourcekit", | ||
"--path", | ||
target.directory.string, | ||
"--config", | ||
"\(context.package.directory.string)/.swiftlint.yml" | ||
], | ||
environment: [:] | ||
) | ||
] | ||
} | ||
} |
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,3 +1,30 @@ | ||
# SwiftLintPlugin | ||
|
||
A description of this package. | ||
A SPM Plugin for [SwiftLint](https://github.com/realm/SwiftLint/). | ||
|
||
Implementation like discussed [here](https://github.com/realm/SwiftLint/issues/3840#issuecomment-1085699163). | ||
|
||
## Add to Package | ||
|
||
First add a dependency from this package: | ||
|
||
```swift | ||
dependencies: [ | ||
// ... | ||
.package(url: "https://github.com/lukepistrol/SwiftLintPlugin", from: "0.0.1"), | ||
] | ||
``` | ||
|
||
Then add it to your targets as a plugin: | ||
|
||
```swift | ||
targets: [ | ||
.target( | ||
name: "YOUR_TARGET", | ||
dependencies: [], | ||
plugins: [ | ||
.plugin(name: "SwiftLint", package: "SwiftLintPlugin") | ||
] | ||
), | ||
] | ||
``` |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.