gantsign / ktlint-maven-plugin

Maven plugin for ktlint the Kotlin linter

Home Page:http://gantsign.com/ktlint-maven-plugin/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Format fails with "expecting an argument"

boxleytw opened this issue · comments

I have "green build" projects in Kotlin using the excellent ktlint Maven plugin -- thank you!

I started a new project today, copied over the pom.xml recipes from others, but in this single-file project, I receive from ./mvnw clean verify:

[ERROR] Failed to execute goal com.github.gantsign.maven:ktlint-maven-plugin:1.4
.2:format (default) on project kotlin-dice: Execution default of goal com.github
.gantsign.maven:ktlint-maven-plugin:1.4.2:format failed: Expecting an argument -
> [Help 1]

Looking at the stacktrace from -X:

Caused by: com.pinterest.ktlint.core.ParseException: Expecting an argument
    at com.pinterest.ktlint.core.KtLint.format (KtLint.kt:370)

I feel I must have made a silly mistake, but various diffs are not turning up anything. Is this something I can address myself?

https://github.com/binkley/kotlin-dice/blob/76ceb23f0963b570cc89823fc4b230af95b759f8/pom.xml

(Build is presently broken due to this issue; pushing to GitHub so that pom.xml is visible.)

@boxleytw, thanks for reporting this issue. Unfortunately, this plugin doesn't support Kotlin 1.4 yet. I'll look into improving the error message.

@freemanjp Aha! Thank you. I'll go back to 1.3.72. There are no 1.4 features needed in the project.

I moved back to Kotlin 1.3.72, simplified the POM and removed 1.4 features, and still get the same complaint.

Is there anything I can do to provide more/better information on this?

I may have found the problem. I was using the "trailing comma" feature of 1.4. After going back to 1.3-style on this (no trailing comma), ktlint ran fine.