Skip to content

Spotless Gradle is incompatible with ktfmt 0.57 #2602

@ZacSweers

Description

@ZacSweers

Seen when updating here.

$ cd samples/
$ ./gradlew spotlessApply

> Task :spotlessKotlinGradleApply FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':spotlessKotlinGradleApply'.
> There were 2 lint error(s), they must be fixed or suppressed.
  build.gradle.kts:LINE_UNDEFINED ktfmt(java.lang.NoSuchMethodError) 'boolean com.facebook.ktfmt.format.FormattingOptions.getManageTrailingCommas()' (...)
  settings.gradle.kts:LINE_UNDEFINED ktfmt(java.lang.NoSuchMethodError) 'boolean com.facebook.ktfmt.format.FormattingOptions.getManageTrailingCommas()' (...)
  Resolve these lints or suppress with `suppressLintsFor

https://scans.gradle.com/s/dyeb3xx4stt4y

Change is due to manageTrailingCommas now being a trailingCommaManagementStrategy enum: https://github.com/facebook/ktfmt/releases/tag/v0.57

FormattingOptions.manageTrailingCommas was replaced with FormattingOptions.trailingCommaManagementStrategy, which also added new TrailingCommaManagementStrategy.ONLY_ADD strategy (facebook/ktfmt#461, facebook/ktfmt#512, facebook/ktfmt#514)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions