diffplug / diffplug/spotless

warn user when a file being a part of multiple formats

Open
#1,656 7 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
5.6k
Forks
559
Avg merge
1d 13h
Merged PRs (30d)
34

Description

Reading https://github.com/diffplug/spotless/blob/main/PADDEDCELL.md, I may have some expectations regarding idempotency which may not be true (at least with the mvn plugin).

I consider a configuration like the following:






.gitignore
*.md





true
4






*.md
src/**/*.md



We see `*.MD` files are caught by both `formats` and `markdown`: this is certainly some left-overs on my side, but I would expect Spotless to behave consistently anyway (or to throw alltogether).

On `mvn spotless:apply`:

```
[INFO] --- spotless-maven-plugin:2.34.0:apply (default-cli) @ monolith ---
[INFO] Writing clean file: /Users/blacelle/workspace3/mitrust-datasharing/exec/monolith/README.md
[INFO] Spotless.Markdown is keeping 1 files clean - 1 were changed to be clean, 0 were already clean, 0 were skipped because caching determined they were already clean
[INFO] Writing clean file: /Users/blacelle/workspace3/mitrust-datasharing/exec/monolith/README.md
[INFO] Spotless.Format is keeping 1 files clean - 1 were changed to be clean, 0 were already clean, 0 were skipped because caching determined they were already clean
```

-> The files are written twice: I suppose we have conflicting indentations, and we stop after a cycle: fine.

However, `mvn spotless:check` complains about the style of my files: I would either expect `apply` to fail due to a cycle (or a bad configuration as a single file is covered by multiple languages), or `check` to succeed (potentially with a warning.

---

Is this a bug or a limitation ?
If given (sub-optimal, if not invalid) configuration is considered valid, https://github.com/diffplug/spotless/pull/1643 would help having a consistent behavior.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.