Spotless updates and lint#55
Conversation
There was a problem hiding this comment.
Hello @cartland, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
This pull request focuses on improving code formatting, updating library versions, and resolving linting issues in the Fruitties project. The changes are primarily driven by running ./gradlew :androidApp:spotlessApply and ./gradlew lint. It addresses formatting inconsistencies, updates library versions in libs.versions.toml, fixes a duplicate declaration for iOS architectures, disables a ktlint error for Composable functions, and specifies the iOS bundle ID to resolve a compiler warning.
Highlights
- Code Formatting: Applies formatting updates using
./gradlew :androidApp:spotlessApplyto ensure consistent code style. - Dependency Updates: Updates library versions in
libs.versions.tomlto use the latest versions of dependencies. - ktlint Configuration: Configures ktlint to ignore function naming errors for Composable functions, allowing them to start with a capital letter.
- iOS Configuration: Specifies the iOS bundle ID in the project settings to resolve a compiler warning.
- iOS Architecture Fix: Fixes a duplicate declaration of
iossimulatorarm64instead ofiosarm64inlibs.versions.toml.
Changelog
Click here to see the changelog
- Fruitties/.editorconfig
- Adds a ktlint configuration to ignore function naming errors for Composable functions, allowing them to start with a capital letter. Lines 1-4
- Fruitties/androidApp/src/main/java/com/example/fruitties/android/MyApplicationTheme.kt
- Reformatted the code for better readability, specifically around the
colors,typography, andshapesdefinitions within theMyApplicationThemecomposable function. Lines 38-66
- Reformatted the code for better readability, specifically around the
- Fruitties/androidApp/src/main/java/com/example/fruitties/android/di/App.kt
- Adds an empty line for better readability. Line 26
- Fruitties/androidApp/src/main/java/com/example/fruitties/android/ui/ListScreen.kt
- Reformatted code for better readability, specifically around the
extrasandviewModeldefinitions. Lines 78-86 - Reformatted code for better readability in the
CenterAlignedTopAppBarandcontentWindowInsetssections. Lines 98-113 - Reformatted code for better readability around the
SpacerwithwindowInsetsBottomHeight. Lines 152-154 - Reformatted code for better readability in the
FruittieItemcomposable, specifically around theCardand its content. Lines 169-221 - Reformatted code for better readability in the
CartDetailsViewcomposable. Lines 231-234
- Reformatted code for better readability, specifically around the
- Fruitties/gradle/libs.versions.toml
- Updates the version of
kspfrom2.1.10-1.0.29to2.1.10-1.0.30. Line 28 - Fixes a duplicate declaration of
iossimulatorarm64instead ofiosarm64by correcting the module name forkotlinx-coroutines-core-iosarm64. Line 57
- Updates the version of
- Fruitties/iosApp/iosApp.xcodeproj/project.pbxproj
- Specifies the iOS bundle ID (
com.example.fruitties.ios) in the project settings for both the Debug and Release configurations. Lines 336 and 365
- Specifies the iOS bundle ID (
- Fruitties/iosApp/iosApp/Info.plist
- Moves the
<key>UILaunchScreen</key>block to be after the<key>UIApplicationSupportsMultipleScenes</key>block. Lines 28-29 - Removes a duplicate
<key>UILaunchScreen</key>block at the end of the file. Lines 45-46
- Moves the
- Fruitties/shared/build.gradle.kts
- Removes unused imports
org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApiandorg.jetbrains.kotlin.gradle.dsl.JvmTarget. Lines 16-17 - Adds
binaryOptions["bundleId"] = iosBundleIdto theiosX64,iosArm64, andiosSimulatorArm64configurations to specify the iOS bundle ID. Lines 59, 66, and 73 - Removes an unnecessary empty line. Line 142
- Removes unused imports
- Fruitties/shared/src/androidMain/kotlin/com/example/fruitties/di/Factory.android.kt
- Reformatted code for better readability, specifically around the
Factoryclass and its functions. Lines 27-47 - Replaces
dbFileNamewithDB_FILE_NAME. Line 31
- Reformatted code for better readability, specifically around the
- Fruitties/shared/src/commonMain/kotlin/com/example/fruitties/DataRepository.kt
- Reformatted code for better readability, specifically around the
cartDetailsproperty and theloadDatafunction. Lines 37-45 and 60-61
- Reformatted code for better readability, specifically around the
- Fruitties/shared/src/commonMain/kotlin/com/example/fruitties/database/AppDatabase.kt
- Replaces
dbFileNamewithDB_FILE_NAME. Line 35
- Replaces
- Fruitties/shared/src/commonMain/kotlin/com/example/fruitties/database/CartDataStore.kt
- Reformatted code for better readability, specifically around the
CartJsonSerializerobject and theCartDataStoreclass. Lines 43-71
- Reformatted code for better readability, specifically around the
- Fruitties/shared/src/commonMain/kotlin/com/example/fruitties/database/FruittieDao.kt
- Removes an unnecessary empty line. Line 28
- Fruitties/shared/src/commonMain/kotlin/com/example/fruitties/di/Factory.kt
- Reformatted code for better readability, specifically around the
commonCreateApifunction. Lines 34-41
- Reformatted code for better readability, specifically around the
- Fruitties/shared/src/commonMain/kotlin/com/example/fruitties/network/FruittieApi.kt
- Reformatted code for better readability, specifically around the
FruittieNetworkApiclass. Lines 28-31
- Reformatted code for better readability, specifically around the
- Fruitties/shared/src/commonMain/kotlin/com/example/fruitties/viewmodel/MainViewModel.kt
- Reformatted code for better readability, specifically around the
MainViewModelclass and its properties. Lines 38-52
- Reformatted code for better readability, specifically around the
- Fruitties/shared/src/iosMain/kotlin/com/example/fruitties/di/Factory.native.kt
- Replaces
dbFileNamewithDB_FILE_NAME. Line 34 - Reformatted code for better readability, specifically around the
Factoryclass and its functions. Lines 33-57
- Replaces
- Fruitties/shared/src/iosMain/kotlin/com/example/fruitties/di/viewmodel/IOSViewModelOwner.kt
- Reformatted code for better readability, specifically around the
IOSViewModelOwnerclass. Lines 14-22
- Reformatted code for better readability, specifically around the
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
A spotless code,
A lint-free, shining grace,
Fruits of our labor.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
The pull request focuses on updating formatting, library versions, and addressing specific issues like duplicate declarations and compiler warnings. The changes seem well-organized and address the stated goals.
Summary of Findings
- Redundant code: The
kotlinx-coroutines-core-iossimulatorarm64dependency is declared twice inlibs.versions.toml, which is redundant and should be removed. - Inconsistent code formatting: There are some inconsistencies in code formatting, such as extra line breaks and indentation, which could be improved for better readability.
- Duplicated bundle ID definition: The bundle ID is defined as a constant in
shared/build.gradle.ktsand also hardcoded iniosApp/iosApp.xcodeproj/project.pbxproj. It should be defined in one place to avoid inconsistencies.
Merge Readiness
The pull request is almost ready for merging. Addressing the redundant code, inconsistent formatting, and duplicated bundle ID definition would improve the overall quality and maintainability of the code. I am unable to directly approve this pull request, and recommend that others review and approve this code before merging. I recommend that the pull request not be merged until the high severity issues are addressed.
This commit bundles several updates:
1. **Apply Spotless Formatting:**
* Ran `./gradlew :androidApp:spotlessApply` to enforce code style consistency.
2. **Configure ktlint via `.editorconfig`:**
* Added `.editorconfig` to the Fruitties project.
* Configured ktlint to ignore function naming rules for Composable functions.
* Disabled the standard multiline expression wrapping rule to allow for better readability in specific assignment cases.
3. **Update Dependencies:**
* Updated various dependencies in `libs.versions.toml`:
* agp: 8.9.1
* androidx-activityCompose: 1.10.1
* androidx-paging: 3.3.6
* androidx-room: 2.7.0-rc03
* androidx-lifecycle: 2.9.0-alpha13
* compose: 1.7.8
* dataStore: 1.1.4
* kotlin: 2.1.10
* ksp: 2.1.10-1.0.30
* pagingComposeAndroid: 3.3.6
* skie: 0.10.1
* sqlite: 2.5.0-rc03
4. **Set iOS Framework Bundle ID:**
* Explicitly set the `bundleId` for iOS frameworks to `com.example.fruitties.ios` using `binaryOptions["bundleId"]`.
* This resolves the compiler warning: "Please specify the bundle ID explicitly using the -Xbinary=bundleId=<id> compiler flag."
0c519e1 to
b32d1cf
Compare
This commit configures backup rules for the Android application by adding `fullBackupContent` and `dataExtractionRules` attributes to the `application` tag in the `AndroidManifest.xml`. It also includes the corresponding XML files (`full_backup_content.xml` and `data_extraction_rules.xml`) to specify the backup behavior. Additionally, the following dependency versions have been updated in `gradle/libs.versions.toml`: - androidx-room to 2.7.0 - androidx-lifecycle to 2.9.0-beta01 - compose-material3 to 1.3.2 - sqlite to 2.5.0
|
/gemini review |
There was a problem hiding this comment.
Code Review
The pull request focuses on updating dependencies, applying formatting changes, and fixing minor issues. The changes seem reasonable and contribute to maintaining code quality and consistency. However, there are a few areas that could be improved for better clarity and maintainability.
Summary of Findings
- Redundant Code: The
createCartDataStorefunctions in bothandroidMainandiosMaincontain redundant code that can be simplified using a direct return statement. - Unused Imports: There are unused imports in
shared/build.gradle.ktsthat should be removed to reduce clutter and improve readability. - Inconsistent Naming: The database file name is changed from
dbFileNametoDB_FILE_NAME. While using all caps for constants is a good practice, ensure consistency across the codebase.
Merge Readiness
The pull request is almost ready for merging. Addressing the redundant code in createCartDataStore and removing the unused imports would improve the code quality. The naming consistency should also be checked across the codebase. I am unable to directly approve this pull request, and recommend that others review and approve this code before merging. Once these issues are addressed, the pull request should be good to go.
Primarily driven by
./gradlew :androidApp:spotlessApplyand./gradlew lint./gradlew :androidApp:spotlessApplylibs.versions.tomliossimulatorarm64instead ofiosarm64ktlint_function_naming_ignore_when_annotated_with = Composable