SwiftLint
SwiftLint copied to clipboard
Is there any way to specify an output file for SwiftLint reports instead of using '>' ?
I want to save a json report of my SwiftLint BuildToolPlugin so I can use it elsewhere.
I am currently trying the following:
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",
"--reporter", "json",
">", "swiftlint.result.json"
],
environment: [:]
)
]
}
}
But that basically boils down to the following command in which the quotes around the '>' character prevents creating an output file.
swiftlint lint \
--in-process-sourcekit \
--path BusinessModel \
--config .swiftlint.yml \
--reporter json ">" swiftlint.result.json
Is there any way to specify an output file for SwiftLint reports instead of using '>' ?