Skip to content

Migrate from Ktlint to Ktfmt#1003

Open
Goooler wants to merge 1 commit into
tunjid:mainfrom
Goooler:ktfmt
Open

Migrate from Ktlint to Ktfmt#1003
Goooler wants to merge 1 commit into
tunjid:mainfrom
Goooler:ktfmt

Conversation

@Goooler

@Goooler Goooler commented Feb 18, 2026

Copy link
Copy Markdown
Contributor

@Goooler

Goooler commented Feb 18, 2026

Copy link
Copy Markdown
Contributor Author
* What went wrong:
Execution failed for task ':composeApp:processReleaseGoogleServices'.
> Malformed root json at /home/runner/work/heron/heron/composeApp/src/release/google-services.json
604 actionable tasks: 464 executed, 140 from cache

This looks unrelated.

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @Goooler, 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!

This pull request migrates the project from Ktlint to Ktfmt for Kotlin code formatting. This change ensures that the codebase adheres to Block's engineering standards, promoting consistency and readability. The update involves modifying the Spotless plugin configuration, updating dependencies, and reformatting the code.

Highlights

  • Code Formatting: Migrated from Ktlint to Ktfmt for Kotlin code formatting, aligning with Block's engineering standards.
  • Spotless Plugin: Updated the Spotless plugin configuration to use Ktfmt instead of Ktlint, ensuring consistent code style across the project.
  • Dependency Updates: Removed Ktlint dependencies and added Ktfmt dependencies, streamlining the build process.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • .editorconfig
    • Removed Ktlint-specific configurations.
  • build-logic/convention/build.gradle.kts
    • Removed extra newlines and reformatted plugin application for conciseness.
  • build-logic/convention/src/main/kotlin/android-application-convention.gradle.kts
    • Removed extra newlines and reformatted plugin application and defaultConfig for conciseness.
  • build-logic/convention/src/main/kotlin/android-library-convention.gradle.kts
    • Removed extra newlines and reformatted plugin application and defaultConfig for conciseness.
  • build-logic/convention/src/main/kotlin/ext/AndroidExt.kt
    • Removed extra newlines and reformatted the commonConfiguration function for conciseness.
  • build-logic/convention/src/main/kotlin/ext/ComposeExt.kt
    • Minor formatting changes for readability.
  • build-logic/convention/src/main/kotlin/ext/KotlinJvm.kt
    • Removed extra newlines and reformatted the toolchain configuration for conciseness.
  • build-logic/convention/src/main/kotlin/ext/KotlinMultiplatformExt.kt
    • Removed extra newlines and reformatted the configureKotlinMultiplatform function for conciseness.
  • build-logic/convention/src/main/kotlin/ext/ProjectExt.kt
    • Minor formatting changes for readability.
  • build-logic/convention/src/main/kotlin/ext/UiModuleExt.kt
    • Removed extra newlines and reformatted the configureUiModule function for conciseness.
  • build-logic/convention/src/main/kotlin/kotlin-library-convention.gradle.kts
    • Removed extra newlines and reformatted the kotlin configuration for conciseness.
  • build-logic/convention/src/main/kotlin/ksp-convention.gradle.kts
    • Removed extra newlines and reformatted the metro configuration for conciseness.
  • build-logic/settings.gradle.kts
    • Removed extra newlines and reformatted the versionCatalogs configuration for conciseness.
  • build.gradle.kts
    • Replaced Ktlint with Ktfmt in the Spotless plugin configuration.
    • Configured Ktfmt to use Kotlinlang style.
  • composeApp/build.gradle.kts
    • Minor formatting changes for readability.
  • composeApp/src/androidMain/kotlin/com/tunjid/heron/MainActivity.kt
    • Minor formatting changes for readability.
  • composeApp/src/androidMain/kotlin/com/tunjid/heron/NotificationsService.kt
    • Minor formatting changes for readability.
  • composeApp/src/androidMain/kotlin/com/tunjid/heron/Platform.android.kt
    • Minor formatting changes for readability.
  • composeApp/src/commonMain/kotlin/com/tunjid/heron/App.kt
    • Minor formatting changes for readability.
  • composeApp/src/commonMain/kotlin/com/tunjid/heron/Platform.kt
    • Minor formatting changes for readability.
  • composeApp/src/desktopMain/kotlin/com/tunjid/heron/Platform.jvm.kt
    • Minor formatting changes for readability.
  • composeApp/src/desktopMain/kotlin/com/tunjid/heron/main.kt
    • Minor formatting changes for readability.
  • composeApp/src/iosMain/kotlin/com/tunjid/heron/Platform.ios.kt
    • Minor formatting changes for readability.
  • data/core/build.gradle.kts
    • Minor formatting changes for readability.
  • data/core/src/androidMain/kotlin/com/tunjid/heron/data/network/NetworkMonitor.android.kt
    • Minor formatting changes for readability.
  • data/core/src/androidMain/kotlin/com/tunjid/heron/data/network/NetworkMonitor.kt
    • Removed ktlint suppress
  • data/core/src/androidMain/kotlin/com/tunjid/heron/data/network/oauth/crypto/CryptographyProvider.android.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/core/models/Utilities.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/datastore/migrations/SavedStateVersion.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/datastore/migrations/SavedStateVersion0.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/datastore/migrations/SavedStateVersion1.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/datastore/migrations/SavedStateVersion2.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/datastore/migrations/SavedStateVersion3.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/datastore/migrations/SavedStateVersion4.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/datastore/migrations/SavedStateVersion5.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/datastore/migrations/migrated/PreferencesV0.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/datastore/migrations/migrated/ProfileDataV0.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/di/Bindings.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/network/FeedCreationService.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/network/NetworkService.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/network/SessionContext.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/network/SessionManager.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/network/models/FacetConversions.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/network/models/LabelConversions.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/network/models/PostConversions.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/network/oauth/DpopKeyPair.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/network/oauth/DpopKeyPairSerializer.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/network/oauth/OAuthApi.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/network/oauth/OAuthAuthorizationRequest.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/network/oauth/OAuthClient.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/network/oauth/OAuthCodeChallengeMethod.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/network/oauth/OAuthCodeChallengeMethodSelector.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/network/oauth/OAuthScope.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/network/oauth/OAuthToken.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/network/oauth/network/OAuthAuthorizationServer.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/network/oauth/network/OAuthParRequest.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/network/oauth/network/OAuthTokenResponse.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/repository/AuthRepository.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/repository/MessageRepository.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/repository/NotificationsRepository.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/repository/PostRepository.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/repository/ProfileRepository.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/repository/RecordRepository.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/repository/SavedStateDataSource.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/utilities/AtProtoConversions.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/utilities/Collections.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/utilities/CursorFlow.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/utilities/DeferredMutex.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/utilities/FlowWithRefresh.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/utilities/TidGenerator.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/utilities/Utilities.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/utilities/multipleEntitysaver/MultipleEntitySaver.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/utilities/multipleEntitysaver/SaveBookmarkView.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/utilities/multipleEntitysaver/SaveConversationView.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/utilities/multipleEntitysaver/SaveFeedGeneratorView.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/utilities/multipleEntitysaver/SaveFeedViewPost.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/utilities/multipleEntitysaver/SaveLabel.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/utilities/multipleEntitysaver/SaveLabelValueDefinitions.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/utilities/multipleEntitysaver/SaveLabeler.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/utilities/multipleEntitysaver/SaveListItemView.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/utilities/multipleEntitysaver/SaveMessageView.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/utilities/multipleEntitysaver/SavePostLike.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/utilities/multipleEntitysaver/SaveProfileView.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/utilities/multipleEntitysaver/SaveThreadGateView.kt
    • Minor formatting changes for readability.
  • data/core/src/commonMain/kotlin/com/tunjid/heron/data/utilities/writequeue/Writable.kt
    • Minor formatting changes for readability.
  • ui-module-convention.gradle.kts
    • Added newline for readability.
