-
Notifications
You must be signed in to change notification settings - Fork 4
feature/Add custom lint check for resource extensions #291
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
base: develop
Are you sure you want to change the base?
Conversation
This commit introduces a new lint module and a custom lint check, `ResExtensionDetector`. The detector flags the following usages as errors: - Using raw integer literals with `.string` or `.painter` extensions (e.g., `1.string`). - Using resource IDs that are not from `R.string` or `R.drawable` with these extensions. The lint check is applied to the `app`, `designSystem`, and `presentation` modules. Additionally, this commit includes: - Gradle and library updates. - Minor refactoring in `SearchRemoteDataSourceImpl` and `RecentWatchedTvShowsDataSource` to use `@Provided` Koin annotation. - Update to `getCurrentDate()` to use `kotlin.time.Clock`. - Update target and compile SDK versions to 36. - Added new experimental opt-ins to compiler arguments.
|
[London Bot] Metrics Update Status 📊 PR metrics successfully updated for event: |
|
[London Bot] Auto-update Status ✅ Branch successfully updated from |
Pull request was converted to draft
yusufnasserdev
left a comment
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.
The linting addition is great, also the additional fixes are much appreciated, however, the version pumps starting from the gradle wrapper going through multiple libraries in the toml file might be unnecessary, considering many pumps at the same time.
Overall great job 🔥
| "Only use constants from R.string or R.drawable with `.string` or `.painter`." | ||
| ) | ||
| } | ||
| } |
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.
Nice work!
What do you think about adding another detector to catch cases like painterResource(R.drawable.icon) and suggest a quick fix to use the extension style R.drawable.icon.painter instead?
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.

This commit introduces a new lint module and a custom lint check,
ResExtensionDetector.The detector flags the following usages as errors:
.stringor.painterextensions (e.g.,1.string).R.stringorR.drawablewith these extensions.The lint check is applied to the
app,designSystem, andpresentationmodules.Additionally, this commit includes:
SearchRemoteDataSourceImplandRecentWatchedTvShowsDataSourceto use@ProvidedKoin annotation.getCurrentDate()to usekotlin.time.Clock.