-
Notifications
You must be signed in to change notification settings - Fork 52
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
Adds Detekt rules for Compose. Updates detekt to 1.23.6. #1822
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1822 +/- ##
=======================================
Coverage 82.78% 82.78%
=======================================
Files 222 222
Lines 7680 7680
Branches 1081 1081
=======================================
Hits 6358 6358
Misses 899 899
Partials 423 423 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't used this set of rules, but I think they make sense! I'm afraid of having the smells in the baseline will make us forget it... But I think at least it enables us to fix things moving forward 👍
@tonidero I was debating that in my mind as well. In the end I figured that if we want to fix the smells before adding these rules, it'd be a while before we reap the benefits. Maybe we add tickets or something, to tackle 1 offended rule at a time from the baseline? |
I think that makes sense yeah. I wouldn't consider it a priority, but we can dedicate some time if we have some downtime |
**This is an automatic release.** ### New Features * Paywalls can use custom in-app purchase/restore code (#1777) via James Borthwick (@jamesrb1) ### Bugfixes * [Paywalls] Add spacing between paragraphs and make text go full width so text align applies (#1824) via Josh Holtz (@joshdholtz) ### Dependency Updates * Bump rexml from 3.3.4 to 3.3.6 (#1823) via dependabot[bot] (@dependabot[bot]) * Bump fastlane-plugin-revenuecat_internal from `4c4b8ce` to `85e1c83` (#1812) via dependabot[bot] (@dependabot[bot]) * Adds Detekt rules for Compose. Updates detekt to 1.23.6. (#1822) via JayShortway (@JayShortway) ### Other Changes * Converts MagicWeather's Gradle files to Kotlin (#1821) via JayShortway (@JayShortway) Co-authored-by: revenuecat-ops <ops@revenuecat.com>
Motivation
Compose has many footguns that are easy to forget. (Think state restoration, remembering, modifier parameters, viewmodel forwarding.) It's unrealistic to expect everyone to always remember all of these. These Detekt rules help to avoid these issues a lot, in my experience. Static checks also ease the pressure on code reviews to spot these issues.
You can find a description of the rules here. They were originally developed at Twitter (1.0), and are currently maintained by the engineer who started the project. Slack is maintaining the Lint version of these same rules.
Note: the Detekt IntelliJ plugin doesn't show violations of these rules (running via Gradle / CI does). For that we'd need to point it to a 66 Mb plugin jar file, which is probably a bad idea to add to the repo. We can do something fancy with Gradle to download it automatically, but that's less of a quick win than just adding the rules. So I figured we can do that later.