Skip to content

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

Closed

Description

@Jadyli

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

Activity

  1. ymaniz09 commented on Oct 18, 2022

    @ymaniz09

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

  2. bcmedeiros commented on Oct 19, 2022

    @bcmedeiros
    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)
    
    
  3. bcmedeiros commented on Oct 19, 2022

    @bcmedeiros
    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.

  4. tbcrawford commented on Oct 21, 2022

    @tbcrawford
    Contributor

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

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

  5. bcmedeiros commented on Oct 21, 2022

    @bcmedeiros
    Contributor

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

  6. nedtwigg commented on Nov 24, 2022

    @nedtwigg
    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions