Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Sign Up
Dashboard
Sonar
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Page Layout
No Layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard Shortcuts Help
<table class="wysiwyg-macro" data-macro-name="unmigrated-inline-wiki-markup" data-macro-parameters="atlassian-macro-output-type=BLOCK" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e3VubWlncmF0ZWQtaW5saW5lLXdpa2ktbWFya3VwOmF0bGFzc2lhbi1tYWNyby1vdXRwdXQtdHlwZT1CTE9DS30&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre>{iframe:src=http://update.sonarsource.org/plugins/cxx.html|width=700|height=250|frameborder=0} Your browser does not support iframes. {iframe}</pre></td></tr></table><h1><strong style="color: rgb(0,0,0);">Description / Features</strong></h1><p>This plugin adds basic support of C++ language into Sonar.</p><p>Current feature list:</p><ul><li>Basic size metrics:<br /><ul><li>Files (number of)</li><li>Lines</li><li>Lines of comments</li><li>Lines of code</li><li>Lines of commented out code</li></ul></li><li>Static code checking via virtually any static analyser tool. And possibility of extension of their coding rules.</li><li>Dynamic checking for memory management problems via <a href="http://valgrind.org/">Valgrind</a></li><li>Cyclomatic (McCabe) complexity metrics including: <br /><ul><li>Projects complexity</li><li>Average function/method complexity</li><li>Average file complexity</li><li>Complexity distributions</li></ul></li><li>Code coverage metrics including:<br /><ul><li>Unit test overage (line and branch)</li><li>Integration test coverage (line and branch)</li><li>Overall branch coverage (line and branch)</li></ul></li><li>Unit test execution metrics including:<br /><ul><li>Successfully executed tests</li><li>Failed tests</li><li>Skipped tests</li><li>Execution time</li></ul></li><li>Recognition of code duplication</li><li>Basic highlighting mode for C++ in Sonar UI</li></ul><h2><span style="color: rgb(0,0,0);"><strong>Dependencies</strong></span></h2><p><span style="color: rgb(0,0,0);">The Cxx-Plugin has an obligatory dependency on Java (of course... the plugin itself and all runners are Java programs).</span></p><p><span style="color: rgb(0,0,0);">Moreover, there are optional dependencies on:</span></p><ul><li><span style="color: rgb(0,0,0);">Various external code analyzers:</span><ul><li><span style="color: rgb(0,0,0);"><a href="http://cppcheck.sourceforge.net/">Cppcheck</a>. Detects a wide range of problems ranging from performance issues and resource leakage to undefined behaviour. Binary packets are available on/for various platforms. Using the latest release pays off in general; compile from source if in doubt.</span></li><li><span style="color: rgb(0,0,0);"><a href="https://www.fortify.com/ssa-elements/threat-intelligence/rats.html">RATS</a>. Detects (potential) security problems in code, sensible for code bases with increased security requirements. Use binary packages or compile from source.</span></li><li><span style="color: rgb(0,0,0);"><a href="http://www.inspirel.com/vera/">Vera++</a>. Focuses on code style issues. There's a binary package for Windows, users of other platforms are likely to compile themselves.</span></li><li><span style="color: rgb(0,0,0);"><a href="http://valgrind.org/">Valgrind (memcheck)</a>. Detects various memory management problems at runtime. Basically Linux only; just use the packages from your distribution.</span></li><li><span style="color: rgb(0,0,0);"><a href="http://cppncss.sourceforge.net/">CppNcss</a>. Provides cyclomatic (McCabe) complexity measures. This is a Java program distributed as a zip archive. Just unpack and make sure the "bin" directory is in PATH.</span></li><li><span style="color: rgb(0,0,0);"><a href="http://www.gimpel.com/html/pcl.htm">Pc-Lint</a>. Static analyser from Gimpel</span></li></ul></li><li><span style="color: rgb(0,0,0);"><a href="http://gcc.gnu.org/">GCC</a>, <span style="color: rgb(0,0,0);"><span style="color: rgb(0,0,0);"><a href="http://gcc.gnu.org/onlinedocs/gcc/Gcov.html">gcov</a></span></span>, <a href="https://software.sandia.gov/trac/fast/wiki/gcovr">gcovr</a>, <a href="http://www.bullseye.com/">Bullseye</a> and <a href="http://www.python.org/">Python</a> for coverage determination. Install Python and place the script somewhere on the PATH. <span style="color: rgb(0,0,0);"> </span></span></li></ul><h2><span style="color: rgb(0,0,0);"><strong>Installation</strong></span></h2><p><span style="color: rgb(0,0,0);"> </span></p><ol><li>Via Update Center</li><li>Or copy the jar-archive into <em><sonar home></em><code>/extensions/plugins/</code> directory</li><li>Restart the Sonar web server</li></ol><h2>Quick Configuration Guide</h2><p><span style="color: rgb(51,51,51);"> </span></p><p>Cxx plugin uses the following properties during analysis. See <a href="http://docs.codehaus.org/display/SONAR/Analyzing+Source+Code">here</a> for the ways how to pass them to the plugin.</p><p><span style="color: rgb(51,51,51);"> </span></p><p><span style="color: rgb(51,51,51);"> </span></p><table class="confluenceTable"><tbody><tr><th class="confluenceTh"><p>Property</p></th><th colspan="1" class="confluenceTh"><p>Scope</p></th><th colspan="1" class="confluenceTh"><span style="color: rgb(0,51,102);">Default</span></th><th class="confluenceTh"><p>Example</p></th><th class="confluenceTh"><p>Description</p></th></tr><tr><td class="confluenceTd">sonar.cxx.suffixes.sources</td><td colspan="1" class="confluenceTd">System- and/or project-wide</td><td colspan="1" class="confluenceTd"><span>cxx,cpp,cc,c</span></td><td class="confluenceTd">.C,.h</td><td class="confluenceTd"><p>Comma separated list of file name extension to be considered as C++ source files during analysis.</p></td></tr><tr><td colspan="1" class="confluenceTd"><span>sonar.cxx.suffixes.</span><span>headers</span></td><td colspan="1" class="confluenceTd"><span>System- and/or project-wide</span></td><td colspan="1" class="confluenceTd"><span>hxx,hpp,hh,h</span></td><td colspan="1" class="confluenceTd"> </td><td colspan="1" class="confluenceTd"><span>Comma separated list of file name extension to be considered as C++ source files during analysis.</span></td></tr><tr><td class="confluenceTd">sonar.cxx.cppcheck.reportPath</td><td colspan="1" class="confluenceTd">Project-wide</td><td colspan="1" class="confluenceTd">cppcheck-reports/cppcheck-result-*.xml</td><td class="confluenceTd">cppcheck-report-*.xml</td><td class="confluenceTd"><p>Ant pattern describing the path to Cppcheck reports, <strong>relative to projects root.</strong></p></td></tr><tr><td colspan="1" class="confluenceTd">sonar.cxx.cppncss.reportPath</td><td colspan="1" class="confluenceTd">Project-wide</td><td colspan="1" class="confluenceTd">cppncss-reports/cppncss-result-*.xml</td><td colspan="1" class="confluenceTd">cppncss-report-*.xml</td><td colspan="1" class="confluenceTd">Ant pattern describing the path to CppNcss reports, <strong>relative to projects root.</strong></td></tr><tr><td colspan="1" class="confluenceTd">sonar.cxx.gcovr.reportPath (<0.2)</td><td colspan="1" class="confluenceTd">Project-wide</td><td colspan="1" class="confluenceTd">gcovr-reports/gcovr-result-*.xml</td><td colspan="1" class="confluenceTd">gcovr-report-*.xml</td><td colspan="1" class="confluenceTd">Ant pattern describing the path to gcovr reports, <strong>relative to projects root.</strong></td></tr><tr><td colspan="1" class="confluenceTd">sonar.cxx.rats.reportPath</td><td colspan="1" class="confluenceTd">Project-wide</td><td colspan="1" class="confluenceTd">rats-reports/rats-result-*.xml</td><td colspan="1" class="confluenceTd">rats-report-*.xml</td><td colspan="1" class="confluenceTd">Ant pattern describing the path to RATS reports, <strong>relative to projects root.</strong></td></tr><tr><td colspan="1" class="confluenceTd">sonar.cxx.valgrind.reportPath</td><td colspan="1" class="confluenceTd">Project-wide</td><td colspan="1" class="confluenceTd">valgrind-reports/valgrind-result-*.xml</td><td colspan="1" class="confluenceTd">valgrind-report-*.xml</td><td colspan="1" class="confluenceTd">Ant pattern describing the path to Valgrind reports, <strong>relative to projects root.</strong></td></tr><tr><td colspan="1" class="confluenceTd">sonar.cxx.vera.reportPath</td><td colspan="1" class="confluenceTd">Project-wide</td><td colspan="1" class="confluenceTd"><span>vera++-reports/vera++-result-*.xml</span></td><td colspan="1" class="confluenceTd">vera-report-*.xml</td><td colspan="1" class="confluenceTd">Ant pattern describing the path to Vera++ reports, <strong>relative to projects root.</strong></td></tr><tr><td colspan="1" class="confluenceTd">sonar.cxx.xunit.reportPath</td><td colspan="1" class="confluenceTd">Project-wide</td><td colspan="1" class="confluenceTd"><span>xunit-reports/xunit-result-*.xml</span></td><td colspan="1" class="confluenceTd">xunit-report-*.xml</td><td colspan="1" class="confluenceTd">Ant pattern describing the path to unit test execution reports, <strong>relative to projects root.</strong></td></tr><tr><td colspan="1" class="confluenceTd"><span style="color: rgb(0,0,0);">sonar.cxx.pclint.reportPath</span></td><td colspan="1" class="confluenceTd">Project-wide</td><td colspan="1" class="confluenceTd"><span>pclint-reports/pclint-result-*.xml</span></td><td colspan="1" class="confluenceTd"><span>pclint-result-*.xml</span></td><td colspan="1" class="confluenceTd"><span>Ant pattern describing the path to pc-lint reports, </span><strong>relative to projects root.</strong></td></tr><tr><td colspan="1" class="confluenceTd">sonar.cxx.externalrules.reportPath</td><td colspan="1" class="confluenceTd">Project-wide</td><td colspan="1" class="confluenceTd"><span><span>externalrules-result</span>/<span>externalrules-result</span>-*.xml</span></td><td colspan="1" class="confluenceTd">externalrules-result-*.xml</td><td colspan="1" class="confluenceTd"><span>Ant pattern describing the path to unit test execution reports, </span><strong>relative to projects root.</strong></td></tr><tr><td colspan="1" class="confluenceTd">sonar.cxx.xunit.xsltURL</td><td colspan="1" class="confluenceTd">Project-wide</td><td colspan="1" class="confluenceTd"> </td><td colspan="1" class="confluenceTd">cppunit-1.x-to-junit-1.0.xsl</td><td colspan="1" class="confluenceTd"><p>A name of a built in XSLT-file or an URL to an external one. Available builtins:</p><ul><li><strong>boosttest-1.x-to-junit-1.0.xsl </strong> For transforming Boost-reports</li><li><strong>cpptestunit-1.x-to-junit-1.0.xsl </strong>For<strong> </strong>transforming CppTestUnit-reports</li><li><strong>cppunit-1.x-to-junit-1.0.xsl </strong>For transforming CppUnit-reports</li></ul></td></tr><tr><td colspan="1" class="confluenceTd">sonar.cxx.coverage.reportPath (>=0.2)</td><td colspan="1" class="confluenceTd"><span>Project-wide</span></td><td colspan="1" class="confluenceTd"><span>coverage-reports/coverage-*.xml</span></td><td colspan="1" class="confluenceTd"><span>coverage-*.xml</span></td><td colspan="1" class="confluenceTd">Ant pattern describing the path of unit test coverage reports<span>, <strong>relative to projects root.</strong></span></td></tr><tr><td colspan="1" class="confluenceTd"><span style="color: rgb(34,34,34);"><span>sonar.cxx.coverage.</span>itReportPath <span>(>=0.2)</span></span></td><td colspan="1" class="confluenceTd"><span>Project-wide</span></td><td colspan="1" class="confluenceTd"><span>coverage-reports/it-coverage-*.xml</span></td><td colspan="1" class="confluenceTd"><span>it-coverage-*.xml</span></td><td colspan="1" class="confluenceTd"><span>Ant pattern describing the path of integration test coverage reports<span>, <strong>relative to projects root.</strong> </span></span></td></tr><tr><td colspan="1" class="confluenceTd"><span style="color: rgb(34,34,34);">sonar.cxx.coverage.overall</span><span style="color: rgb(34,34,34);">ReportPath (<span style="color: rgb(34,34,34);">>=0.2</span>)</span></td><td colspan="1" class="confluenceTd"><span>Project-wide</span></td><td colspan="1" class="confluenceTd"><span>coverage-reports/overall-coverage-*.xml</span></td><td colspan="1" class="confluenceTd"><span>overall-coverage-*.xml</span></td><td colspan="1" class="confluenceTd"><span>Ant pattern describing the path of overall test coverage reports</span><span>, <strong>relative to projects root.</strong></span></td></tr></tbody></table><p><span style="color: rgb(51,51,51);"> </span><strong style="color: rgb(255,0,0);font-size: 10.0pt;line-height: 13.0pt;"><em>Note: Report paths are always relative to projects path.</em></strong></p><h1>Known limitations</h1><ul><li>Some analyzers (RATS, most notably) may have issues and crash occasionally.</li><li>Valgrind is only available on a subset of UNIX platforms.</li></ul><h2>Roadmap</h2><p><span style="color: rgb(51,51,51);font-size: 10.0pt;font-weight: normal;line-height: 13.0pt;">Following items are in the queue (more or less...):</span></p><ul><li><span style="font-size: 10.0pt;line-height: 13.0pt;color: rgb(51,51,51);font-weight: normal;">Use SSLR technology</span></li><li>Integrate compiler warnings</li><li><p>Implement the dependency analysis (package tangle index metric)</p></li></ul><h2><strong style="font-size: 1.6em;">Changelog</strong></h2><p><img class="editor-inline-macro" src="/plugins/servlet/confluence/placeholder/macro?definition=e2ppcmFpc3N1ZXM6YW5vbnltb3VzPXRydWV8dGl0bGU9VmVyc2lvbiAwLjJ8Y29sdW1ucz10eXBlO2tleTtzdW1tYXJ5O3ByaW9yaXR5O3N0YXR1c3x1cmw9aHR0cDovL2ppcmEuY29kZWhhdXMub3JnL3NyL2ppcmEuaXNzdWV2aWV3czpzZWFyY2hyZXF1ZXN0LXhtbC90ZW1wL1NlYXJjaFJlcXVlc3QueG1sP2pxbFF1ZXJ5PXByb2plY3QrJTNEK1NPTkFSUExVR0lOUytBTkQrZml4VmVyc2lvbislM0QrJTIyQ1hYLTAuMiUyMiZ0ZW1wTWF4PTEwMDB9&locale=en_GB&version=2" data-macro-name="jiraissues" data-macro-parameters="anonymous=true|columns=type;key;summary;priority;status|title=Version 0.2|url=http://jira.codehaus.org/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery\=project+%3D+SONARPLUGINS+AND+fixVersion+%3D+%22CXX-0.2%22&tempMax\=1000"></p><p><img class="editor-inline-macro" src="/plugins/servlet/confluence/placeholder/macro?definition=e2ppcmFpc3N1ZXM6YW5vbnltb3VzPXRydWV8dGl0bGU9VmVyc2lvbiAwLjF8Y29sdW1ucz10eXBlO2tleTtzdW1tYXJ5O3ByaW9yaXR5O3N0YXR1c3x1cmw9aHR0cDovL2ppcmEuY29kZWhhdXMub3JnL3NyL2ppcmEuaXNzdWV2aWV3czpzZWFyY2hyZXF1ZXN0LXhtbC90ZW1wL1NlYXJjaFJlcXVlc3QueG1sP2pxbFF1ZXJ5PXByb2plY3QrJTNEK1NPTkFSUExVR0lOUytBTkQrZml4VmVyc2lvbislM0QrJTIyQ1hYLTAuMSUyMiZ0ZW1wTWF4PTEwMDB9&locale=en_GB&version=2" data-macro-name="jiraissues" data-macro-parameters="anonymous=true|columns=type;key;summary;priority;status|title=Version 0.1|url=http://jira.codehaus.org/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery\=project+%3D+SONARPLUGINS+AND+fixVersion+%3D+%22CXX-0.1%22&tempMax\=1000"></p>
Please type the word appearing in the picture.
Attachments
Labels
Location
Watch this page
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced