-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Fix spotless configuration and apply to all samples except Jetcaster #1563
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
Conversation
Jetcaster format is fixed in a separate PR. I'm doing it this way to prevent million of conflicts, because Jetcaster has major redesign
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.
Hello @mlykotom, 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 the code formatting consistency across the Jetsnack sample application by applying Spotless code formatting to all samples except Jetcaster. The Jetcaster sample will be formatted in a separate pull request due to its refactoring in progress. The changes include adding a .editorconfig file, updating build.gradle.kts files, and reformatting several Kotlin files to adhere to the configured code style.
Highlights
- Spotless Configuration: Configures Spotless Gradle plugin to enforce consistent code formatting across the project.
- Kotlin Formatting: Applies ktlint formatting to all Kotlin (
.kt) and Kotlin script (.kts) files, excluding the Jetcaster sample. - EditorConfig: Adds a
.editorconfigfile to define code style rules for Kotlin files. - Gradle Updates: Updates
build.gradle.ktsfiles to use the new Spotless configuration and correct a URL.
Changelog
Click here to see the changelog
- JetLagged/.editorconfig
- Added
.editorconfigfile to define code style rules.
- Added
- JetLagged/app/build.gradle.kts
- Updated the Apache license URL from
httptohttps. - Added a blank line before the
pluginsblock. - Formatted
proguardFilescalls for better readability.
- Updated the Apache license URL from
- JetLagged/app/src/main/java/com/example/jetlagged/HomeScreenCards.kt
- Reformatted the
BasicInformationalCard,TwoLineInfoCard,AverageTimeInBedCard,AverageTimeAsleepCard,WellnessCard,WellnessBubble, andHomeScreenCardHeadingcomposables to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/JetLaggedDrawer.kt
- Reformatted the
HomeScreenDrawerandScreenContentscomposables, and theHomeScreenDrawerContentscomposable to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/JetLaggedScreen.kt
- Reformatted the
JetLaggedScreencomposable to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/backgrounds/BubbleBackground.kt
- Reformatted the
BubbleBackgroundcomposable andBackgroundBubbleDatadata class to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/backgrounds/FadingCircleBackground.kt
- Reformatted the
FadingCircleBackgroundcomposable to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/backgrounds/SimpleGradientBackground.kt
- Reformatted the
simpleGradientmodifier function to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/backgrounds/SolarFlareShaderBackground.kt
- Reformatted the
solarFlareShaderBackgroundmodifier function andSolarFlairShaderBackgroundNodeclass to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/backgrounds/StripesShaderBackground.kt
- Reformatted the
MovingStripesBackgroundElementdata class,MovingStripesBackgroundNodeclass, andmovingStripesBackgroundmodifier function to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/data/FakeSleepData.kt
- Reformatted the
sleepDatavariable to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/data/JetLaggedHomeScreenState.kt
- Reformatted the
JetLaggedHomeScreenState,WellnessData, andHeartRateOverallDatadata classes to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/heartrate/HeartRateCard.kt
- Reformatted the
HeartRateCardcomposable to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/heartrate/HeartRateGraph.kt
- Reformatted the
HeartRateGraphcomposable,Graphcomposable,DataPointsealed class, andgenerateSmoothPathfunction to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/sleep/JetLaggedHeader.kt
- Reformatted the
JetLaggedHeadercomposable to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/sleep/JetLaggedHeaderTabs.kt
- Reformatted the
SleepTabenum,JetLaggedHeaderTabscomposable, andSleepTabTextcomposable to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/sleep/JetLaggedTimeGraph.kt
- Reformatted the
JetLaggedSleepGraphCardcomposable andJetLaggedTimeGraphcomposable to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/sleep/SleepBar.kt
- Reformatted the
SleepBarcomposable,SleepRoundedBarcomposable, andDetailLegendcomposable to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/sleep/SleepData.kt
- Reformatted the
SleepGraphData,SleepDayData,SleepPerioddata classes, andSleepTypeenum to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/sleep/TimeGraph.kt
- Reformatted the
TimeGraphcomposable,TimeGraphScopeobject, andTimeGraphParentDataclass to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/ui/theme/Theme.kt
- Reformatted the
LightColorScheme,DarkColorScheme,JetLaggedExtraColorsdata class, andJetLaggedThemecomposable to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/ui/theme/Type.kt
- Reformatted the
fontNamevariable,providervariable,fontFamilyvariable,Typographyvariable,TitleBarStylevariable,HeadingStylevariable,SmallHeadingStylevariable,LegendHeadingStylevariable, andTitleStylevariable to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/ui/util/MultiDevicePreview.kt
- Reformatted the
FontScalePreviewsannotation class to adhere to the configured code style.
- Reformatted the
- JetNews/.editorconfig
- Added
.editorconfigfile to define code style rules.
- Added
- JetNews/app/build.gradle.kts
- Updated the Apache license URL from
httptohttps. - Added a blank line before the
pluginsblock. - Formatted
proguardFilescalls for better readability.
- Updated the Apache license URL from
- JetNews/app/src/androidTest/java/com/example/jetnews/HomeScreenTests.kt
- Reformatted the
HomeScreenTestsclass to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/androidTest/java/com/example/jetnews/JetnewsTests.kt
- Reformatted the
JetnewsTestsclass to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/androidTest/java/com/example/jetnews/TestHelper.kt
- Reformatted the
launchJetNewsAppfunction to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/data/interests/impl/FakeInterestsRepository.kt
- Reformatted the
FakeInterestsRepositoryclass to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/data/posts/impl/PostsData.kt
- Reformatted the
pietrovariable,manuelvariable,florinavariable,androidstudioteamvariable,publicationvariable, andparagraphsPost1variable to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/glance/ui/Divider.kt
- Reformatted the
Dividercomposable to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/glance/ui/JetnewsGlanceAppWidget.kt
- Reformatted the
JetnewsGlanceAppWidgetclass to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/glance/ui/Post.kt
- Reformatted the
Postcomposable,DataPointsealed class, andgenerateSmoothPathfunction to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/glance/ui/theme/Theme.kt
- Reformatted the
JetnewsGlanceColorSchemeobject to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/model/Post.kt
- Reformatted the
Postdata class,Metadatadata class,PostAuthordata class,Publicationdata class,Paragraphdata class, andMarkupdata class to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/AppDrawer.kt
- Reformatted the
AppDrawercomposable andJetNewsLogocomposable to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/JetnewsApp.kt
- Reformatted the
JetnewsAppcomposable to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/JetnewsNavGraph.kt
- Reformatted the
JetnewsNavGraphfunction to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/article/ArticleScreen.kt
- Reformatted the
ArticleScreencomposable to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/article/PostContent.kt
- Reformatted the
PostContentcomposable,Paragraphcomposable, andgenerateSleepPathfunction to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/components/AppNavRail.kt
- Reformatted the
AppNavRailcomposable to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/components/JetnewsSnackbarHost.kt
- Reformatted the
JetnewsSnackbarHostcomposable to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/home/HomeRoute.kt
- Reformatted the
HomeRoutecomposable andgetHomeScreenTypefunction to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/home/HomeScreens.kt
- Reformatted the
HomeFeedWithArticleDetailsScreencomposable andHomeFeedScreencomposable to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/home/HomeViewModel.kt
- Reformatted the
HomeViewModelclass to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/home/PostCardTop.kt
- Reformatted the
PostCardTopcomposable to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/home/PostCardYourNetwork.kt
- Reformatted the
PostCardPopularcomposable to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/sleep/SleepBar.kt
- Reformatted the
SleepBarcomposable andSleepRoundedBarcomposable to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/sleep/SleepData.kt
- Reformatted the
SleepGraphDatadata class,SleepDayDatadata class,SleepPerioddata class, andSleepTypeenum to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/theme/Theme.kt
- Reformatted the
JetnewsThemecomposable to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/theme/Type.kt
- Reformatted the
Typographyobject to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/util/MultiDevicePreview.kt
- Reformatted the
FontScalePreviewsannotation class to adhere to the configured code style.
- Reformatted the
- Reply/.editorconfig
- Added
.editorconfigfile to define code style rules.
- Added
- Reply/app/build.gradle.kts
- Updated the copyright notice to
The Android Open Source Project. - Added a blank line before the
pluginsblock. - Formatted
proguardFilescalls for better readability.
- Updated the copyright notice to
- Reply/app/src/main/java/com/example/reply/data/Account.kt
- Reformatted the
Accountdata class to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/data/Email.kt
- Reformatted the
Emaildata class to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/data/EmailAttachment.kt
- Reformatted the
EmailAttachmentdata class to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/data/MailboxType.kt
- Reformatted the
MailboxTypeenum to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/data/local/LocalAccountsDataProvider.kt
- Reformatted the
LocalAccountsDataProviderobject to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/data/local/LocalEmailsDataProvider.kt
- Reformatted the
LocalEmailsDataProviderobject to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/EmptyComingSoon.kt
- Reformatted the
EmptyComingSooncomposable to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/MainActivity.kt
- Reformatted the
MainActivityclass to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/ReplyApp.kt
- Reformatted the
ReplyAppcomposable to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/ReplyHomeViewModel.kt
- Reformatted the
ReplyHomeViewModelclass to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/ReplyListContent.kt
- Reformatted the
ReplyInboxScreencomposable to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/components/AppNavRail.kt
- Reformatted the
AppNavRailcomposable to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/components/JetnewsSnackbarHost.kt
- Reformatted the
JetnewsSnackbarHostcomposable to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/components/ReplyAppBars.kt
- Reformatted the
ReplyDockedSearchBarcomposable andEmailDetailAppBarcomposable to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/components/ReplyEmailListItem.kt
- Reformatted the
ReplyEmailListItemcomposable to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/components/ReplyProfileImage.kt
- Reformatted the
ReplyProfileImagecomposable to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/navigation/ReplyNavigationActions.kt
- Reformatted the
ReplyNavigationActionsclass to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/navigation/ReplyNavigationComponents.kt
- Reformatted the
ReplyNavigationWrappercomposable andReplyBottomNavigationBarcomposable to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/theme/Shape.kt
- Reformatted the
shapesobject to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/theme/Theme.kt
- Reformatted the
ReplyThemecomposable to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/theme/Type.kt
- Reformatted the
replyTypographyobject to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/utils/WindowStateUtils.kt
- Reformatted the
DevicePosturesealed interface andReplyNavigationTypeenum to adhere to the configured code style.
- Reformatted the
- scripts/format.sh
- Updated the
format.shscript to remove the--init-scriptargument and pass the remaining arguments directly to thegradlew_recursive.shscript.
- Updated 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 joy to behold and share,
Cleanliness reigns.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request effectively standardizes and applies the Spotless configuration across multiple sample projects, which is a great step towards consistent code style and maintainability. The move to .editorconfig for ktlint rules and the simplification of the build.gradle.kts files are positive changes.
The formatting applied throughout the Kotlin files aligns with the new configuration and generally improves readability and consistency. The update to the format.sh script and the removal of the old init.gradle.kts are also appropriate.
Overall, the changes are well-executed and contribute positively to the codebase. Nice work!
Summary of Findings
- Redundant ktlint rule in .editorconfig: In the newly added
.editorconfigfiles for JetLagged, JetNews, Jetchat, Jetsnack, and Reply, the linektlint_standard_package-name = disabledis duplicated (e.g., line 10 and line 19 inJetLagged/.editorconfig). While this doesn't break functionality, removing the duplicate line would make the configuration cleaner. (Severity: low - Not commented due to review settings)
Merge Readiness
The pull request appears to be in good shape and ready for merging. The identified minor issue (duplicated lines in .editorconfig) is of low severity and can be addressed at the author's discretion or in a follow-up. As I am an AI, I am not authorized to approve pull requests; please ensure other reviewers approve this code before merging.
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.
Does this also fix the GitHub action not auto applying spotless?
Yeah it does. We had outdated configuration that didn't work already. The GH actions run properly |
Jetcaster is refactored in #1561, so the same config will be applied there, but I won't format it here, because it would create a million conflicts.