Skip to content

Sort modifiers according to Kotlin conventions#641

Open
user1223644 wants to merge 1 commit into
facebook:mainfrom
user1223644:Codex/issue-293-modifier-order
Open

Sort modifiers according to Kotlin conventions#641
user1223644 wants to merge 1 commit into
facebook:mainfrom
user1223644:Codex/issue-293-modifier-order

Conversation

@user1223644

Copy link
Copy Markdown

Sorts declaration modifiers according to the order defined by the Kotlin coding conventions.

For example:

final @Magic public class Foo

suspend override protected fun foo() {}

is formatted as:

@Magic public final class Foo

protected override suspend fun foo() {}

Annotations and comments keep their relative association. Unsupported modifiers such as noinline, crossinline, in, out, and reified act as ordering barriers.

The cleanup applies to both full and partial formatting.

Tests:

./gradlew ktfmtFormat check --no-daemon

Fixes #293

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 14, 2026
@user1223644
user1223644 marked this pull request as ready for review July 14, 2026 16:30
@cgrushko

Copy link
Copy Markdown
Contributor

Thanks for the pull request!

For transparency, we'd appreciate if you can note whether / how much you've used the help of AI coding tools for creating this PR. Thanks!

@user1223644

Copy link
Copy Markdown
Author

I used codex extensively to help implement this change. I personally reviewed and tested all changes before submitting

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sort modifiers based on Kotlin conventions

2 participants