Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Usage

Jorge Costa edited this page · 11 revisions
Clone this wiki locally

This section describes the options available for each msbuild task

Installation

Assemblies are provided under https://github.com/jmecosta/MSBuild-SonarQube-CXX/tree/master/MSBuild, just install those into a folder and configure the build scripts to point to that location

Cppcheck

  • SolutionPathToAnalyse : Path to visual studio solution
  • CppCheckPath : Cppcheck executable path
  • CppCheckOptions : Options that can be passed to cppcheck ";" separator
  • CppCheckDefines : Defines that can be passed to cppcheck ";" separator
  • CppCheckIgnores : Folders or files to ignore during analysis ";" separator
  • CppCheckOutputType : output type, xml-version-1, xml-version-2 or vs7
  • CppCheckOutputPath : Output paths of reports, files will be created with name cppcheck-report-*.xml

Example of usage:

cppcheck.msbuild:


<UsingTask TaskName="CppCheckTask" AssemblyFile="CppCheckTask.dll" />
<Target Name="CheckCppCheck">
<CppCheckTask SolutionPathToAnalyse="e:\SRC\Sample.sln"
              CppCheckPath="c:\Program Files\cppcheck\cppcheck.exe"
              CppCheckOptions="--inline-suppr;--enable=all;-j 8"
              CppCheckDefines="__cplusplus"
              CppCheckIgnores="dir1"
              CppCheckOutputType="xml-version-1"
              CppCheckOutputPath="e:\SRC\"
/>
</Target>

msbuild cppcheck.msbuild /t:CheckCppCheck

Rats

  • SolutionPathToAnalyse : Path to visual studio solution
  • RatsPath : Rats executable path
  • RatsOptions : Options to Rats, see rats help
  • RatsIgnores : Files to ignore when running analysis ";" separator
  • RatsOutputType : output type, xml or vs7
  • RatsOutputPath : Output paths of reports, files will be created with name rats-report-*.xml
  • PathReplacementStrings : Visual Studio can reference files using system parameters, these can be replaced by using this option. ";" separator.

Example of usage:

rats.msbuild:


<UsingTask TaskName="RatsTask" AssemblyFile="RatsTask.dll"/>
<Target Name="CheckRats">
<RatsTask SolutionPathToAnalyse="e:\SRC\Sample.sln"
              RatsPath="c:\Program Files\rats-2.3\rats.exe"
              RatsOutputType="xml"
              RatsOutputPath="e:\SRC\"
              PathReplacementStrings="SRCDIR=e:\CRC;OBJDIR=e:\OBJ"
/>
</Target>

msbuild rats.msbuild /t:CheckRats

Vera++

  • SolutionPathToAnalyse : Path to visual studio solution
  • VeraPath : Vera executable path
  • VeraOptions : Options to Vera, see vera help
  • VeraIgnores : Files to ignore when running analysis ";" separator
  • VeraOutputType : output type, xml or vs7
  • VeraOutputPath : Output paths of reports, files will be created with name vera++-report-*.xml
  • PathReplacementStrings : Visual Studio can reference files using system parameters, these can be replaced by using this option. ";" separator.

Example of usage:

vera.msbuild:


<UsingTask TaskName="VeraTask" AssemblyFile="VeraTask.dll"/>
<Target Name="CheckVera">
<RatsTask SolutionPathToAnalyse="e:\SRC\Sample.sln"
              VeraPath="c:\Program Files\vera++\bin\vera++.exe"
              VeraOutputType="xml"
              VeraOutputPath="e:\SRC\"
              VeraOptions="-nodup -showrules"
              PathReplacementStrings="SRCDIR=e:\CRC;OBJDIR=e:\OBJ"
/>
</Target>

msbuild vera.msbuild /t:CheckVera

Xunit google test source finder

This task can be used to find the source location of units that run using gtest

  • SolutionPathToAnalyse : Path to visual studio solution
  • TestSuffix : test suffix, leave empty to each all files in solution
  • GtestXMLReportFile : Input xml report file in xunit format
  • GtestXunitConverterOutputPath : output xml files, xunit-result-0.xml
  • SkipSearchForFileLocation : Skip files from analysis
  • PathReplacementStrings : Visual Studio can reference files using system parameters, these can be replaced by using this option. ";" separator.

Example of usage:

gtestxunitconverter.msbuild:


<UsingTask TaskName="GtestXunitConverterTask" AssemblyFile="GtestXunitConverterTask.dll"/>
              <GtestXunitConverterTask SolutionPathToAnalyse="e:\SRC\Sample.sln"
              TestSuffix="_tests.cpp;_test.cpp"
              GtestXMLReportFile="e:\SRC\report.xml"
              GtestXunitConverterOutputPath="e:\SRC\reports-xunit"
                  />
</Target>

msbuild getstxunitconverter.msbuild /t:CheckVera

CppLint

This is a cpplint task, that uses the concept of the external sensor in the sonar-cxx plugin. Therefore rules for this tool need to be created before this task can be used. See http://docs.codehaus.org/display/SONAR/Usage+of+Non+Supported+Tools

  • SolutionPathToAnalyse : Path to visual studio solution
  • PythonPath : Python interperter path
  • CppLintPath : Cpplint.py path, check google https://code.google.com/p/google-styleguide/
  • CppLintEnvironment : Additional environment variables ";" separator
  • CppLintOutputType : output type, xml or vs7
  • CppLintOutputPath : Output paths of reports, files will be created with name cpplint-report-*.xml
  • PathReplacementStrings : Visual Studio can reference files using system parameters, these can be replaced by using this option. ";" separator.

Example of usage:

cpplint.msbuild:


<UsingTask TaskName="CppLintTask" AssemblyFile="CppLintTask.dll"/>
<Target Name="CheckCppLint">
<CppLintTask SolutionPathToAnalyse="e:\SRC\Sample.sln"
              PythonPath="c:\Python27\python.exe"
              CppLintPath="c:\cpplint.py"
              CppLintOutputType="xml"
              CppLintOutputPath="e:\SRC\"
              PathReplacementStrings="SRCDIR=e:\CRC;OBJDIR=e:\OBJ"
/>
</Target>

msbuild cpplint.msbuild /t:CheckCppLint

Intel Inspector

This is a intel inspector task, that uses the concept of the external sensor in the sonar-cxx plugin. Therefore rules for this tool need to be created before this task can be used. See http://docs.codehaus.org/display/SONAR/Usage+of+Non+Supported+Tools

  • StackDepth : stack depth option
  • AnalysisType : analysis type: mi1, mi2, mi3
  • ExecutableToRun : path to the executable to run, normally a unit test
  • ExecutableEnvironment : Additional environment variables ";" separator
  • PathToIntelInspector : Path to intel inspector
  • ResourceLeaks : check resource leaks, slower
  • ResultFile : xml output file to create

Example of usage:

intelinspector.msbuild:


<UsingTask TaskName="IntelInspectorTask" AssemblyFile="IntelInspectorTask.dll"/>
<Target Name="CheckInspector">
<IntelInspectorTask StackDepth="1"
                    AnalysisType="mi1"
                    ExecutableToRun="e:\SRC\bin\test1.exe"
                    PathToIntelInspector="C:\Program Files (x86)\Intel\Inspector XE 2013"
                    ResultFile="e:\SRC\result.xml"
/>
</Target>

msbuild intelinspector.msbuild /t:CheckInspector
Something went wrong with that request. Please try again.