Old issues from other branches leak into new code short live branch analysis

git

(Huska) #1

Hi,

we are having troubles that SonarQube shows old issues for short living branches, however the behavior is somewhat random. It looks like the old code is more likely to show up if it’s being changed in some other branch of our project. We use git rebase strategy for branching.

What is also suspicious (and maybe connected to this problem) is that in the UI we don’t see GIT commits and commiter names, just dates:

image

also it doesn’t show any highlight for new code and this is the only date mark in the whole file, even it’s been composed by many commits in the history.

I searched the forums, but didn’t find any similar issue, so probably there is some obvious settings to be used.

Any help will be really appreciated.

Regards,
Jiri Husak

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube 7.7 developer edition, sonar-scanner-3.2.0.1227-linux
  • what are you trying to achieve
    clean new code analysis
  • what have you tried so far to achieve this
    normally the tool is supposed to work like that in default configuration

(G Ann Campbell) #2

Hi Jiri,

The identification of new code and issues works best when SCM data is available. What’s you’re SCM engine, are the relevant data files (E.G. the .git directory for Git projects) available in the project at analysis time, and is the relevant SCM plugin installed in your SonarQube instance? Also, what’s your analysis command?

 
Ann


(Huska) #3

Hello Ann,

thank you for coming back to me.

I’ll try to reply my best as I’m not personally the admin of the server.

The SCM is GIT and as far as I understood the GIT plugin is integrated now in the SonarQube Server and we don’t need to have a specific plugin. (https://docs.sonarqube.org/latest/analysis/scm-integration/) Could you please confirm that?

We launch the analysis as part of Jenkins pipeline branch by these commands:

/home/user/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir build-wrapper make -r sonar VERBOSE=1 OBJECT_DIR=_build/SONAR_ANALYSIS’
Linux SonarQube Scanner 3.2.0.1227/bin/sonar-scanner -Dsonar.branch.name=${env.BRANCH_NAME}

The wrapper is launched from a makefile directory, however the .git files are located few dirs above. Could this be a problem ( but I have seen it’s fixed - https://jira.sonarsource.com/browse/SONARSCGIT-35)?

Thank you for your support

Regards,
Jiri


(G Ann Campbell) #5

Hi Jiri,

This seems to be the same problem that’s being investigated in

If you agree, in order to keep the investigation focused, could you follow along/contribute there, please?

 
Thx,
Ann