This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
.. -*- restructuredtext -*-

Sonar Quality Analysis Rules Extractor

What is the Sonar Rules Extractor?

The extractor is a tool that extracts the violation rules from analysis tools like Cppcheck,
C++Test, Klocwork, etc. and converts them into Sonar rules.

Why converting those rules into Sonar rules?

When we are doing a conformity analysis of coding rules, the output of this analysis gives us
a link between the line of the source file where the rule has been violated and the ``ID`` of
this violated rule. An association between a rule ``ID`` and its description has to be given to

To take into account all the custom rules developed in the quality analysis tools, it is
necessary to have a utility which exports those tools' rules. **The Sonar Rules Extractor is there
for that.**

.. note:: Sonar has by default five kinds of rule severity: ``Blocker``, ``Critical``, ``Major``,
``Minor``, ``Info``. But it is not the case for all the analysis tools. For example, in Klocwork,
the severities are represented by numbers : 1 (Critical) to 10 (Info).

The *Sonar Rules Extractor* will have a mapping of those levels so they mean something to Sonar.

How to install it?

If you have Python **setuptools** already installed and have a direct internet connection, you just need
to run the following command: ::

root@localhost:~# easy_install -O2 sonar-rules-extractor

If Python **setuptools** is not installed, please install it first.

If you don't have a direct connection to the internet, download a package suitable to your distribution
and install it. ::

root@localhost:~# tar zxvf sonar-rules-extractor*.tar.gz
root@localhost:~# cd sonar-rules-extractor*
root@localhost:~# python install -O2

For windows users who don't want to run the command line installer, there is a native ``.exe`` package.

How to extract rules from code analysis tools?

The **Sonar Rules Extractor** comes with a command line tool ``sonar-rules-extractor``. You can run it
with the ``--help`` option to get info. ::

root@localhost:~# sonar-rules-extractor --help
Usage: sonar-rules-extractor [options] tool <input args...="">

<input args...=""> depend on the tool. Generally, if no args are provided,
standard input is read.

--version show program's version number and exit
-h, --help show this help message and exit
-p MODULE, --plugin=MODULE
Before extraction, import the specified module and
look for classes that inherit "Extractor" which can be
used in addtion to the built-in ones. This option can
be used multiple times.
-f, --format-xml Pretty format XML output.
-l, --list-tools List all available tools.

You can get the list of available supported tools with this command: ::

root@localhost:~# sonar-rules-extractor --list-tools
pylint, klocwork, cpptest, gnatcheck, qac, qacpp, cppcheck, logiscope

Here is an example extraction for PyLint: ::

root@localhost:~# pylint --list-msgs | sonar-rules-extractor pylint --format-xml > pylint-sonar-rules.xml
root@localhost:~# cat pylint-sonar-rules.xml

<rule key="C0102" priority="INFO">
<category name="Reliability"/>
<rule key="C0103" priority="INFO">
<category name="Reliability"/>
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
sonar-rules-extractor-1.1.tar.gz (13.3 kB) Copy SHA256 Checksum SHA256 Source May 4, 2012
sonar-rules-extractor-1.1.win32.exe (221.7 kB) Copy SHA256 Checksum SHA256 any Windows Installer May 4, 2012

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting