scribe-org / Scribe-iOS

iOS app with keyboards for language learners
https://apps.apple.com/app/scribe-language-keyboards/id1596613886
GNU General Public License v3.0
131 stars 79 forks source link

refactor(swiftlint): enable for_where and fix violations #488

Closed jon-tous closed 3 months ago

jon-tous commented 3 months ago

Contributor checklist


Description

Removed for_where as a disabled rule from .swiftlint.yml and fixed all errors for it in the codebase.

After removing for_where from disabled_rules, I fixed all 6 violations by removing the if statement within each affected for-loop, and moving the condition into a where clause on the for-loop itself. This is the preferred syntax for SwiftLint enforced by the for_where rule, and this refactor does not affect functionality. After making those changes, no SwiftLint warnings were shown, and running swiftlint --strict in the project root confirmed: Done linting! Found 0 violations, 0 serious in 86 files. This rule would now be enforced by SwiftLint to prevent further violations from entering the codebase.

I verified on the iPhone 15 Pro simulator and iPad Pro 13-inch simulator (both iOS 17.5) that the app builds and runs as usual following this change and the affected constraints look as normal. I verified with one of these fixed violations that this refactor does not affect which elements run the body of loop/conditional, using print statements and comparing the values of all the possible constraints before vs. after the refactor.

Related issue

github-actions[bot] commented 3 months ago

Thank you for the pull request!

The Scribe team will do our best to address your contribution as soon as we can. The following is a checklist for maintainers to make sure this process goes as well as possible. Feel free to address the points below yourself in further commits if you realize that actions are needed :)

If you're not already a member of our public Matrix community, please consider joining! We'd suggest using Element as your Matrix client, and definitely join the General and iOS rooms once you're in. Also consider joining our bi-weekly Saturday dev syncs. It'd be great to have you!

Maintainer checklist