Skip to content

Conversation

@Al-Taie
Copy link
Contributor

@Al-Taie Al-Taie commented Jul 26, 2025

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.

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.
@Al-Taie Al-Taie requested a review from a team July 26, 2025 23:29
@Al-Taie Al-Taie self-assigned this Jul 26, 2025
@Al-Taie Al-Taie added the enhancement New feature or request label Jul 26, 2025
@london-bot
Copy link
Contributor

london-bot bot commented Jul 26, 2025

[London Bot] Metrics Update Status

📊 PR metrics successfully updated for event: synchronize.

@Al-Taie Al-Taie enabled auto-merge (squash) July 26, 2025 23:30
@london-bot
Copy link
Contributor

london-bot bot commented Jul 26, 2025

[London Bot] Auto-update Status

✅ Branch successfully updated from develop.

@Al-Taie Al-Taie changed the title feat(lint): Add custom lint check for resource extensions feature/Add custom lint check for resource extensions Jul 26, 2025
@Al-Taie Al-Taie marked this pull request as draft July 27, 2025 01:18
auto-merge was automatically disabled July 27, 2025 01:18

Pull request was converted to draft

Copy link
Collaborator

@yusufnasserdev yusufnasserdev left a 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`."
)
}
}

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?

Copy link
Contributor Author

@Al-Taie Al-Taie Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice suggestion thanks, actually I already did that before your comment :)
But I did not find a time to finalize and push the code.
Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants