-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
.editorconfig
file to define code style rules for Kotlin files. - Gradle Updates: Updates
build.gradle.kts
files to use the new Spotless configuration and correct a URL.
Changelog
Click here to see the changelog
- JetLagged/.editorconfig
- Added
.editorconfig
file to define code style rules.
- Added
- JetLagged/app/build.gradle.kts
- Updated the Apache license URL from
http
tohttps
. - Added a blank line before the
plugins
block. - Formatted
proguardFiles
calls 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
, andHomeScreenCardHeading
composables to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/JetLaggedDrawer.kt
- Reformatted the
HomeScreenDrawer
andScreenContents
composables, and theHomeScreenDrawerContents
composable to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/JetLaggedScreen.kt
- Reformatted the
JetLaggedScreen
composable to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/backgrounds/BubbleBackground.kt
- Reformatted the
BubbleBackground
composable andBackgroundBubbleData
data class to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/backgrounds/FadingCircleBackground.kt
- Reformatted the
FadingCircleBackground
composable to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/backgrounds/SimpleGradientBackground.kt
- Reformatted the
simpleGradient
modifier function to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/backgrounds/SolarFlareShaderBackground.kt
- Reformatted the
solarFlareShaderBackground
modifier function andSolarFlairShaderBackgroundNode
class to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/backgrounds/StripesShaderBackground.kt
- Reformatted the
MovingStripesBackgroundElement
data class,MovingStripesBackgroundNode
class, andmovingStripesBackground
modifier function to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/data/FakeSleepData.kt
- Reformatted the
sleepData
variable to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/data/JetLaggedHomeScreenState.kt
- Reformatted the
JetLaggedHomeScreenState
,WellnessData
, andHeartRateOverallData
data classes to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/heartrate/HeartRateCard.kt
- Reformatted the
HeartRateCard
composable to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/heartrate/HeartRateGraph.kt
- Reformatted the
HeartRateGraph
composable,Graph
composable,DataPoint
sealed class, andgenerateSmoothPath
function to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/sleep/JetLaggedHeader.kt
- Reformatted the
JetLaggedHeader
composable to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/sleep/JetLaggedHeaderTabs.kt
- Reformatted the
SleepTab
enum,JetLaggedHeaderTabs
composable, andSleepTabText
composable to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/sleep/JetLaggedTimeGraph.kt
- Reformatted the
JetLaggedSleepGraphCard
composable andJetLaggedTimeGraph
composable to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/sleep/SleepBar.kt
- Reformatted the
SleepBar
composable,SleepRoundedBar
composable, andDetailLegend
composable to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/sleep/SleepData.kt
- Reformatted the
SleepGraphData
,SleepDayData
,SleepPeriod
data classes, andSleepType
enum to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/sleep/TimeGraph.kt
- Reformatted the
TimeGraph
composable,TimeGraphScope
object, andTimeGraphParentData
class 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
,JetLaggedExtraColors
data class, andJetLaggedTheme
composable to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/ui/theme/Type.kt
- Reformatted the
fontName
variable,provider
variable,fontFamily
variable,Typography
variable,TitleBarStyle
variable,HeadingStyle
variable,SmallHeadingStyle
variable,LegendHeadingStyle
variable, andTitleStyle
variable to adhere to the configured code style.
- Reformatted the
- JetLagged/app/src/main/java/com/example/jetlagged/ui/util/MultiDevicePreview.kt
- Reformatted the
FontScalePreviews
annotation class to adhere to the configured code style.
- Reformatted the
- JetNews/.editorconfig
- Added
.editorconfig
file to define code style rules.
- Added
- JetNews/app/build.gradle.kts
- Updated the Apache license URL from
http
tohttps
. - Added a blank line before the
plugins
block. - Formatted
proguardFiles
calls for better readability.
- Updated the Apache license URL from
- JetNews/app/src/androidTest/java/com/example/jetnews/HomeScreenTests.kt
- Reformatted the
HomeScreenTests
class to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/androidTest/java/com/example/jetnews/JetnewsTests.kt
- Reformatted the
JetnewsTests
class to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/androidTest/java/com/example/jetnews/TestHelper.kt
- Reformatted the
launchJetNewsApp
function to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/data/interests/impl/FakeInterestsRepository.kt
- Reformatted the
FakeInterestsRepository
class to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/data/posts/impl/PostsData.kt
- Reformatted the
pietro
variable,manuel
variable,florina
variable,androidstudioteam
variable,publication
variable, andparagraphsPost1
variable to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/glance/ui/Divider.kt
- Reformatted the
Divider
composable to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/glance/ui/JetnewsGlanceAppWidget.kt
- Reformatted the
JetnewsGlanceAppWidget
class to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/glance/ui/Post.kt
- Reformatted the
Post
composable,DataPoint
sealed class, andgenerateSmoothPath
function to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/glance/ui/theme/Theme.kt
- Reformatted the
JetnewsGlanceColorScheme
object to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/model/Post.kt
- Reformatted the
Post
data class,Metadata
data class,PostAuthor
data class,Publication
data class,Paragraph
data class, andMarkup
data class to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/AppDrawer.kt
- Reformatted the
AppDrawer
composable andJetNewsLogo
composable to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/JetnewsApp.kt
- Reformatted the
JetnewsApp
composable to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/JetnewsNavGraph.kt
- Reformatted the
JetnewsNavGraph
function to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/article/ArticleScreen.kt
- Reformatted the
ArticleScreen
composable to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/article/PostContent.kt
- Reformatted the
PostContent
composable,Paragraph
composable, andgenerateSleepPath
function to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/components/AppNavRail.kt
- Reformatted the
AppNavRail
composable to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/components/JetnewsSnackbarHost.kt
- Reformatted the
JetnewsSnackbarHost
composable to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/home/HomeRoute.kt
- Reformatted the
HomeRoute
composable andgetHomeScreenType
function to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/home/HomeScreens.kt
- Reformatted the
HomeFeedWithArticleDetailsScreen
composable andHomeFeedScreen
composable to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/home/HomeViewModel.kt
- Reformatted the
HomeViewModel
class to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/home/PostCardTop.kt
- Reformatted the
PostCardTop
composable to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/home/PostCardYourNetwork.kt
- Reformatted the
PostCardPopular
composable to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/sleep/SleepBar.kt
- Reformatted the
SleepBar
composable andSleepRoundedBar
composable to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/sleep/SleepData.kt
- Reformatted the
SleepGraphData
data class,SleepDayData
data class,SleepPeriod
data class, andSleepType
enum to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/theme/Theme.kt
- Reformatted the
JetnewsTheme
composable to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/theme/Type.kt
- Reformatted the
Typography
object to adhere to the configured code style.
- Reformatted the
- JetNews/app/src/main/java/com/example/jetnews/ui/util/MultiDevicePreview.kt
- Reformatted the
FontScalePreviews
annotation class to adhere to the configured code style.
- Reformatted the
- Reply/.editorconfig
- Added
.editorconfig
file 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
plugins
block. - Formatted
proguardFiles
calls for better readability.
- Updated the copyright notice to
- Reply/app/src/main/java/com/example/reply/data/Account.kt
- Reformatted the
Account
data class to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/data/Email.kt
- Reformatted the
Email
data class to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/data/EmailAttachment.kt
- Reformatted the
EmailAttachment
data class to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/data/MailboxType.kt
- Reformatted the
MailboxType
enum to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/data/local/LocalAccountsDataProvider.kt
- Reformatted the
LocalAccountsDataProvider
object to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/data/local/LocalEmailsDataProvider.kt
- Reformatted the
LocalEmailsDataProvider
object to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/EmptyComingSoon.kt
- Reformatted the
EmptyComingSoon
composable to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/MainActivity.kt
- Reformatted the
MainActivity
class to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/ReplyApp.kt
- Reformatted the
ReplyApp
composable to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/ReplyHomeViewModel.kt
- Reformatted the
ReplyHomeViewModel
class to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/ReplyListContent.kt
- Reformatted the
ReplyInboxScreen
composable to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/components/AppNavRail.kt
- Reformatted the
AppNavRail
composable to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/components/JetnewsSnackbarHost.kt
- Reformatted the
JetnewsSnackbarHost
composable to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/components/ReplyAppBars.kt
- Reformatted the
ReplyDockedSearchBar
composable andEmailDetailAppBar
composable to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/components/ReplyEmailListItem.kt
- Reformatted the
ReplyEmailListItem
composable to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/components/ReplyProfileImage.kt
- Reformatted the
ReplyProfileImage
composable to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/navigation/ReplyNavigationActions.kt
- Reformatted the
ReplyNavigationActions
class to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/navigation/ReplyNavigationComponents.kt
- Reformatted the
ReplyNavigationWrapper
composable andReplyBottomNavigationBar
composable to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/theme/Shape.kt
- Reformatted the
shapes
object to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/theme/Theme.kt
- Reformatted the
ReplyTheme
composable to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/theme/Type.kt
- Reformatted the
replyTypography
object to adhere to the configured code style.
- Reformatted the
- Reply/app/src/main/java/com/example/reply/ui/utils/WindowStateUtils.kt
- Reformatted the
DevicePosture
sealed interface andReplyNavigationType
enum to adhere to the configured code style.
- Reformatted the
- scripts/format.sh
- Updated the
format.sh
script to remove the--init-script
argument and pass the remaining arguments directly to thegradlew_recursive.sh
script.
- 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
.editorconfig
files for JetLagged, JetNews, Jetchat, Jetsnack, and Reply, the linektlint_standard_package-name = disabled
is 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.