Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not create an EditorConfigOverride without properties. Use 'emptyEditorConfigOverride' instead. #1374

Closed
4 tasks
Jadyli opened this issue Oct 18, 2022 · 6 comments

Comments

@Jadyli
Copy link

Jadyli commented Oct 18, 2022

kotlin {
ktlint("0.47.1")
.setUseExperimental(true)
.editorConfigOverride([ 'max-line-length': 120, 'wrapping': false])
}
Can not create an EditorConfigOverride without properties. Use 'emptyEditorConfigOverride' instead.

When i add 'indent_size': 2 to editorConfigOverride, android studio build success.

  • ktlint 0.47.1
  • gradle 7.5.1
  • spotless 6.11.0
  • win11
@ymaniz09
Copy link

Same issue here, the only difference is that I'm using Gradle 7.3.0

@bcmedeiros
Copy link
Contributor

same thing here when trying to se ktlint_disabled_rules, follows the code snippet:

configure<com.diffplug.gradle.spotless.SpotlessExtension> {
    kotlin {
        ktlint("0.47.1")
            .editorConfigOverride(
                mapOf(
                    "ktlint_disabled_rules" to "import-ordering,filename",
                )
            )
    }
}

I get the following error:

> Task :common-auth:spotlessKotlin FAILED
Step 'ktlint' found problem in 'src/main/kotlin/exceptions.kt':
Can not create an EditorConfigOverride without properties. Use 'emptyEditorConfigOverride' instead.
java.lang.IllegalArgumentException: Can not create an EditorConfigOverride without properties. Use 'emptyEditorConfigOverride' instead.
        at com.pinterest.ktlint.core.api.EditorConfigOverride$Companion.from(EditorConfigOverride.kt:36)
        at com.diffplug.spotless.glue.ktlint.compat.KtLintCompat0Dot47Dot0Adapter.createEditorConfigOverride(KtLintCompat0Dot47Dot0Adapter.java:123)
        at com.diffplug.spotless.glue.ktlint.compat.KtLintCompat0Dot47Dot0Adapter.format(KtLintCompat0Dot47Dot0Adapter.java:72)
        at com.diffplug.spotless.glue.ktlint.KtlintFormatterFunc.applyWithFile(KtlintFormatterFunc.java:71)
        at com.diffplug.spotless.FormatterFunc$NeedsFile.apply(FormatterFunc.java:154)
        at com.diffplug.spotless.FormatterStepImpl$Standard.format(FormatterStepImpl.java:82)
        at com.diffplug.spotless.FormatterStep$Strict.format(FormatterStep.java:88)
        at com.diffplug.spotless.Formatter.compute(Formatter.java:230)
        at com.diffplug.spotless.PaddedCell.calculateDirtyState(PaddedCell.java:203)
        at com.diffplug.spotless.PaddedCell.calculateDirtyState(PaddedCell.java:190)
        at com.diffplug.gradle.spotless.SpotlessTaskImpl.processInputFile(SpotlessTaskImpl.java:102)
        at com.diffplug.gradle.spotless.SpotlessTaskImpl.performAction(SpotlessTaskImpl.java:88)

@bcmedeiros
Copy link
Contributor

I did some digging, for the line length, the property needs to be snake case: org.ec4j.core.model.PropertyType#max_line_length.

As for ktlint_disabled_rules, it's really missing.

@tbcrawford
Copy link
Contributor

This should be fixed in the next release of ktlint, 0.48.0. PR that fixes it: pinterest/ktlint#1671

However, support for 0.47.x here in spotless would be great!

@bcmedeiros
Copy link
Contributor

@tcrawford-figure Adjusted my PR so it's fixed for 0.47.x, let me know what you think.

@nedtwigg
Copy link
Member

Fixed in plugin-gradle 6.12.0 and plugin-maven 2.28.0.

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

No branches or pull requests

5 participants