tomasbjerre / violations-lib

Java library for parsing report files from static code analysis.
Apache License 2.0
148 stars 39 forks source link

WIP: Added starting point for Jacoco coverage parser #129

Closed ateglas closed 3 years ago

ateglas commented 3 years ago

Closes #128

Starting point for the coverage parser. It basically takes the jacocoTestReport.xml file and produces a set of violations that can be cross checked afterwards against the VCS code changes.

Definitely not ready to release, just posting this for early feedback. It still needs:

tomasbjerre commented 3 years ago

I think it looks good.

I think you should get the filename from replacing dots with slashes. Similar to what is done here: https://github.com/tomasbjerre/violations-lib/blob/master/src/main/java/se/bjurr/violations/lib/parsers/JUnitParser.java#L122 The important thing is that it needs to be that last part of the path + filename. So that this code matches: https://github.com/tomasbjerre/violation-comments-lib/blob/master/src/main/java/se/bjurr/violations/comments/lib/ChangedFileUtils.java#L25 There are currently no file operations in any parser, and I'd like to keep it that way.

You don't need to bother with documentation. It is OK to have the configuration hard coded in this PR. If you add unit test and implement the filename, I can take it from there.

ateglas commented 3 years ago

There's no need to replace dots, it already contains slashes in the jacoco report for the package name. What I did not knew was the ChangedFileUtils part. I always thought that it needs to be a full match, my conversion from Jacoco to Codeclimate format was always going to all source directories to locate the actual file. Now I see that it just needs to match the end part, that simplifies things a lot.

ateglas commented 3 years ago

It is a bit late so I might have messed it up, but should be closer to what we discussed now.

ateglas commented 3 years ago

Is there something I can do about the openjdk8 failure? Seem like it is related to googleJavaFormat and java11, not something from my PR.