Formatting inconsistent when both <tabs> and <spaces> indentation rules are present
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- java
- Domain
- build-system
Research direction
Start by reproducing the behavior with the Maven plugin configuration in the issue, focusing on the two Java blocks and the src/main/java//*.java and src/test/java//*.java includes. Inspect how the Maven configuration handles multiple indentation rules; done means Java files are formatted consistently when both rules are present, with the up-to-date debug message behaving as expected.
Written by the indexing model from the issue text.
Description
I'm encountering inconsistent formatting behavior when both blocks — one tabs true and another with spaces true — are defined under the Spotless configuration in a Maven project.
Some Java files are formatted, some are skipped, and others show partial formatting. When I remove one of the two blocks, the behavior becomes consistent.
I keep getting this debug log
[DEBUG] Spotless will not format an up-to-date file:
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.43.0</version>
<configuration>
<java>
<includes>
<include>src/main/java/**/*.java</include>
<include>src/test/java/**/*.java</include>
</includes>
<trimTrailingWhitespace/>
<removeUnusedImports/>
<indent>
<tabs>true</tabs>
<spacesPerTab>2</spacesPerTab>
</indent>
<indent>
<spaces>true</spaces>
<spacesPerTab>4</spacesPerTab>
</indent>
<googleJavaFormat>
<version>1.17.0</version>
</googleJavaFormat>
</java>
<pom>
<includes>
<include>pom.xml</include>
</includes>
<sortPom>
<expandEmptyElements>false</expandEmptyElements>
</sortPom>
</pom>
<markdown>
<excludes>
<exclude>**/node/**</exclude>
<exclude>**/node_modules/**</exclude>
</excludes>
<includes>
<include>**/*.md</include>
</includes>
<flexmark/>
</markdown>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
<phase>validate</phase>
</execution>
</executions>
</plugin>
- Dominant language
- Java
- Stars
- 5.7k
- Forks
- 560
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 43
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from diffplug/spotless
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 66/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
All issues in diffplug/spotless
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100