Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give option for detailed linting errors #2455

Open
sebastian-peter opened this issue Mar 24, 2025 · 1 comment
Open

Give option for detailed linting errors #2455

sebastian-peter opened this issue Mar 24, 2025 · 1 comment

Comments

@sebastian-peter
Copy link

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)

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, 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).

@nedtwigg
Copy link
Member

You're absolutely right, this is an important feature. Right now detailed is always set to false, we need to add a command line flag which can set it to true.

// We only show lints if there are no unformatted files.
// This is because lint line numbers are relative to the
// formatted content, and formatting often fixes lints.
boolean detailed = false;
throw new GradleException(super.allLintsErrorMsgDetailed(lintsFiles, detailed));

We should make this change too

-There were 411 lint error(s), they must be fixed or suppressed.
+There were 411 lint error(s), they must be fixed or suppressed. Rerun with `--lint-detail` for more info.

Thoughts on the flag name? PR's welcome, I'm not gonna get around to implementing this anytime soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants