jenkinsci / violation-comments-to-stash-plugin

Comments Bitbucket Server (or Stash) pull requests with static code analyzer findings.
https://plugins.jenkins.io/violation-comments-to-stash
MIT License
43 stars 16 forks source link

Violation plugin iterates over files not mentioned in report #63

Closed vzabawski closed 5 years ago

vzabawski commented 5 years ago

Violation plugin scans all files in pull request and tries to get information about them even if ther are not mentioned in report file:

2019-02-12_16h04_46

Here's my plugin configuration:

2019-02-12_16h00_31

This behavior slows down build process because build is not finished until all files are processed.

Even after I changed commentOnlyChangedContent to true, nothing changed and plugin keeps iteration over all files in pull request.

Info

tomasbjerre commented 5 years ago

First requests gets all changes.

The following requests are looking for old comments. Old comments made by findings in previous analysis. With a previous report file where it they might have been mentioned.

https://github.com/tomasbjerre/violation-comments-to-bitbucket-server-lib/blob/master/src/main/java/se/bjurr/violations/comments/bitbucketserver/lib/BitbucketServerCommentsProvider.java#L111

vzabawski commented 5 years ago

Is there any way to change such behavior? Right now, those API calls take 90% of build time for some jobs.

2019-02-12_16h39_51

I've tried to adjust plugin parameters, so current parameters look like:

2019-02-12_16h43_34

Those adjustments allowed to decrease build time by ~30% but API calls part still takes a lot of time. So, is there any way to change this behavior? Thanks in advance.

tomasbjerre commented 5 years ago

If the createSingleFileComments is false, then I think it should be no problem avoiding these calls.

vzabawski commented 5 years ago

It can be achieved by enabling "Create one big comment with all violations" in UI, right?

tomasbjerre commented 5 years ago

Yes. This plugin just needs a change in the implementation first.

tomasbjerre commented 5 years ago

Just released a fix in version 1.99 now.