diffplug / diffplug/spotless

Give option for detailed linting errors

Open
#2,455 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
5.6k
Forks
559
Avg merge
1d 14h
Merged PRs (30d)
43

Description

After upgrading to version 7, spotless just kept crashing when linting Scala in spotlessCheck/Apply, with a cryptic error message:

```
There were 411 lint error(s), they must be fixed or suppressed.
src/main/scala/edu/ie3/simona/actor/ActorUtil.scala:LINE_UNDEFINED scalafmt(java.lang.reflect.InvocationTargetException) java.lang.reflect.InvocationTargetException (...)
[...]
```
([CI run here](https://github.com/ie3-institute/simona/actions/runs/13314184819/job/37184042413?pr=1106))

Turns out the cause of our problem was that the scalafmt version was not set to the exact one required (3.8.1) in `.scalafmt.conf`. [It took me some time to figure this out](https://github.com/ie3-institute/simona/pull/1106#issuecomment-2748536248), so maybe there's a way to make the error logging more verbose. Giving an option to print the stack traces of linting errors would be great, for example (my apologies if this option exists already, I have not found it).

Contributor guide

Open the contributing guide

Research direction

Use the linked CI run and the `.scalafmt.conf` version mismatch as the reproduction context. Trace the Scala/Scalafmt lint-error reporting path and existing configuration options; done means users can opt into stack traces for linting errors without changing the default output.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, scala
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.