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
<h1>Creation of a profile for a external tool - Mandatory before running a analysis</h1><p>The creation of a rule set for the external tool re-uses the concept of <a class="confluence-link" href="/pages/viewpage.action?pageId=230398146" data-linked-resource-id="230398146" data-linked-resource-type="page" data-linked-resource-default-alias="Extending Rules in C++ Analysers" data-base-url="http://docs.codehaus.org">Extending Rules in C++ Analysers</a> therefore the only thing needed is a xml file with the definition of the rules and their respective activation in sonar. The rules xml file needs to be installed under </p><ul><li>[Server Dir]\extensions\rules\<strong>cxxexternal</strong></li></ul><h1>Importing the violation report for the external tool</h1><p><span style="color: rgb(51,51,51);font-size: 10.0pt;font-weight: normal;line-height: 13.0pt;">The property <strong>sonar.cxx.externalrules.reportPath</strong> is used to point to the location of the report (<strong>relative to project root</strong>). </span><span style="font-size: 10.0pt;line-height: 13.0pt;">The following table describes the format of the report</span></p><table class="confluenceTable"><tbody><tr><th class="confluenceTh">Xml Description - RNG-Schema</th><th class="confluenceTh">Example</th></tr><tr><td colspan="1" class="confluenceTd"><pre><span class="nt" style="color: rgb(0,0,128);"><element</span> <span class="na" style="color: rgb(0,128,128);">name=</span><span class="s" style="color: rgb(221,17,68);">"results"</span> <span class="na" style="color: rgb(0,128,128);">xmlns=</span><span class="s" style="color: rgb(221,17,68);">"http://relaxng.org/ns/structure/1.0"</span><span class="nt" style="color: rgb(0,0,128);">></span> <span class="nt" style="color: rgb(0,0,128);"><zeroOrMore></span> <span class="nt" style="color: rgb(0,0,128);"><element</span> <span class="na" style="color: rgb(0,128,128);">name=</span><span class="s" style="color: rgb(221,17,68);">"error"</span><span class="nt" style="color: rgb(0,0,128);">></span> <span class="nt" style="color: rgb(0,0,128);"><attribute</span> <span class="na" style="color: rgb(0,128,128);">name=</span><span class="s" style="color: rgb(221,17,68);">"file"</span><span class="nt" style="color: rgb(0,0,128);">/></span> <span class="nt" style="color: rgb(0,0,128);"><attribute</span> <span class="na" style="color: rgb(0,128,128);">name=</span><span class="s" style="color: rgb(221,17,68);">"msg"</span><span class="nt" style="color: rgb(0,0,128);">/></span> <span class="nt" style="color: rgb(0,0,128);"><attribute</span> <span class="na" style="color: rgb(0,128,128);">name=</span><span class="s" style="color: rgb(221,17,68);">"id"</span><span class="nt" style="color: rgb(0,0,128);">/></span> <span class="nt" style="color: rgb(0,0,128);"><attribute</span> <span class="na" style="color: rgb(0,128,128);">name=</span><span class="s" style="color: rgb(221,17,68);">"line"</span><span class="nt" style="color: rgb(0,0,128);">></span> <span class="nt" style="color: rgb(0,0,128);"><data</span> <span class="na" style="color: rgb(0,128,128);">type=</span><span class="s" style="color: rgb(221,17,68);">"integer"</span> <span class="na" style="color: rgb(0,128,128);">datatypeLibrary=</span><span class="s" style="color: rgb(221,17,68);">"http://www.w3.org/2001/XMLSchema-datatypes"</span> <span class="nt" style="color: rgb(0,0,128);">/></span> <span class="nt" style="color: rgb(0,0,128);"></attribute></span> <span class="nt" style="color: rgb(0,0,128);"><text/></span> <span class="nt" style="color: rgb(0,0,128);"></element></span> <span class="nt" style="color: rgb(0,0,128);"></zeroOrMore></span> <span class="nt" style="color: rgb(0,0,128);"></element></span></pre></td><td colspan="1" class="confluenceTd"><p><span style="color: rgb(255,0,0);"><?</span><span style="color: rgb(0,0,255);">xml</span> <span style="color: rgb(255,0,0);">version</span>=<span style="color: rgb(0,0,255);">"1.0"</span><span style="color: rgb(255,0,0);">?></span><br /><span style="color: rgb(0,0,255);"><results></span><br /><span style="color: rgb(0,0,255);"><error</span> <span style="color: rgb(255,0,0);">file</span>=<strong>"sources/utils/code_chunks.cpp"</strong> <span style="color: rgb(255,0,0);">line</span>=<strong>"1"</strong> <span style="color: rgb(255,0,0);">id</span>=<strong>"cxxexternal-unusedFunction"</strong> <span style="color: rgb(255,0,0);">msg</span>=<strong>"The function 'foo' is never used"</strong><span style="color: rgb(0,0,255);">/></span><br /><span style="color: rgb(0,0,255);"><error</span> <span style="color: rgb(255,0,0);">file</span>=<strong>"sources/utils/utils.cpp"</strong> <span style="color: rgb(255,0,0);">line</span>=<strong>"1"</strong> <span style="color: rgb(255,0,0);">id</span>=<strong>"cxxexternal-unusedFunction"</strong> <span style="color: rgb(255,0,0);">msg</span>=<strong>"The function 'utils' is never used"</strong><span style="color: rgb(0,0,255);">/></span><br /><span style="color: rgb(0,0,255);"></results></span></p></td></tr><tr><td class="highlight confluenceTd" colspan="1">Attribute</td><td class="highlight confluenceTd" colspan="1"><p><span style="color: rgb(0,0,0);">Description</span></p></td></tr><tr><td colspan="1" class="confluenceTd">file</td><td colspan="1" class="confluenceTd">source file, relative to project path</td></tr><tr><td colspan="1" class="confluenceTd">line</td><td colspan="1" class="confluenceTd">line of the violation</td></tr><tr><td colspan="1" class="confluenceTd">id</td><td colspan="1" class="confluenceTd">id of the rule, mapped a rule in sonar. See "<strong><span style="color: rgb(0,0,0);">Enable the rules in Sonar server" </span></strong><span style="color: rgb(0,0,0);">below</span></td></tr><tr><td colspan="1" class="confluenceTd">msg</td><td colspan="1" class="confluenceTd">description of the violation</td></tr></tbody></table><h1>List of third party tools and their profiles</h1><table class="confluenceTable"><tbody><tr><th class="confluenceTh">Tool</th><th class="confluenceTh">Source</th><th colspan="1" class="confluenceTh">Usage</th><th colspan="1" class="confluenceTh">Rules Profile / Needed scripts</th></tr><tr><td colspan="1" class="confluenceTd">cpplint</td><td colspan="1" class="confluenceTd"><p><a href="http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml">Home Page</a></p><p><a href="http://google-styleguide.googlecode.com/svn/trunk/cpplint/cpplint.py">Download Tool</a></p></td><td colspan="1" class="confluenceTd"><p>Create the rules profile and the modified cpplint python script as follow:</p><ul><li style="list-style-type: none;"><ul><li>python cpplint_createrules.py cpplint.py</li></ul></li></ul><p>This will generate the following files:</p><ul><li style="list-style-type: none;"><ul><li>cpplint.xml that should installed in extensions/rules/cxxexternal</li><li>cpplint_mod.py that should be used to check the code</li></ul></li></ul><p>After this you can run the <span>cpplint_mod.py against any source file like this:</span></p><ul><li style="list-style-type: none;"><ul><li>python cpplint_mod.py source.cpp 2> report.txt</li></ul></li></ul><p>The output file report.txt needs to be converted to xml format described above. For convenience a perl script is available here and can be run as follow:</p><ul><li style="list-style-type: none;"><ul><li>perl cpplintReport2checkstyleReport.perl report.txt cpplint-result-0.xml</li></ul></li></ul></td><td colspan="1" class="confluenceTd"><p><a href="https://github.com/SonarCommunity/sonar-cxx/blob/master/sonar-cxx-plugin/src/tools/cpplint_createrules.py">Create Rules Script</a></p><p><a href="https://github.com/SonarCommunity/sonar-cxx/blob/master/sonar-cxx-plugin/src/tools/cpplintReport2checkstyleReport.perl">CppLint Report Converter Script</a></p></td></tr></tbody></table><table class="wysiwyg-macro" data-macro-name="info" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2luZm99&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="RICH_TEXT"><tr><td class="wysiwyg-macro-body"><p>This is maintained by the community, so if you want to share additional rules profiles or tool do so by using the <a href="http://sonar.15.n6.nabble.com/">sonar user mailing list</a></p></td></tr></table><table class="wysiwyg-macro" data-macro-name="info" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2luZm99&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="RICH_TEXT"><tr><td class="wysiwyg-macro-body"><p>The list above is provided without any warranty, therefore you may need to debug the scripts or tools in order to make them work</p></td></tr></table>
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