AmadeusITGroup / sonar-stash

Stash (BitBucket) plugin, a pull-request decorator which allows to integrate SonarQube violations directly into your pull-request
MIT License
165 stars 82 forks source link

Include Existing Issues #181

Closed datasmurfen closed 6 years ago

datasmurfen commented 6 years ago

Include Existing Issues setting. This setting is turned off by default. Either way - I still got a long list in the overview comment section about things not related to my PR - is this expected behaviour?

From the console it seems like it's trying to push a comment as well on those files. [INFO] Comment "xyz" cannot be pushed to Stash like it does not belong to diff view - x.java (line: x)

Also when there is a issue introduced in a PR - it doesn't seem to publish a comment on that line either? I have tried to make new issues you see 😄

EDIT: Also the: sonar.stash.comments.reset - doesn't remove the overview comment?

t-8ch commented 6 years ago

Did you perform a full scan beforehand? It should definitely add a comment on your PR. Do you have a multimodule layout?

The overview comment is not being reset currently.

datasmurfen commented 6 years ago

Yes I ran a fullscan by manually trigger this command mention below by sending in the PR id manually for now from the command line.

Could you please clarify what you mean about "multimodule layout"?

branch=$(git symbolic-ref --short HEAD) repository="${PWD##*/}" mvn sonar:sonar -Dsonar.projectKey="$branch" -Dsonar.analysis.mode=issues -Dsonar.stash.comments.reset \ -Dsonar.stash.notification=true -Dsonar.stash.project=X-Dsonar.stash.repository="$repository" \ -Dsonar.stash.pullrequest.id=$1 -Dsonar.stash.password.variable=SONAR_STASH_PASSWORD

t-8ch commented 6 years ago

Do both your full scan and the PR scan use the same value for "sonar.projectKey"?

How does the layout of your source code look? In case it is non-trivial (sonarqube modules, mismatch between git root and sonar project root) use the setting sonar.stash.repository.root

datasmurfen commented 6 years ago

Aaaa. No it doesn't for the being. In the script i use branch name, and in the full scan triggered by auto-build environment I use maven.project.artifactId (projectname) . Perhaps that is the problem, and I have to set project name in script?

src/integration src/main src/test

t-8ch commented 6 years ago

Well, this key has to match. If you don't specify anything the sonar maven scanner will pick up your projectKey from maven. Whatever you use, just use it consistently.

The multi-module part is relevant when you have multiple maven modules (pom.xml)

datasmurfen commented 6 years ago

Not in this current project I am testing with now. Things went better after changing the project key 👍 So please tell me what I need to do with the projects with multiple pom.xml files?

t-8ch commented 6 years ago

The settings is sonar.stash.repository.root, documented in the Readme