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

Add an option for trimmingTrailingWhitespace to ignore whitespace only lines #738

Open
CraigSiemens opened this issue Jun 14, 2022 · 6 comments

Comments

@CraigSiemens
Copy link

CraigSiemens commented Jun 14, 2022

I recently tried running SwiftLint with --fix --format and saw that it removed thousands of whitespace only lines. It'd be great if the options could mirror the options available in Xcode. Particularly an option to ignore whitespace only lines.

Padded Screen Shot 2022-06-14 at 12 27 11 PM

@jpsim
Copy link
Owner

jpsim commented Aug 22, 2022

That's not implemented here, it's implemented in SourceKit and SwiftLint.

@jpsim jpsim closed this as completed Aug 22, 2022
@CraigSiemens
Copy link
Author

@jpsim
Copy link
Owner

jpsim commented Aug 22, 2022

Huh, yes you're right. Sorry for closing then, I'm surprised I hooked it up this way.

@OmranK
Copy link

OmranK commented Sep 21, 2023

Would really love the option to make SwiftLint --fix --format mimic the default behavior of Xcode format (⌃ + I)

@OmranK
Copy link

OmranK commented Dec 5, 2023

Going to tackle this. Should the implementation add an additional function parameter:

public func format(trimmingTrailingWhitespace: Bool, ignoringEmptyLines: Bool, useTabs: Bool, indentWidth: Int)

or should it be the default behavior?

@OmranK
Copy link

OmranK commented Feb 26, 2024

@jpsim can you let me know if there is any concerns with my implementation so I can fix them and get it merged in.

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

3 participants