Some of the files not being analyzed and no lines of code are found in them

Hi,

In my project most of the code is being analyzed without an issue, however there are some subpaths, where .cs files are discovered (one can drill down to this files in the SQ portal) but no lines of code are recognized. Some of the files can be found in the log as SQ is not able to find the blame files, some are not mentioned and in SQ portal one can find information about git commits – so the blame stuff is not related to the issue.

How can I start fixing this issue, which part of the analysis log I should post here? (it has around 7k lines, so I don’t think that I should paste the whole thing…)

  • Azure DevOps Server 2019 update 1
  • SonarQube Developer Edition Version 8.3.1 (build 34397)
  • SonarScanner for MSBuild 4.9.

Hello @ldl

Definitely do not paste the 7K lines, but feel free to attached the entire log zipped.
Also if you can point at one file that has the problem you mention so that we can narrow down the logs investigation to that one file. I will have a look.

Olivier

I’ve attached the log.

Following files can be used as an example
.\src\odw\Utilities\Omada.ODW.Logging\syssislog.cs is in the log (no blame information)
.\src\odw\Utilities\Omada.ODW.Logging\LogProviderForOIS.cs is not in the log

log_98_119140.zip (90.8 KB)

Hello @ldl

Sorry I lost track of this thread. I had a look at your logs and saw nothing obvious that would explain this.

Thanks for the 2 files to narrow down. You’re stating that syssislog.cs is in the logs and LogProviderForIOS.cs is not. I actually don’t find any trace of either file in the log you attached

Could you explain what you mean by “I can drill down to the file in the SQ portal, but I don’t see any LoCs” ? Is the file empty ?
Do you have some files in the Omada.ODW.Logging MSBuild project that are properly displayed in SonarQube or do you have the same problem with all the files of that MSBuild project ?

Can you provide a SonarQube screenshot of the 2 files you have isolated in the Omada.ODW.Logging sub project ?

If all files of that Omada.ODW.Logging MSBuild project have the same problem, can you attach the Omada.ODW.Logging .csproj for inspection?

Olivier

The file sysssislog.cs is in the line 5491 of the log. Attached the csproj file.Omada.ODW.Logging.csproj.txt (4.3 KB)

You can see in the portal, that there is no Lines of Code in the Omada.ODW.Logging folder
image

Inside, there are files in which we are interested in
image
Inside of the file you can see code, number of lines and also who has written them
image

I don’t understand this question: "Do you have some files in the Omada.ODW.Logging MSBuild project that are properly displayed in SonarQube or do you have the same problem with all the files of that MSBuild project ?”

Any chance for progress?

Hello,

Thanks for pinging.
I had a 2nd fresh (post vacations) look at your logs. There are many anomalies even though I cannot directly link them to the fact that there are no LoCs found in the Omada.ODW.Logging directory.

Here are those anomalies:

2020-06-11T15:18:24.4595394Z WARN: Exception caught during execution of command '[git, config, --system, --edit]' in 'F:\agent4\externals\git\cmd', return code '129', error message 'error: only one config file at a time

This is likely to break git integration, and this is further reinforced by other messages downstream as below:

2020-06-11T15:37:12.7455735Z WARN: Missing blame information for the following files:
2020-06-11T15:37:12.7462471Z WARN:   ... Plenty of files listed ...

It would be good to understand why these warnings, that however would not immediately justify why the Omada.ODW.Logging directory has no LoCs.

The next more worrying log is:

2020-06-11T15:19:32.8098395Z INFO: ------------- Run sensors on module Omada.ODW.Logging
...
2020-06-11T15:19:34.5648478Z WARN: No Roslyn issues report found for this project.

This clearly means that this module is not properly analyzed (like Omada.ODW.Logging.2014, Omada.ODW.Logging.2017 by the way).

After this I noticed that the 3 above “modules” are actually pointing to the same directory (src\ODW\Utilities\Omada.ODW.Logging). This could well be the root cause of the problem.
Can you explain how you project is structure so that, as part of your solution, several projects link to the same physical directory ?
Would it be possible to run a test with a single instance of the Omada.ODW.Logging module in the solution ?

Olivier

Hi,

I’m not sure how to fix the problem with git config, as the repo works as it should and there is only one config on user level - but that not the point here.

We are offering our software for couple of versions of MS SQL, and as we need to use specific versions of external assemblies, we are building our code couple of times using different versions of MS SQL assemblies.

You were right that the “multiple” compilation of the same code is problematic. With only one build - the lines of code are seen in the SQ portal. The question here is, is it possible to exclude some solutions which are build from the SQ analysis?

Hi @ldl,

To answer:

is it possible to exclude some solutions which are build from the SQ analysis?

I’m not sure how your overal project structure looks like. If you have multiple solutions (multiple build commands in sequence) you can change the begin/end step for SonarScanner like:

scanner begin command
build Solution1 --this will be analyzed in SQ
scanner end command
build Solution2
build Solution3

If you have one solution with multiple projects, then you can exclude individual projects by adding this into your *.csproj file:

<PropertyGroup>
  <SonarQubeExclude>true</SonarQubeExclude>
</PropertyGroup>

Hope this helps
Pavel