SwiftLint icon indicating copy to clipboard operation
SwiftLint copied to clipboard

How to enable SwiftLint for Xcode Cloud?

Open moyoteg opened this issue 2 years ago • 2 comments

How I go about using SwiftLint with Xcode Cloud?

custom script?

moyoteg avatar Jun 15 '22 18:06 moyoteg

We've just added a ci_post_clone.sh that installs SwiftLint via HomeBrew: brew install swiftlint

And then you are good to go with your regular Build Phase script.

jpstuehler avatar Jun 22 '22 19:06 jpstuehler

FWIW, for background there is a more detailed description of Xcode Cloud scripts here:

https://developer.apple.com/documentation/xcode/writing-custom-build-scripts

And here is someone's writeup of doing this for swiftlint specifically ( (I forgot to chmod +x ci_post_clone.sh on my first attempt 🤦 ):

https://www.oliverbinns.co.uk/2022/01/04/some-thoughts-on-xcode-cloud/

mikemee avatar Sep 01 '22 03:09 mikemee

Anyone using the SPM plugin? How do you get that working with Xcode Cloud? I'm just getting "SwiftLintPlugin" is disabled error when one of the packages in the Xcode project is using SwiftLint as plugin.

Screenshot 2023-03-13 at 12 01 11

pahnev avatar Mar 13 '23 10:03 pahnev

Anyone using the SPM plugin? How do you get that working with Xcode Cloud? I'm just getting "SwiftLintPlugin" is disabled error when one of the packages in the Xcode project is using SwiftLint as plugin.

Screenshot 2023-03-13 at 12 01 11

@pahnev I've not used Xcode Cloud yet, but could this be related to the Plugin not being trusted in that environment?

xcodebuild offers a -skipPackagePluginValidation flag to bypass this trust check. In Swift Package Manager this can be done by the --resolver-fingerprint-checking flag.

You can also set defaults write com.apple.dt.Xcode IDESkipPackagePluginFingerprintValidatation -bool YES in your post clone script as described here https://forums.swift.org/t/telling-xcode-14-beta-4-to-trust-build-tool-plugins-programatically/59305/7

pschneider avatar Mar 13 '23 10:03 pschneider