-
Notifications
You must be signed in to change notification settings - Fork 3
Enable SwiftLint plugin for local development #129
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
Conversation
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 make lint-swift
locally doesn't work for me after this change – it seems like 0.53.0
is the last version that's compatible with linux/arm64/v8
– am I doing it wrong?
Fwiw, this wasn't working for me before this PR either. I had to manually setup |
Yeah, neither 0.53 nor 0.55 work on my Mac. I thought we'll use we have the SwiftLint Swift Package locally, and use the docker image on CI. Maybe we can get rid of the docker image and just use the SwiftLint package: |
41e4b54
to
03b20d7
Compare
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.
Awesome, thanks!
At the moment, SwiftLint issues are not super straightforward to discover. It's part of CI checks, but requires manually running a command locally. Also, after running the swiftlint command, it's pretty hard to identify exact locations of the issues by reading its console output.
This PR integrates SwiftLint plugin into the
WordPressAPI
module, so that we can see linting issue right from Xcode when building the package.However, I don't want to add SwiftLint as part of the package dependencies, which would put extra constraints (also adding unnecessary swift packages) to the consumers. Since Swift Pakcage Manager treats all package dependencies as runtime dependencies, and there is no concept of "build dependencies", I have added some conditional checks in
Package.swift
to only addSwiftLint
for "local development".Since now we have different dependencies on local mac and CI agents, the
Package.resolved
content would be different too. I have checked in thePackage.resolved
file, with SwiftLint and other dependencies in it. But on CI, that file basically gets ignored. I think that should be fine for now. Let me know if you have any concerns.