Questions tagged [spotless]

Use this tag for errors or bugs related to usage of this plugin, usually combined with the specific tags of language or technology.

Spotless is a code formatter plugin for Maven, Gradle and other build systems.

34 questions
1
vote
1 answer

How to configure spotless google formatter to format braces

How to configure spotless google formatter to format braces in 2 lines instead of a single line - void contextLoads() {} + void contextLoads() { + }
Rpj
  • 5,348
  • 16
  • 62
  • 122
1
vote
1 answer

How do I ask spotless gradle plugin to skip licenseHeader check

How do I ask spotless gradle plugin with google formatter to skip licenseHeader check, I use a different plugin to format my license headers and this is making corrections to those headers which I want to avoid
Rpj
  • 5,348
  • 16
  • 62
  • 122
1
vote
1 answer

new gradle format confusion and migrating causes Could not find method testCompile()

I have a build.gradle with plugins { id {some plugin for all projects} id "com.diffplug.spotless" version "5.1.1" } AND THEN I have an allprojects {} section that defines ONE apply plugin: 'jacoco' and a subprojects {} section that declares…
Dean Hiller
  • 19,235
  • 25
  • 129
  • 212
1
vote
1 answer

Spotless gradle plugin not working on closed system

I am using gradle 5.4.1. I am using spotless-plugin-gradle 3.25.0. My build.gradle contains plugins { id 'java' id 'eclipse' id 'maven-publish' id 'com.github.johnrengelman.plugin-shadow' version '2.0.3' id 'org.sonarqube' version '2.7.1' …
user1759789
  • 169
  • 2
  • 15
0
votes
1 answer

Adding kotlin-bom to gradle dependency breaks the application

I am trying to update the build.gradle.kts by moving kotlin-bom from dependencyManagement to dependencies. Am using java 17 and gradle 8.2 earlier it was dependencyManagement { imports { mavenBom("org.jetbrains.kotlin:kotlin-bom:1.8.22") } } I…
0
votes
1 answer

How to disable ktlint max-line-length standard rule

I'm using ktlint 0.50.0, with Spotless 6.20.0, on AGP 8.1.0. Running spotless as a PreCommit Git hook. Due to the existence of too many old code, I'm trying to disable some rules. The one that gives me trouble is the "max_line_length". How can I…
ivtoto
  • 241
  • 1
  • 9
0
votes
1 answer

Eclipse Code Formatter Profile within IntelliJ: Javadoc formatting

as all the other collegues are working with eclipse for an project I have imported the Eclipse Formatter profile xml file and imported it within IntelliJ so far everything seems to be ok, but there is a difference with the javadoc formatting and I…
Matt
  • 75
  • 14
0
votes
0 answers

Kotlin: complaining about "Property 'disabled_rules' is deprecated" in '.editorconfig' files

New to Kotlin. Notice a bunch Property 'disabled_rules' is deprecated: Rename property 'disabled_rules' to 'ktlint_disabled_rules' in all '.editorconfig' files. I donot have a '.editorconfig' file under repo root. What is causing this? Should I…
0
votes
2 answers

How to instruct Spotless to ignore a code segment?

How can I instruct the Spotless code formatter to ignore a specific code section? I wrote this Java code section: String content = Joiner.on(System.lineSeparator()).join( "services:", "- name: name", " image:…
Toldry
  • 485
  • 1
  • 4
  • 13
0
votes
1 answer

Problem setting spotless gradle plugin using toml

I'm using a libs.version.toml on my project and I've added this [versions] spotless = "6.13.0" [libraries] spotless-gradlePlugin = { group = "com.diffplug.spotless", name = "spotless-gradle-plugin", version.ref = "spotless" } [plugins] spotless =…
StuartDTO
  • 783
  • 7
  • 26
  • 72
0
votes
0 answers

ktlint with spotless custom rules

I have successfully integrated the ktlint with spotless plugin but now I need to trigger custom rules from spotless and unfortunately I coundn't find out any documentation about it, any help would be greatly appreciated.
Bytecode
  • 6,551
  • 16
  • 54
  • 101
0
votes
0 answers

spotlessDiagnose diverges after 10 steps message

spotlessDiagnose diverges after 10 steps message, is seen and doesn't let us modify importOrder across all files. How do we resolve this gradlew spotlessDiagnose > Task :spotlessJavaDiagnose src/main/java/com/foo/repository/Foo.java diverges…
Rpj
  • 5,348
  • 16
  • 62
  • 122
0
votes
0 answers

Spotless + Ktlint : org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:spotlessKotlin'

When I run a spotlessKotlin task I get this error message. org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:spotlessKotlin'. at…
0
votes
2 answers

Run spotless:check without pulling maven dependencies in Github Actions

I am trying to set a Github Action to check spotless. My actions.yml name: Java CI with Maven on: pull_request: branches: [ "main" ] jobs: build: name: Build runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 …
0
votes
1 answer

JSON files formatting in Spring boot based projects

I have spring boot projects with lots of files in .json apart from .java files. For java formatting, we are using pre-commit hooks with google-java-format . However, for formatting .json files I am a bit struggling. I have used a maven spotless…
Sharad
  • 838
  • 1
  • 7
  • 15