SwiftLint
SwiftLint copied to clipboard
swiflint adding incorrect spaces
swiflint adding incorrect spaces, i dont know if is a configuration issue or a bug in swiftlint, thanks for helping me
for example
func getIcon() -> UIImage ?{ func getIcon() -> UIImage? {
if hasToSav e{ if hasToSave {
HStac k{ HStack {
Environment
- SwiftLint version: 0.55.1
- Installation method: Homebrew
- Paste your configuration file:
excluded: # exclude these files and directories
- node_modules
- APISchema
Please provide a small code snippet you run SwiftLint on together with the changed code. Also mention the command you are running.
I'm executing this command
swiftlint --autocorrect
original code:
HStack{
Spacer()
Button(action: {
dismiss()
}, label: {
SwiftUI.Image(.deleteClose)
})
}.padding(.horizontal, -20)
changed code:
HStac k{
Spacer()
Button(action: {
dismiss()
}, label: {
SwiftUI.Image(.deleteClose)
})
}.padding(.horizontal, -20)
original code:
func getIcon() -> UIImage?{
switch self {
case .komootPlanned:
return UIImage(named: "komoot_empty")
case .komootRecorded:
return UIImage(named: "komoot_empty")
case .notifications:
return UIImage(named: "notifications_empty")
case .subscriptions:
return UIImage(named: "subscriptions_empty")
}
}
changed code:
func getIcon() -> UIImage ?{
switch self {
case .komootPlanned:
return UIImage(named: "komoot_empty")
case .komootRecorded:
return UIImage(named: "komoot_empty")
case .notifications:
return UIImage(named: "notifications_empty")
case .subscriptions:
return UIImage(named: "subscriptions_empty")
}
}
I am also having the same issue
I'm unable to reproduce this. My involved files and commands are as follows:
.swiftlint.yml
only_rules:
- opening_brace
main.swift
func getIcon() -> UIImage?{
nil
}
$ swiftlint --version
0.55.1
$ swiftlint lint --fix main.swift
Correcting Swift files at paths main.swift
Correcting 'main.swift' (1/1)
/Users/danny/Projects/SwiftLint/main/main.swift:1:27 Corrected Opening Brace Spacing
Done correcting 1 file!
main.swift
func getIcon() -> UIImage? {
nil
}
Please provide an example as small as possible which causes broken output with these steps.
Give me a moment when I’m back in office and I’ll send over what causes it. I ran it on my entire source folder I’m not sure if that’s how it works by design but it added a weird white space to about 23 ish files mainly SwiftUI based code
On Sat, Jul 13, 2024 at 7:55 AM Danny Mösch @.***> wrote:
I'm unable to reproduce this. My involved files and commands are as follows:
.swiftlint.yml
only_rules:
- opening_brace
main.swift
func getIcon() -> UIImage?{ nil}
$ swiftlint --version 0.55.1
$ swiftlint lint --fix main.swift Correcting Swift files at paths main.swift Correcting 'main.swift' (1/1) /Users/danny/Projects/SwiftLint/main/main.swift:1:27 Corrected Opening Brace Spacing Done correcting 1 file!
main.swift
func getIcon() -> UIImage? { nil}
Please provide an example as small as possible which causes broken output with these steps.
— Reply to this email directly, view it on GitHub https://github.com/realm/SwiftLint/issues/5663#issuecomment-2226874997, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ3O33LXX67LM3RZGSC4POLZMEISXAVCNFSM6AAAAABKVMSZWOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRWHA3TIOJZG4 . You are receiving this because you commented.Message ID: @.***>
Thanks, I'm doing the same, all source folder, I can send more info tomorrow, thanks for providing more info
@gavinmcroy @pablorodriguezcolbaes - any update on this?
This issue has been marked as stale because it has not seen any activity in the last 4 months. It is going to be closed soon if it stays inactive.
This issue is being closed due to inactivity. Please feel free to reopen if you have more information.