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

No PR comments for Finbugs #33

Closed goostleek closed 7 years ago

goostleek commented 7 years ago

I have configured the plugin for Checkstyle and Findbugs violations but only Checkstyle comments are visible in the PR. Do you have any suggestions how I can investigate the reason of having no comments for Findbugs? Last part of my Jenkins PR builder job log is:

---
--- Jenkins Violation Comments to Bitbucket Server ---
---
bitbucketServerUrl: [REDACTED]
projectKey: BEST
repoSlug: [REDACTED]
pullRequestId: 201
usernamePasswordCredentialsId: true
username: false
password: false
createSingleFileComments: true
createCommentWithAllSingleFileComments: false
commentOnlyChangedContent: false
commentOnlyChangedContentContext: 0
ANDROIDLINT with pattern 
CHECKSTYLE with pattern .*/checkstyle-result\.xml$
CODENARC with pattern 
CPD with pattern 
CPPCHECK with pattern 
CPPLINT with pattern 
CSSLINT with pattern 
FINDBUGS with pattern .*/findbugsXml\.xml$
FLAKE8 with pattern 
FXCOP with pattern 
GENDARME with pattern 
JCREPORT with pattern 
JSHINT with pattern 
LINT with pattern 
MYPY with pattern 
PERLCRITIC with pattern 
PITEST with pattern 
PMD with pattern 
PYDOCSTYLE with pattern 
PYLINT with pattern 
RESHARPER with pattern 
SIMIAN with pattern 
STYLECOP with pattern 
XMLLINT with pattern 
ZPTLINT with pattern 
Using username and password from credentials
Will comment 201
Workspace: /var/jenkins_home/jobs/[REDACTED]-pull-request-builder/workspace
Found 3 violations from ViolationConfig [reporter=CHECKSTYLE, pattern=.*/checkstyle-result\.xml$].
Found 25 violations from ViolationConfig [reporter=FINDBUGS, pattern=.*/findbugsXml\.xml$].
Will comment PR BEST/[REDACTED]/201 on [REDACTED]
Notified Stash for commit with id c0d13ffe5273c2a3bdd5e7e06258f0f1466b0a1c
Finished: SUCCESS

I'm using the latest version of the plugin (1.43)

tomasbjerre commented 7 years ago

If you look at the server-log of Jenkins instance. Perhaps there is a stacktrace?

tomasbjerre commented 7 years ago

And are you sure that the findbugsXml.xml contains findings on files that were changed in the PR?

goostleek commented 7 years ago

Yes, I can browse all violations on the particular Jenkins build. Additionally the log output I added above contains the line telling there are 25 violations

Found 25 violations from ViolationConfig [reporter=FINDBUGS, pattern=.*/findbugsXml\.xml$].

Unfortunately I don't have access to Jenkins master log files yet to dig into it deeper. Once I have I'll try to update the issue to provide more info.

tomasbjerre commented 7 years ago

If you can attach the findbugs.xml-file here that might help.

goostleek commented 7 years ago

I'm affraid this is not an option at the moment. The client I work for is very concerned about privacy of the source code. But when I have time I will prepare a dummy project to provide some example Findbugs output.

goostleek commented 7 years ago

Ok, I have solved the issue. The problem was that I have misused the plugin. Although the build has several Findbugs warnings the PRs used in testing the configuration do not contain the affected code. Once I have added some code with a new Findbugs warning to the PR they appear immediately as a PR comment.

It works as expected now. However I still don't have the comments placed in the right place. I would expect to have the comment placed in the file at the a line which is reported by Findbugs. At the moment the comment is presented only in the Overview tab of the particular PR (in the Activity section).

(If you need I can include a screenshot to show how it looks)

tomasbjerre commented 7 years ago

Did you perform the merge before performing the analysis?

Den 27 feb. 2017 12:11 PM skrev "Marcin Kłopotek" <notifications@github.com

:

Ok, I have solved the issue. The problem was that I have misused the plugin. Although the build has several Findbugs warnings the PRs used in testing the configuration do not contain the affected code. Once I have added some code with a new Findbugs warning to the PR they appear immediately as a PR comment.

It works as expected now. However I still don't have the comments placed in the right place. I would expect to have the comment placed in the file at the a line which is reported by Findbugs. At the moment the comment is presented only in the Overview tab of the particular PR (in the Activity section).

(If you need I can include a screenshot to show how it looks)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jenkinsci/violation-comments-to-stash-plugin/issues/33#issuecomment-282692270, or mute the thread https://github.com/notifications/unsubscribe-auth/AAa1E-NNWjfaO4Rho7J5Usc5NgkmUQqlks5rgq9CgaJpZM4MBaB_ .

goostleek commented 7 years ago

No, I'm using PR builder approach. The Findbug analysis is done on the branch used to create the PR. Are you suggesting to merge it back to parent branch to fix this?

tomasbjerre commented 7 years ago

Yes. Let Jenkins merge source branch into target branch and perform the analysis. Without pushing the merge-commit ofcourse =)