JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.
If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.
If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.
| CodeSonar® 9.0p0 Hot Tips | CONFIDENTIAL | CodeSecure Inc |
This section provides guidelines for writing your own warning processors.
The essential requirements for a warning processor are as follows.
Within these constraints there is a great deal of flexibility. For example, a warning processor may be written in any language.
The procedure for creating a custom warning processor will generally look something like the following.
CodeSonar will execute the warning processor executable or wrapper in an environment with two available environment variables.
| CSONAR | The path to the hub's CodeSonar installation. |
|---|---|
| CSHUB_PROCESSORS_HOME | The path to the hub's warning processor installation
directory (hubdir/processors/, where
hubdir is the hub directory). This path information is also available directly to the warning processor display script as variable CSHUB_PROCESSORS_HOME (same name as this environment variable). |
We provide a package, csonar_utils, containing useful functionality for authoring Python warning processors. See Authoring Python Warning Processors: The csonar_utils Package for details.
It is useful to consider how your processor will be applied as part of your design process, because it will affect the set of commands you will need to implement and the input and output you will need to work with.
Some warning processors are equally suited to interactive application and automatic application. In most cases, though, a warning processor will be suited to only one or the other.
A display script allows you to:
You do not have to define a display script if you do not want to do either of these.
A warning processor display script...
# CSONAR_WP_CAPABILITY:PROPERTY_IDS
| display |
An object with three methods that control the warning
processor's presentation in the Warning Report.
|
|---|---|
| notes | A list of strings, representing the warning Notes (one string per comment, in chronological order). Note that this is a read-only representation: the display script does not update the Notes. |
| is_change_multiple | A Boolean that is True if and only if the display script is invoked via Change Multiple Warnings. |
| CSHUB_PROCESSORS_HOME | The path to the hub's warning processor installation
directory (hubdir/processors/, where
hubdir is the
hub
directory). This path information is also available directly to the warning processor executable or wrapper as environment variable CSHUB_PROCESSORS_HOME (same name as this variable). |
The bugzilla warning processor shipped with CodeSonar includes a display script: see $CSONAR/py/processors/bugzilla/display.py.
The following sections contain further information about warning processors.
| How Warning Processors Work | Describes the components and behavior of a warning processor. |
|---|---|
| Warning Processors Shipped With CodeSonar | Describes the example warning processors and explains how to customize and install them. |
| Warning Processor Input and Output | Describes the formats and semantics of warning processor inputs and outputs. |
| Authoring Python Warning Processors | Explains how to use the csonar_utils Python package to create custom warning processors. |
| csonar_utils API documentation | Describes the key components of the csonar_utils Python package. |