Need explanations about "Clean as you code"

Hello,

After several months, I succeeded thanks to some Sonar people, to get some results again on Sonar Cloud (I had to add the property sonar.cfamily.internal.reduceAnalysisScope=false).

When I analyze a short-live branch, Sonar raises bugs/smell code on new code I deliberately added for test purpose, but also for all code in the files where I added the code. So I get also bugs/smell code for old code.

Is it the expected behavior ?

Hi,

This is not the expected behavior. This is going to be about the SCM metadata available to analysis (and thus, about your checkout). Are you doing a shallow clone?

 
Ann

Hello,

I don’t know. I use the Git plugin for Jenkins:

    checkout([
        $class: 'GitSCM',
        branches: [[ name: "${_repoMainBranchName}" ]],
        extensions: scm.extensions,
        userRemoteConfigs:
        [[
            credentialsId: "${JENKINS_GITLAB_CREDENTIALS_NAME}",
            url: "https://gitlab.com/${_repoPath}"
        ]]
    ])

Hi,

I’m no expert in the Jenkins pipeline checkout. I don’t see anything about the fetch depth here. You should probably dig into that.

 
Ann

Hi,

According the documentation of the Git plugin, an option must be added to do shallow cloning:

checkout scmGit(
    branches: [[name: '*/master']],
    extensions: [ cloneOption(shallow: true) ],
    userRemoteConfigs: [[url: 'https://github.com/jenkinsci/ws-cleanup-plugin']])

so I don’t think we do shallow cloling, even if the sybntax we use is deprecated, and must be updated.

May the raised problem caused by the expired 90 days limits ? If so, why do the raised errors are not also among the other files ?

Hi,

Sorry, I’m not sure what to tell you.

Again, this is going to be about the SCM metadata available to analysis. Make sure the prerequisites are in place.

 
HTH,
Ann