Products Downloads


French version


 

The Adelia quality manager can be expanded by means of user-provided plugins. A quality manager expansion plugin comprises a description file describing the metrics and quality rules provided by the plugin, along with an optional expansion program called by the analysis program to calculate the metrics and generate rule violations.

 

Note: The expansion program is optional. A plugin comprised solely of a set of "regular expression verification" rules has no need of an expansion DLL.

 

The elements defining a plugin are as follows:

 

 

 

Plugin description file

The plugin description file is an XML file containing the list of metrics and rules implemented, along with a reference to the expansion program. This file must conform to an XSD schema.

A plugin is comprised of the following elements (required unless otherwise indicated):

- Name of the plugin provider e.g.: Hardis.
- Name of the plugin itself e.g.: Standard Adelia metric.
- Plugin internal ID e.g.: com.hardis.adelia
- Plugin description Optional.
- Expansion DLL Optional.
- List of metrics Optional, implies an expansion program.
- List of quality rules Optional, implies an expansion program if the rules are not of the "regular expression verification" type.

 

A metric description contains the following information:

- Name of the metric e.g.: Number of lines.
- Internal ID of the metric e.g.: nblines.
- Data type

e.g.: integer.

Possible values: boolean, integer, Decimal, percentage and string

- Application area Optional for SONAR classification.

 

A rule description contains the following information:

- Name of the rule e.g.: Truncated data.
- Internal ID of the rule e.g.: truncation.
- Description of the rule Optional.
- Rule type

Optional.

0 = standard rule (by default),

1 = regular expression verification rule.

- Severity of a rule violation

Optional.

Value ranging from 1 (information) to 5 (critical), default 3 (major).

- List of rule parameters Optional.
- Application area Optional for SONAR classification.

 

The description of a quality rule contains the following information:

    • Parameter internal ID.
    • Parameter description.
    • Parameter default value.

 

The following limits apply:

Length of an internal ID 128  
Maximum name length 128  
Maximum description length 512  
Maximum parameter value length 1024  
Maximum metric value length 96 SONAR constraint

 

In the context of SONAR integration, the following additional naming conventions (related to the manner in which the Adelia SONAR plugin generates unique IDs for rules and metrics in the SONAR repository) apply:

    • Internal IDs must conform to Java package naming syntax (xxx.yyy.zzz).
    • The length of a metric's internal ID + the length of the plugin's internal ID must not exceed 62 characters.
    • The length of a rule's internal ID + the length of the plugin's internal ID must not exceed 198 characters.

 

The XML file is of the following form ( Click here for a full definition of the schema):

<plugin id="com.hardis.example">
  <provider>Hardis</provider>
  <name>Plugin example</name>
  <dll version="1">PLUGIN.DLL</dll>
  <metrics>
    <metric id="nblines" type="integer">
      <name>Number of source lines</name>
      <description>Number of text lines in a source file</description>
    </metric>
  </metrics>
  <rules>
    <rule id="complexity" severity="2">
      <name>Too complex block</name>
      <description>Too many lines of code in the source block</description>
      <parameters>
        <parameter id="nbmax_lines">
          <name>Number of lines</name>
          <description>Maximum authorized number of lines...</description>
          <value>200</value>
        </parameter>
      </parameters>
    </rule>
  </rules>
</plugin>
 

The nodes

Plugin node

This node defines the plugin. It is the file's main node.

 

Attributes

Name

Mand.

Values

Description

id

Yes

String

Plugin internal ID.

version

No

Integer

Version number (0 by default).

 

Data

- n/a -

 

Child nodes

provider

Provider name.

name

Plugin name.

dll

Name of the expansion DLL (optional).

metrics

List of metrics (optional).

rules

List of rules (optional).

 

Provider node

Attributes

- n/a -

 

Data

Name of the plugin provider.

 

Child nodes

- n/a -

 

 

Name node

Attributes

- n/a -

 

Data

Item name (plugin, metric, rule).

 

Child nodes

- n/a -

 

 

↑ Top of page

 

DLL node

Attributes

Name

Mand.

Values

Description

version

No

Integer

DLL version number (0 by default).

 

Data

Expansion DLL name.

 

Child nodes

- n/a -

 

 

Metrics node

Attributes

- n/a -

 

Data

- n/a -

 

Child nodes

metric*

List of metrics.

 

 

Metric node

This node defines a metric.

 

Attributes

Name

Mand.

Values

Description

id

Yes

String

Metric internal ID.

type

Yes

Boolean

Integer

Decimal

Percentage

String

Metric data type.

domain

No

String

Name of the SONAR domain for metric classification (General by default).

 

Data

- n/a -

 

Child nodes

name

Name of the metric.

description

Description of the metric (optional).

 

 

Rules node

Attributes

- n/a -

 

Data

- n/a -

 

Child nodes

rule*

List of rules.

 

Rule node

This node defines a rule.

 

Attributes

Name

Mand.

Values

Description

id

Yes

String

Rule internal ID.

severity

No

1-5

Severity of a rule violation: from Information (1) to Critical (5). By default, 3 (Major).

domain

No

String

Name of the SONAR domain for rule classification (General by default).

type

No

0/1

Rule type: Normal (0) by default, or Regular expression verification (1).

programTypes

No

String

List of abbreviated program types (AD_I, AD_B, etc.) to which the rule applies, separated by semi-colons.

If not specified, the rule applies to all programs.

↑ Top of page

 

 

Parameters node

Attributes

- n/a -

 

Data

- n/a -

 

Child nodes

parameter*

List of parameters.

 

Parameter node

This node defines a parameter.

 

Attributes

Name

Mand.

Values

Description

id

Yes

String

Internal parameter ID (unique to the rule).

 

Data

- n/a -

 

Child nodes

name

Parameter name.

description

Parameter description (optional).

value

Parameter value.

 

 

Value node

Attributes

- n/a -

 

Data

Value of a parameter.

 

Child nodes

- n/a -

 

 

Regular expression verification

The quality manager provides a special rule type, for which an exception is raised when a line of source code verifies a regular expression. Verification of this type of rule does not require an expansion program.

A "regular expression verification" type rule is of the following form:

 

<rule id="sql_code_not_found" type="1" severity="2">
  <name>Boucle *SQLCODE dangerous</name>
  <description>Never test "not found" as loop exit.</description>
  <parameters>
    <parameter id="regexpr">
      <value><![CDATA[^\s*DO_WHILE\s+\*SQLCODE\s*\<\>\s*\*NOT_FOUND]]></value>
    </parameter>
    <parameter id="casesensitive">
      <value>1</value>
    </parameter>
    <parameter id="clientserver">
      <!-- client / server / both (default) -->
      <value>both</value>
    </parameter>
  </parameters>
</rule>
 

The rule parameters are as follows:

regexpr

Mandatory

String

Regular expression. A violation is raised if the expression is verified.

casesensitive

Optional

0 or 1

Case sensitivity (0 by default - case-insensitive).

clientserver

Optional

Client, server or both

Specifies whether the rule applies to the client part, server part or to both (by default).

 

↑ Top of page

  • Aucune étiquette