Conversation
|
@calda Could you please explain why in my project when I try to get new rule with cocoapods:
I have an error: Before merging I'd like to test rule in my project and can't understand why it not see my new rule. |
|
|
||
| /// Formatting linebreaks | ||
| /// Setting `linebreaksCount` linebreaks in `indexes` | ||
| func leaveOrSetLinebreaksInIndexes(_ indexes: Set<Int>, linebreaksCount: Int) { |
There was a problem hiding this comment.
Can we put this in an extension in SpacingGuards.swift? Like:
extension Formatter {
/// Formatting linebreaks
/// Setting `linebreaksCount` linebreaks in `indexes`
func leaveOrSetLinebreaksInIndexes(_ indexes: Set<Int>, linebreaksCount: Int) { ... }
}There was a problem hiding this comment.
I can put it there as fileprivate func. However it could be useful for other rules. If so - better to leave it in common place public extension Formatter.
calda
left a comment
There was a problem hiding this comment.
Looking good!
I see there are still several failing tests that need to be updated. Let me know if you have any questions about how to fix them or run in to issues!
| } | ||
|
|
||
| let isGuard = nextNonSpaceAndNonLinebreakToken == .keyword("guard") | ||
| let indexesBetween = Set(endOfScopeOfGuard + 1 ... nextNonSpaceAndNonLinebreakIndex - 1) |
There was a problem hiding this comment.
When running the tests locally I hit a crash here from endOfScopeOfGuard + 1 and nextNonSpaceAndNonLinebreakIndex - 1 being the same value, which is not allowed in a ClosedRange.
You can fix this by using a Range instead:
| let indexesBetween = Set(endOfScopeOfGuard + 1 ... nextNonSpaceAndNonLinebreakIndex - 1) | |
| let indexesBetween = Set(endOfScopeOfGuard + 1 ..< nextNonSpaceAndNonLinebreakIndex) |
|
@calda done |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1804 +/- ##
===========================================
- Coverage 95.17% 95.16% -0.01%
===========================================
Files 132 133 +1
Lines 23723 23782 +59
===========================================
+ Hits 22578 22632 +54
- Misses 1145 1150 +5 ☔ View full report in Codecov by Sentry. |
|
@calda @nicklockwood Could we please add this rule to release? |
|
I plan on making a new release in the next few weeks |
|
Would be appreciated) I have a couple of minds about new rules, but don't wont to spend time for them if the rule not releasing.) |
|
In the mean time, I set up a new nightly build pipeline. Using a nightly build would let you start using new rules / options right away in your projects before they're included in an official release: https://github.com/nicklockwood/SwiftFormat?tab=readme-ov-file#prerelease-builds |
|
@calda Can I use them via cocoapods? |
|
We don't have it set up to support Cocoapods. We also just updated Homebrew support so that |
|
0.56.0 has been released and includes this change: https://github.com/nicklockwood/SwiftFormat/releases/tag/0.56.0 Thanks for your patience @NikKovIos, more rules are always welcome! |


This is a fixed version of #1801
Also added readme for #1777