What are the motivations of `problems api`? Ist it...
# community-support
v
What are the motivations of
problems api
? Ist it meant to surface just compiler warnings? Or does it what to contain static analysis results as well? Also, how am I supposed to surface it in PRs? Via
sarif
format integeration github/gitlab have?
e
AFAIK, primarily it will help IDEs surface errors and actions to take on them better
v
What do you mean by "surface it"? Gradle should show things reported to the problems API also on the commandline, so you should already see it in PRs. There are also plans that you can get the problems API element from a plugin but afair this is not yet possible.
e
it makes it possible for users of the tooling API (mainly IDEs) to link directly from a problem to the source file causing the issue without having to parse compiler output
v
I mean in PR integrations, gitlab has a visual way to surface new static analysis issues (Not just digging through cicd logs which nobody does if build passes)
e
ProblemSpec also has a "solution" field
v
Okay so.. can I surface say kotlinc warnings in a structured way?
e
not until Kotlin starts using the Problems API (I think I saw a YT issue for it)
v
If they report to the problems api, and you consume the problems api, and send it to the CI/CD in their way like generating annotations on GitHub Actions, probably
v
yea ita coming hence me asking
v
the problems api, can I get the results via a file or do I need to write a plugin?
e
neither
at the moment, it does output an HTML report but not a well-defined machine-readable format, and it's not available for plugins to read
v
but is there an intention for it to work like that eventually?
e
and not all of the information is available in the console, https://github.com/gradle/gradle/issues/32071
v
basically I want the compiler warnings, is this a good way?
v
Also https://github.com/gradle/gradle/issues/32586 would maybe have the jsons for the problems in separate files
It at least is the future, yes. :-)
e
it's not very useful for your use case right now
v
Unless you run the build through tooling API of course, to get the problem api reports through that.
But of course not for Kotlin yet.
v
Okay it will become the way to go eventuelly, thanks
t
I can't tell for Kotlin, but if you want JavaC compiler warnings to a file, you can use a compiler plugin: https://github.com/tbroyer/javac-diagnostics-serializer (note that this project has specific handling of ErrorProne diagnostics)
a
There's a slack channel. Not much on there but worth reading through the messages. https://gradle-community.slack.com/archives/C07UNDEAF6K