kiwix / kiwix-apple

Kiwix for offline access on iOS and macOS
https://apple.kiwix.org
GNU Lesser General Public License v3.0
434 stars 69 forks source link

White spaces stripping #720

Closed rgaudin closed 1 month ago

rgaudin commented 1 month ago

Other projects strip extra white spaces everywhere ; usually via a pre-commit hook and a QA workflow.

Looking at https://github.com/kiwix/kiwix-apple/pull/719/files I wonder if there's an Apple/XCode convention of keeping whitespaces that we should follow of if there's no harm in aligning with the rest of the projects.

I see this on my XCode prefs which I believe are the defaults since I don't use it.

Screenshot 2024-04-01 at 09 29 31
BPerlakiH commented 1 month ago

See the related thread on SwiftLint here: https://github.com/realm/SwiftLint/issues/271

Personally I had this featured turned on in Xcode so many years ago, that I even forgot about it. This feature is not always working as you can see. I don't know anything about being able to set this on a per project basis in Xcode.

There are ways to auto format code, SwiftLint has autocorrect, I think our code factor integration is already using that. There's also swift-format, but that's doing more than just white space and we should probably align that with swiftlint (code-factor), so that there's no conflict, or only use one of them (eg. as post commit hook).

I will added a comment to our README about this Xcode option, that is the quickest we can do at the moment.