SCM reported 56 changed files but doesn't reflect in dashboard

Template for a good new topic, formatted with Markdown:

  • ALM used (GitHub, Bitbucket Cloud, Azure DevOps)

    • Azure Devops
  • CI system used (Bitbucket Cloud, Azure DevOps, Travis CI, Circle CI

    • Azure Devops
  • Scanner command used when applicable (private details masked)

  • Languages of the repository

    • c#

I have a setup where I build my code from within docker containers. It builds, tests and generates all related files (opencover, cobertura, trx, … ).

When I run the dotnet sonarscanner end /d:sonar.login=..... it starts to scan everything.
If I look at the debug logs I encounter the following :

2022-02-16T09:47:27.4578951Z 09:47:27.456 INFO: SCM collecting changed files in the branch (done) | time=665ms
2022-02-16T09:47:27.4586675Z 09:47:27.456 DEBUG: SCM reported 58 files changed in the branch
...
2022-02-16T09:47:46.8264654Z 09:47:46.208 INFO: SCM writing changed lines
2022-02-16T09:47:46.8637779Z 09:47:46.344 DEBUG: SCM reported changed lines for 0 files in the branch
2022-02-16T09:47:46.8638485Z 09:47:46.344 INFO: SCM writing changed lines (done) | time=136ms

So it sees that 56 files have been changed in my branch.

But in the end it says that there are 0 files changed in the branch

Is there something that I’m missing ? Where could I look to see what I’m doing wrong ?

Thanks!

Hey there.

You can imagine a situation where, for example, you’ve moved 58 files from one directory to another (or renamed, etc.) but not actually changed the contents.

Taking a step back – based on your pull request / branch, what do you expect should be the numbrer of changed files / changed lines (let’s ignore what the scanner is saying for a moment and focus on what you see in Azure DevOps)

Well I added some code in 3 files just to make sure that I have changes.

Added a test method. Added something in an interface class. And used the testmethod in another method. Really useless stuff :slight_smile: but in the end, it should trigger some changed code lines.

So at least, there should be 3 changes (and I didn’t write a test for it, so no coverage)

I also checked in azure devops, and those changes are available over there eg :

@Colin : do you have any more directions I can look into ?

Thanks!

@Colin : I found the issue …

While trying to solve this, I created an Azure Devops Pipeline where I performed all the same steps, that I had in my Dockerfile and everything worked without any issues. So it had to be an issue inside the Dockerfile so I started investigating over there…

What happened ? While creating the docker container, the developers moved code around. Copying files from folder A on the host, to folder B inside the container. And ran everything inside that container. But the .git history wasn’t correct anymore.

Well … If I looked at the history, it said that I had 6 changes inside folder A (what is correct and reflected in the git history), but it couldn’t find the changes on disk anymore, inside the dockercontainer. Because folder A didn’t exist inside the container…

So … Changing the dockerfile to make sure that we copied all data from folder A (host) to folder A (container) fixed everything.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.