Closed tsheaff closed 2 years ago
Just want to comment: heck yes! I love code formatters, they remove stress and make things much easier to read and maintain. 👍
Hey @tsheaff, thanks so much for working on this awesome improvement, and congrats on the first PR!
We'll get a review on it soon.
Can we show you some appreciation?
Thanks @tzarebczan I just sent an email for any appreciation 🎩
Once this merges, a repo admin should make the formatter a blocking step for merges on the master
branch.
Any thoughts on the particular formatter rules @tzarebczan or @eclectocrat ? I think it looks good but y'all have (much) more experience with this codebase.
This is great stuff, thanks! It's always nice to see developments like this. I will review this in a bit.
Thanks @akinwale !
@akinwale can you enforce the lint
job to be a required step before merging under the repo's Settings > Branches > master
settings?
Rationale
Formatters are an excellent way to support developer velocity as more contributors are active in a codebase. Some advantages:
Why SwiftFormat?
The most full-featured and well-adopted swift formatter is SwiftFormat. It's very configurable (see rules here) but comes with a nice set of defaults. I've used it in other projects I've worked on, and everyone seemed to really like it.
Approach
This PR does the following:
swiftformat .
to enforce the style across the codebase. This is where ~99% of this diff comes from, and was all done automatically with that one command.SwiftFormat
always pass before merging tomaster
using GitHub Workflows. Once this PR merges, this can be enforced on themaster
branch by a repo admin under Settings > Branches, guaranteeing that everything onmaster
always formats properlySwiftFormat
in theREADME.md
so that devs can run it locally.I'm super open to tweaking the
.swiftformat
configuration if the team feels some of the defaults or the few overrides I proposed aren't ergonomic for this codebase.Rollout
If there are any outstanding branches that have not yet merged before this does, the process to avoid conflicts is very simple:
master
back to your branch after this merges.swiftformat .
locally to get the formatter passing once again.master