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

Rule request: Unneeded parentheses in closure argument #1483

Closed
marcelofabri opened this issue May 1, 2017 · 2 comments
Closed

Rule request: Unneeded parentheses in closure argument #1483

marcelofabri opened this issue May 1, 2017 · 2 comments
Labels
rule-request Requests for a new rules.

Comments

@marcelofabri
Copy link
Collaborator

marcelofabri commented May 1, 2017

// good
let foo = { (bar: Int) in
    print(bar)
}

// bad
call(arg: { (bar2) in

})

We could use a regex (\{\s*\([^:]+\)\s*in) to do it and also check for source.lang.swift.decl.var.parameter without a key.typename.

Stole the idea and regex from @keith

@marcelofabri marcelofabri added the rule-request Requests for a new rules. label May 1, 2017
@marcelofabri
Copy link
Collaborator Author

marcelofabri commented May 1, 2017

Maybe this should have an option to allow the parentheses when the return type is explicit and there are more than one parameter? e.g.

ruleList.list.flatMap { (identifier, rule) -> [(String, String)] in
   return rule.description.deprecatedAliases.map { ($0, identifier) }
}

@Jeehut
Copy link
Collaborator

Jeehut commented May 29, 2017

Emphasis on "and", I'd say. See my examples in my request (#1583) to see what I mean what I'd expect to be accepted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule-request Requests for a new rules.
Projects
None yet
Development

No branches or pull requests

2 participants