-
Notifications
You must be signed in to change notification settings - Fork 984
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
Apply swift-format to StripeCore #2055
Conversation
StripeCore/StripeCoreTests/Categories/UIImage+StripeCoreTests.swift
Outdated
Show resolved
Hide resolved
This looks great! I'm not picky on the actual settings either. Added one comment, it looks like the formatter did something weird with our |
I added this while I was formatting locally but it shouldn't be committed yet.
Can we remove whatever rule is removing |
That was me removing them manually because that doc line is invalid, it should be in the form of a sentence. |
Looks like Swift is adding an official feature for this to the next release: https://forums.swift.org/t/nodoc-attribute-for-hiding-symbols-from-the-symbol-graph/59227/49 |
Ok. I can either add |
I think we should hold off on the documentation-related rules for now — we have a lot of |
Yeah, I'm gonna disable them. |
Summary
Applying swift-format to StripeCore.
First step to enable swift-format as a CI check.
Started with this project since is the lowest in the pyramid and relatively small. Most of the changes you'll see are in doc comments, which I sadly had to make manually since I didn't find any tool that can fix those automatically, and since it was quite tedious to do, I think I will have to disable documentation related checks at least to begin with.
On everything else, I used most of the default configuration with just a couple of settings changed:
AlwaysUseLowerCamelCase
andOnlyOneTrailingClosureArgument
because we have plenty of cases in our codebase that violate those rules, the first one mostly because of theSTP
prefix, and it wouldn't make sense to try and change all of that just to enable these settings.lineBreakBeforeEachArgument
andprioritizeKeepingFunctionOutputTogether
are just a personal preference, which is open for discussion if anyone has a different preference.In the end any settings we decide to use don't matter much, the point is using a common style and let the formatter take care of it so we don't have to.
Motivation
Establish style guidelines.
Testing