Many errors in the IDE, but not on the server

Hi,

Thnaks for your analysis.

The develop branch is declared as long-lived branch, but as the setting windows says “This applies only during first analysis, the type of a branch cannot be changed later”, maybe it as been declared after the first analysis.
So I tried with the main branch, which is by default a long-lived branch, but the log still says it is a short-lived branch:

09:04:20.983 INFO  Branch name: refs/heads/main, type: short-lived

Hi,

If you go to the branches tab of your project, what does it show for your “Long-lived branches pattern”, toward the top-right?

 
Ann

At the top-right:

Long-lived branches pattern: **(master|main|develop)**

In the middle of the screen:

Long-lived branches
    develop [main branch]   12 days ago
    main                     3 days ago

Short-lived branch
   refs/head/develop         3 days
   refs/heads/some_branch    3 days ago
   some_branch              14 days ago

Well, something happend in our CI some days ago. I’m going to investigate.
But is it normal Sonar consider develop and refs/head/develop as different branches ?

Anyway, the main branch hasn’t this duplication,and the problem is there.

Hi,

Yes. Two different branch names => two different branches.

I don’t know what this means.

And you should be aware that the long-lived branch pattern is a regex, not a glob. So you probably want to adjust your pattern.

 
HTH,
Ann

Hello,

So, I modified some stuff.

  1. As the MAIN branch was on develop instead of main, I renamed develop to master, and I intend to rename later main to master (they’re all on the same commit).
  2. For long-lived branches setting, I just put develop as regular expression, but I don’t have (re)created yet this branch.
  3. I created a branch from master, called Debug_Sonar; and modified a line of code by removing a const to a local variable. Sonar in VS raises a S994, so it should do the same thing with CI.
  4. I updated the Sonar wrapper.
  5. I put the log level to verbove (D-sonar.verbose=true)

Here are the branches:

Long-lived branches
    master [main branch]   13 days ago
    main                    4 days ago

Short-lived branch
   Debug_Sonar              3 hours ago

The changed code has been seen by the scanner, but SonarCloud still reports no error, although it does see the changes (Code tab).

I send you the log in private message.

Hi,

Nothing in your logs is catching my eye, but issues caused by deletions can sometimes be overlooked by PR / short-lived branch analysis.

Can you create an issue with an addition?

 
Ann

It does work when adding a new line !

That’s a bug to resolve: I had three previous commits, each one removing a const. That means one can introduce problems on existing lines without SonarClour raises errors.

Next issue: finding all errors on main branch (“main” in the Sonar way)…

Hi,

That’s unfortunately a known issue for PR and short-lived branch analysis.

Please start a new thread with all the context for this.

 
Ann

Is there an open issue about this point ?
This problem appeared last summer with our other projects. Not “sometimes”, but “always”.

And also about this one:

Hi,

This is not a bug. Spelling (and pathing) counts.

I’m not finding one at the moment, but that doesn’t mean it doesn’t exist. We’re aware of this shortcoming.

 
Ann

I hope it will be resolved soon. We do mainly maintenance, and it is difficult to apply “Clean as you Code” in these conditions.

I am anyway pleased the problem has now a diagnostic.