Swiftlint on Linux

I am trying to get swiftlint working in my CI. To do so I created a new docker image with swiftlint installed (since swiftlint only downloads a macOS version of the binary it seems) and then added it to my targets.

However, when I run swift build I get the following error:

error: a prebuild command cannot use executables built from source, including executable target 'swiftlint'

How can I fix this?

1 Like

SwiftLint’s built-in SwiftPM plug-in currently only works on macOS. You can wait for that to be updated to support Linux (no timeline) or run the SwiftLint executable directly, or use a different SwiftPM plugin that runs SwiftLint on Linux, I believe there are a few.

1 Like