Inconsistent sonar review check result for the same source code gerrit review


(Chris Chen) #1

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this

SonarQube version: 6.7.5
Recently, my team decided to upgrade SonarQube from version 5.6.6 till 6.7.5.
Then we met some unexpected behavior.

The same code in this history, which has passed the Sonar review check in gerrit, with skipping all the errors/warnings which are stored as history database as legacy issue, based on 5.6.6 version.
However, it failed during the retrigger of such Sonar review check with 6.7.5 version.

There was not any update as in the quality profile or database.
Wondering what could be the cause for such inconsistent sonar review check result?
Also, what would be the most proper way to fix the puzzle?
Thanks in advance!


(G Ann Campbell) #2


It’s not clear to me what your situation is. Could you expand on this, please:



(Chris Chen) #3

Hi, Ganncamp
My situation is that with the same java source code as submitted in gerrit review, we have the same “Sonar way” profile, and also no change about the violations database that are related with the legacy code.
However, when trigger the sonarview check now, it has the indication of “this line are the newly introduced violations, if any. Please take some time to fix them :)” which picked up the check on the history violations which are stored in the database. but not related with any newly updated source code in the gerrit review.

Just curious what could be wrong that lead to Sonar review check got messed up without proper detection of the new violations that could be introduced from the code update in the gerrit review.


(G Ann Campbell) #4

Hi Chris,

Thanks for the expansion.

To verify, you say

which means that SonarQube is correctly showing both the code and its issues as old, and only Gerrit is showing them as new?

If yes, well… I have no experience with Gerrit, and I’m not sure a lot exists in this community (hopefully I will be proven wrong!).


(Chris Chen) #5

Hi, G Ann Campbell
The problem is fixed now, it is mostly due to newly added rules in the sonar way profile for my test project, which detected some new violations in the old code that are not considered to be have been stored in the previous violation data base.
Thanks all the same.