-
Notifications
You must be signed in to change notification settings - Fork 185
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
Export scalafix report to a file or expose errors via an API #951
Comments
Thanks for reporting! I think is a nice idea. Is there a standard format we can output? Scalafix exposes a library API to record published diagnostics in scalafix/scalafix-interfaces/src/main/java/scalafix/interfaces/ScalafixMainCallback.java Line 12 in f29dbdd
It depends on the integration what we do in that callback, the cli prints to the console and sbt-scalafix uses the sbt logger. |
Both Scalastyle and Scapegoat support generating reports in a Checkstyle compatible xml format, so it would make sense to me if scalafix could also stick to this convention - I'll add an example later of how a generated report could look like. @BalmungSan, do you have any thoughts on that? |
I agree it would make sense to keep a similar format.
I believe these are standard enough to be useful for other tools. But, more importantly, we would need a way to extract all issues that could be reported, in order to create the BTW, it would be really useful if the report could be generated on a project level instead of a module level. |
Related to #1154 |
Is there any progress on this? We are currently using the checkstyle xml report that Scalastyle outputs and we are working on switching to Scalafix. |
Like discussed here https://contributors.scala-lang.org/t/lack-of-security-tooling/5918, it would be nice to add reporting capabilities to scalafix. Is there a standard format for this in the industry for tools like SonarQube and such? Otherwise maybe just integrating with SonarQube would be a start. Also adding SAST scalafix rules would be a nice addition |
No progress, but contributions are welcome! Either as a special mode in sbt-scalafix using the guidance above, or as a built-in flag in scalafix-cli itself. I'll be happy to provide help on Discord if someone wants to take a look at it.
As mentioned above, the checkstyle XML report might be good fit for Scalafix linters rules. |
Thanks to @xuwei-k, we have a sbt-centric tool to generate CI-actionnable reports for compiler & scalafix lints. It's currently custom and limited to syntactic rules, but scalacenter/sbt-scalafix#384 should enable a better integration and support for semantic rules. |
Would it be possible for scalafix to generate a file report with all the reported errors in e.g. json or xml format or allow scalafix to be run and expose the errors via an API so other tools could make use of that? My specific use case would be to import scalafix errors into SonarQube (a tool for static code analysis) using the sonar-scala plugin, but I'm sure others might also find this feature useful.
I suppose this would only apply to the
DisableSyntax
rules as the other rules rewrite the source code.I'd be happy to work on this if we could agree on details about how this should work.
The text was updated successfully, but these errors were encountered: