Anyone know if there's a way to map Kotlin's compi...
# build-tools
a
Anyone know if there's a way to map Kotlin's compiler warnings (the ones that get spit out to the command line) into some artifact that we could analyze? Maybe a checkstyle-y XML report? We're not yet at a point where we can turn on warnings-as-errors, but we want to measure and add accountability to teams owning areas with lots of warnings
m
I don’t know if there exists a built-in solution on the compiler side, but in your case you could use some shell scripting to obtain the desired artifact. For example pipe the compiler output into grep and retain only the warnings, then with awk, sed, or some other script transform the lines in the desired format.
t
probably it worth to create a new issue at https://kotl.in/issue
a
👍
grep
is definitely the fallback plan, but before writing some potentially brittle code, I figured it was worth checking if there is an official/community supported way Filed https://youtrack.jetbrains.com/issue/KT-45143
👍 1
t
just to clarify - you want this reports to be generated by
kotlinc
compiler itself or via some Gradle (or other) build system?
a
Honestly, anything -- I'm personally using gradle and not running
kotlinc
directly, but wherever it fits
u
There's an internal option which is not guaranteed to work the same between releases (but we don't intend to change it soon either):
Copy code
kotlinc -Dorg.jetbrains.kotlin.cliMessageRenderer=XML ...
1
(FYI other options at this point besides
XML
are
FullPath
,
RelativePath
(default),
Pathless
,
GradleStyle
.)