...
Sonar provides a quick and easy way to add new coding rules directly via the web interface for certain languages (C, C#, /C++, C#, Cobol, Flex, JavaScript, PL/I, PL/SQL, Python and VB.NET).
...
- Register definitions of coding rules, when the server is started.
- Optionally define some templates of quality profiles, when the server is started.
- Analyze source code and inject results in database
1. Registering
...
Coding Rules
This step relates to the extension point org.sonar.api.rules.RuleRepository. A RuleRepository defines a set of coding rules. It usually loads data from a XML file:
...
| Code Block | ||
|---|---|---|
| ||
<rules>
<!-- the format used before sonar 2.3 is still supported : attributes key and priority on the node <rule> -->
<rule>
<!-- unique key within this repository -->
<key>com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck</key>
<name>Header</name>
<!-- default priority when the rule is activated (optional, default value is MAJOR). Values are INFO, MINOR,
MAJOR, CRITICAL, BLOCKER -->
<priority>MAJOR</priority>
<!-- this key is used later by the sensor to configure the code analyzer -->
<configKey>Checker/Header</configKey>
<!-- available ISO categories : Reliability, Portability, Maintainability, Efficiency, Usability -->
<category name="Usability"/>
<!--
This node is optional: default value is SINGLE.
MULTIPLE: the rule can be activated many times with different parameters and priority.
SINGLE: the rule can be activated once
-->
<cardinality>SINGLE</cardinality>
<description><![CDATA[Checks that ...]]></description>
<param>
<key>header</key>
<description><![CDATA[the required header specified inline. Individual header lines must be separated by the string "\n" (even on platforms with a different line separator)]]></description>
</param>
<param>
<key>ignore</key>
<description>...</description>
<defaultValue>false</defaultValue>
</param>
</rule>
</rules>
|
2. Defining
...
Quality Profiles
This step relates to the extension point org.sonar.api.profiles.ProfileDefinition. Profiles Quality profiles provided by plugins are registered at server startup and can't be edited by users:
startup.
3. Analyzing
...
Source Code
This step relates to the extension point org.sonar.api.batch.Sensor.

