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

Autocorrect on unneeded_parentheses_in_closure_argument rule does not insert whitespace #3633

Closed
2 tasks done
p-x9 opened this issue May 17, 2021 · 2 comments
Closed
2 tasks done

Comments

@p-x9
Copy link
Contributor

p-x9 commented May 17, 2021

New Issue Checklist

Describe the bug

If a tuple is used in the argument of a closure, and there is no space between the tuple and "in", the code will be wrong when autocorrected.(See the 'Sample.swift' code below.)

Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint --path Sample.swift --no-cache --enable-all-rules --fix
Correcting Swift files at paths Sample.swift
Correcting 'Sample.swift' (1/1)
/Users/p-x9/Desktop/Sample.swift:2:21 Corrected Unneeded Parentheses in Closure Argument
Done inspecting 1 file for auto-correction!

Environment

  • SwiftLint version : 0.43.1
  • Installation method used :Homebrew
  • Paste your configuration file: none
  • Are you using nested configurations: No
  • Which Xcode version are you using (check xcodebuild -version): Xcode 12.5,Build version 12E262
  • Do you have a sample that shows the issue? Run echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rules
    to quickly test if your example is really demonstrating the issue. If your example is more
    complex, you can use swiftlint lint --path [file here] --no-cache --enable-all-rules.

Sample.swift

let dictionary = [String: Int]()
dictionary.forEach {(key, value)in
    print(key, value)
}

Sample.swift(autocorrected)

let dictionary = [String: Int]()
dictionary.forEach {key, valuein
    print(key, value)
}
@marcelofabri
Copy link
Collaborator

@p-x9 This shouldn't be too hard to fix, do you want to give it a shot?

@p-x9
Copy link
Contributor Author

p-x9 commented May 20, 2021

@marcelofabri please confirm the pullrequest.

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

No branches or pull requests

2 participants