question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to disable ktlint rule

See original GitHub issue

I’m new to spotless and I might miss something. However, I’m not able to disable a specific ktlint rule.

//    id("com.diffplug.gradle.spotless") version "3.24.2"

spotless {
    kotlin {
        ktlint().userData(mapOf("disabled_rules" to "comment-spacing"))
    }
}

regarding to this and that, “comment-spacing” should be disabled globally. However, I still as the following error:

$ gw spotlessCheck
> Task :spotlessKotlin FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':spotlessKotlin'.
> The following files had format violations:
      src/compatTest/kotlin/io/github/gradlenexus/publishplugin/NexusPublishPluginTests.kt
          @@ -48,7 +48,7 @@
           import·java.nio.file.Files
           import·java.nio.file.Path
           
          -@Suppress("FunctionName")·//TODO:·How·to·suppress·"kotlin:S100"·from·SonarLint?
          +@Suppress("FunctionName")·//·TODO:·How·to·suppress·"kotlin:S100"·from·SonarLint?
           @ExtendWith(WiremockResolver::class)
           class·NexusPublishPluginTests·{
           
  Run 'gradlew spotlessApply' to fix these violations.

which suggests that rule is still taken into account.

What have I missed? How to effectively disable ktlint rule for the whole project?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
jbduncancommented, May 28, 2020

We don’t support editorconfig, the issue which outlines how to add support for it is #162.

@nedtwigg Did you mean to refer to #142, by any chance? 😃

1reaction
saschpecommented, Oct 25, 2019

I don’t think such a disable rule exist. The mechanism in Spotless works in general though:

spotless {
    kotlin {
        target("*/src/**/*.kt")
        ktlint("0.35.0").userData(mapOf("disabled_rules" to "no-wildcard-imports"))
    }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

FAQ - Ktlint
ktlint -disable no-wildcard-imports other-rule-id */ import package.a. ... A big disadvantage is that it is not possible to override the property partially ...
Read more >
How to disable ktlint rule for Missing newline after ":"
I just wanted to bring the interfaces below one another since bunch of interfaces consumes too much of code line. android · kotlin...
Read more >
jeremymailen / ktlint Download - JitPack
To disable a specific rule you'll need to turn on the verbose mode ( ktlint --verbose ... ). At the end of each...
Read more >
Changelog and Migration Guide - Detekt
KtLint replaced their default Indentation rule. Expect new formatting issues here! We removed HierachicalConfig interface. It was deprecated in 1.7.0 and could ...
Read more >
Anti-Bikeshedding with Ktlint - Thrive Mobile
For example, you cannot to ignore the whitespace rules for your entire project, instead you must disable the rule on a file-by-file basis....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found