Activity
  • Ktlint-related dependencies and configurations were removed.
  • Ktfmt-related dependencies and configurations were added.
  • Code was reformatted to be Ktfmt compliant.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

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.

Footnotes

  1. 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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

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 migrates the project's code style from Ktlint to Ktfmt. The changes are extensive and affect numerous files, primarily involving code formatting adjustments. I've reviewed the changes across all modified files, including build scripts and source code. The switch to ktfmt in the build.gradle.kts and the removal of ktlint configurations in .editorconfig are correctly implemented. The formatting changes in the Kotlin source files are consistent with ktfmt's style and improve code consistency. I also noticed the removal of several unused imports, which is a good cleanup. Overall, this is a solid refactoring, and I don't see any issues. The changes look good to merge.

@tunjid

tunjid commented Feb 18, 2026

Copy link
Copy Markdown
Owner
* What went wrong:
Execution failed for task ':composeApp:processReleaseGoogleServices'.
> Malformed root json at /home/runner/work/heron/heron/composeApp/src/release/google-services.json
604 actionable tasks: 464 executed, 140 from cache

This looks unrelated.

Yeah definitely unrelated. Secrets in the repo are only available to listed contributors. Is there a way to get ktfmt to match the existing style? Some changes it makes that I'm not fond of:

  • Forcing lambdas to be on one line if it can fit
  • Putting annotations on the the same line as the declaration

@Goooler

Goooler commented Feb 19, 2026

Copy link
Copy Markdown
Contributor Author

There are no additional rules that we can configure. I don't like some of them either, but it's a trend that we have to accept.

@Goooler

Goooler commented Feb 19, 2026

Copy link
Copy Markdown
Contributor Author

I would suggest using googleStyle for indent-size for 2.

extension: CommonExtension<*, *, *, *, *, *>,
) = extension.apply {
compileSdk = 36
/** Sets common values for Android Applications and Libraries */

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What can you tell me about this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is enforced by Ktfmt.

@Goooler

Goooler commented May 25, 2026

Copy link
Copy Markdown
Contributor Author

Now is the time to push this, given facebook/ktfmt#616.

@tunjid

tunjid commented May 25, 2026

Copy link
Copy Markdown
Owner

@Goooler hey! yeah I also heard about this at kotlinconf. I want to wait until it is moved to the official kotlin repo, its supposed to have a few extra configuration options then. The one I really want is to stop making short lambdas single line.

@Goooler

Goooler commented May 25, 2026

Copy link
Copy Markdown
Contributor Author

Yeah. I guess so.

@Goooler

Goooler commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

FYI, the single line lambda rule enforcement has been opted out in

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants