3

I have C++ projects with source code libraries in sub-modules and am using the Sonar commercial C++ plugin. I wish to analyze all the sources.

The parent project needs access to some of the headers (and compiled libs) in the sub-modules and therefore by using sub-modules I can readily pin (and hence compile against) the right library version.

eg ./main.c contains #include sub/someinclude.h

where sub is the directory containing the git sub-module

When analysing with sonar with SCM enabled I am getting:

INFO: -----------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: -----------------------------------------------------------------------
Total time: 2:17.478s
Final Memory: 27M/617M
INFO: -----------------------------------------------------------------------
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: Unable to blame file sub/someinclude.h. No blame info at line 1. Is file commited?

Sonar appears to be failing to do a git blame probably because it tries to reference the projectBaseDir rather than the current file directory and someinclude.h is not in the parent git repo.

I have tried several multi-project sonar property file configurations placed in the parent and the sub-module or even externally but cannot find one that works.

This looks like a normal use case so can anybody advise a solution or is this a bug/limitation that needs fixing?

flashydave
  • 71
  • 2
  • 5

1 Answers1

0

I just had the same issue; there's no blame info because the file is probably not tracked.

If you run a "git status", is sub/someinclude.h not committed? Either commit it or try to add it to .gitignore. In my case I just committed the file and Sonarqube worked.

  • 2
    I think the explanation of your answer is [there](http://stackoverflow.com/a/28326588/2394026) – Flows Jun 01 '16 at 12:02