Skip to content
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

SwiftLint setup – Part 1 – Local only SwiftLint, with local configuration #517

Closed
wants to merge 7 commits into from

Conversation

mokagio
Copy link
Contributor

@mokagio mokagio commented Jun 6, 2022

Description

This is the most basic SwiftLint setup we could have:

  1. Installed locally, with version managed via CocoaPods. Note that there are alternatives, but the one with the best straightforwardness to level of control I could find in the context of HACK Week.
  2. Use a config file tracked locally.
  3. Run only as an Xcode Build Phase Run Script

Testing Details

Checkout this branch, and update the code to trigger a SwiftLint violation. The simplest thing to do is add a ; at the end of a line in the production and test code. Build the app and verify that Xcode shows a warning.

Next Steps

  • Use a remote configuration, so that we can share it across various project and maintain a consistent style
  • Experiment: Use Danger instead of Hound for inline comments. This is slower but more configurable.

  • Please check here if your pull request includes additional test coverage. – N.A.
  • I have considered updating the version in the .podspec file. – N.A.

mokagio added 7 commits June 6, 2022 15:26
I find this is a simpler way to add SwiftLint because, by using a tool
that is already a required part of the setup, it doesn't need extra
scripts or commands that devs may forget to run.

In the long run, we'll want to install SwiftLint in a Ruby-less way.
This commit comes in the context of a HACK Week project, where I'm more
interested in bringing stuff to a working state soon rather than
crafting the best solution.

We can always iterate on top of this and change the SwiftLint install
mode later on.
This happened automatically as a result of adding a build phase run
script step. I decided to track the upgrade changes in isolation to make
reviewing easier.
This ensures more targeted feedback from the tool. That is, if you are
only building the production target, you shouldn't get warnings for the
test target.
@mokagio
Copy link
Contributor Author

mokagio commented Mar 17, 2024

Closed in favor of #693 and #735

@mokagio mokagio deleted the swiftlint-locally branch March 17, 2024 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant