facebook / ktfmt

A program that reformats Kotlin source code to comply with the common community standard for Kotlin code conventions.
https://facebook.github.io/ktfmt/
Apache License 2.0
857 stars 66 forks source link

Add support for Gradle assignment operator #479

Closed cloudshiftchris closed 2 weeks ago

cloudshiftchris commented 3 weeks ago

Fixes #411.

Gradle added support for a Kotlin assignment operator to simplify property assignment.

This is done via a compiler plugin and this import: import org.gradle.kotlin.dsl.assign - which ktfmt detects as unused and removes.

This PR adds an assign operator to the operators in com.facebook.ktfmt.format.RedundantImportDetector and a corresponding test to ensure the import remains.

cloudshiftchris commented 3 weeks ago

builds failing due to unrelated commit 520706e / @strulovich / @hick209 that came along with the fork - looks like some dependency-hell between the IJ plugin depending on a stable version of ktfmt yet was updated to use new code that exists along-side it but is not yet in a published stable version. Once that is addressed it can be merged in here.

facebook-github-bot commented 3 weeks ago

@hick209 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

hick209 commented 3 weeks ago

Yeah, I was actually the one that broke the tests and I have an internal diff that should fix that, don't worry about it. Thanks for your contributions :)

facebook-github-bot commented 2 weeks ago

@hick209 merged this pull request in facebook/ktfmt@587a23216e4c89c60ab8b4ba6097f4171b3dd887.