Spotless maven plugin sometimes doesn't detect wrong java Eclipse formatting
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- java
- Domain
- build-system, tooling
Research direction
Reproduce the report with the supplied spotless-maven-plugin 2.43.0 configuration, Maven 3.8.4, and the two Java examples, running spotless:check and spotless:apply. Compare the cases involving when and verify that incorrect empty-line formatting is detected and corrected consistently.
Written by the indexing model from the issue text.
Description
Hi,
We use maven spotless plugin for java formatting in Eclipse format. In some cases it seems spotless:check doesn't shows errors on wrong formatting and spotless:apply doesn't apply changes.
Spotless maven plugin version: 2.43.0.
Maven version: 3.8.4
OS: Windows 10 Enterprise, 22H2
Spotless configuration:
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>${com.diffplug.spotless.plugin.version}</version>
<configuration>
<java>
<eclipse></eclipse> <!-- we use formatting from the file, but same issue is with default Eclipse formatting -->
<importOrder>
<order>java,javax,org,com</order>
</importOrder>
<removeUnusedImports/>
</java>
</configuration>
</plugin>
Simplified java class when formatting is not applied (here are doubled empty lines that are not allowed):
package com.myproject;
import static org.mockito.Mockito.when;
class SpotlessTest {
void test() {
when(null);
}
}
It seems that issue is somehow related to when, because on code below formatting is applied:
package com.myproject;
import static org.mockito.Mockito.when;
class SpotlessTest {
void test() {
String a = "a";
when(null);
}
}
- 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 65/100
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
checkstyle/test-configs#263 ·
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
apache/cloudstack#14222 ·
-
[BUG]茶杯方块在取茶时会引发崩溃 Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
1.0.0-alpha2 Type/Improvement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
wso2/dpdp-accelerator#272 ·