diffplug / diffplug/spotless

warn user when a file being a part of multiple formats

Offen
#1,656 7 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
Java
Sterne
5.7k
Forks
561
Ø Merge
1 T. 14 Std.
Gemergte PRs (30 T.)
43

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start with PADDEDCELL.md and reproduce the configuration using the Maven entry points `spotless:apply` and `spotless:check`. Compare how overlapping `formats` and `markdown` includes are processed, then use pull request 1643 as context. Done means overlapping file handling is consistent and either produces an appropriate warning/error or makes apply and check agree.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java, markdown
Bereich
build-system, tooling
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.