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

wrapArguments not formatting everything #1926

Open
NikKovIos opened this issue Nov 21, 2024 · 1 comment
Open

wrapArguments not formatting everything #1926

NikKovIos opened this issue Nov 21, 2024 · 1 comment

Comments

@NikKovIos
Copy link

With rules

wrapArguments
--wrapparameters after-first
--wraparguments after-first
--wrapcollections before-first
--wrapconditions after-first
--wrapreturntype preserve

This works well:

-func test(
-    firstParam: String,
-    secondParam: String
-) -> String {
+    func test(firstParam: String,
+              secondParam: String) -> String {
    return ""
}

But this is ignored:

public func withValue<T: Sendable>(
    _ operation: @Sendable (inout Value) throws -> T
) rethrows -> T {
    try self.lock.sync {
        var value = self._value
        defer { self._value = value }
        return try operation(&value)
    }
}
@nicklockwood
Copy link
Owner

nicklockwood commented Nov 21, 2024

Interesting - it looks like this is an edge case that the rule wasn't designed to handle - namely the case where there is a single argument that has already been wrapped using a different style. Normally single arguments don't get wrapped by the rule at all so it just ignores this case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants