Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[packages] Add support for Kotlin auto-formatting #118756

Closed
flutter/packages
#5374
@stuartmorgan-g

Description

@stuartmorgan-g

It's likely that at some point we'll have Kotlin code in our 1P plugins (per https://flutter.dev/go/flutter-plugin-languages), and we are already managing some Kotlin code in Pigeon. It would be good to have an autoformatter for it the way we do for most of our other languages (see also #41129).

From initial investigation it looks like IntelliJ has a formatter, but built into the IDE. It's apparently possible to run from the command line, but it "launches an instance of IntelliJ IDEA in the background and applies the formatting". That seems problematic for a tool that we want to be lightweight to set up, and to run in CI.

The tools that came up in an initial search that better match our needs are ktlint and ktfmt. We should evaluate those to see if they work for for us, and if so integrate one of them into the repo tool's format command.

Metadata

Metadata

Labels

P3Issues that are less important to the Flutter projectc: contributor-productivityTeam-specific productivity, code health, technical debt.p: toolingAffects the flutter_plugin_tools packagepackageflutter/packages repository. See also p: labels.team-ecosystemOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions