Correct usage of SQAnalysisFileItemTypes

72 views
Skip to first unread message

tig...@googlemail.com

unread,
May 17, 2018, 3:37:07 AM5/17/18
to SonarQube

I want to analyze a C++ project created with Qt. But all header files that have a QtMoc tag in the .vcxproj file are ignored.

For example:

  <ItemGroup>

    <QtMoc Include="SOMECLASS.h">

    </QtMoc>

  </ItemGroup>


I think its because this tool only recognize the following tags: Compile; Content; EmbeddedResource; None; ClCompile; ClInclude; Page; TypeScriptCompile

So I wanted to add another tag with the following command:

/d:"sonar.SQAnalysisFileItemTypes=$(SQAnalysisFileItemTypes);QtMoc"

 

OR

 

/d:"SQAnalysisFileItemTypes=$(SQAnalysisFileItemTypes);QtMoc"


Both are not working. Can someone give me a hint what the correct syntax must look like? Is it even possible to control this with the command?

duncan.po...@sonarsource.com

unread,
May 17, 2018, 1:09:27 PM5/17/18
to SonarQube
$(SQAnalysisFileItemTypes) is an MSBuild property so you can't set it using /d:XXXX.

If you are using version 4 of the Scanner for MSBuild then there is a new MSBuild property you can set to specify additional ItemGroup types to pass through for analysis: $(SQAdditionalAnalysisFileItemTypes). Set the property SQAdditionalAnalysisFileItemTypes to "QtMoc", either on the MSBuild command line or in your project files as described here

If you are using an older version of the Scanner you can set $(SQAnalysisFileItemTypes) directly. However, depending on the order the properties are evaluated you might need to specify all of the item types you want to analyse.

Regards,
Duncan

tig...@googlemail.com

unread,
May 18, 2018, 2:11:52 AM5/18/18
to SonarQube
I added:

 <PropertyGroup>
  <SQAdditionalAnalysisFileItemTypes>QtMoc</SQAdditionalAnalysisFileItemTypes>
  </PropertyGroup>

... and it worked. Thank you!
Reply all
Reply to author
Forward
0 new messages