Fix #3511: vertical_whitespace_between_cases handle '@unknown default'#5843
Conversation
SimplyDanny
left a comment
There was a problem hiding this comment.
What about whitespace other than a single space between the attribute and default?
|
Aka, you think the regex should be more like |
I also think about newlines in between, e.g. @unknown
default: ... |
|
Ah I see. I hadn't considered that, but I could imagine someone trying that. I'll add a unit test for that and adjust the regex. |
|
I gave it some attempts but I can't figure it out. The rule always seems to add an extra newline between the The issue is that I tried using a negative-lookbehind ( I think supporting this would require reworking how the Rule operates (maybe requiring it to use the AST rather than regex?). Happy to try something else if you have another idea. I think this patch is strictly better than what is on-tree, even if it's not perfect. So maybe we can merge even with this limitation? |
It's definitely an improvement already. So I'm fine to merge it as is. However, I'm also open to review a rewrite using SwiftSyntax instead of regex in a next step. 😉 Please rebase and fix the conflicts, though. |
… using @unknown before default
d770b55 to
c5576f2
Compare
This rule does not recognize the
@unknown defaultvariant. Fixes #3511 .