General

Authoring A Warning Processor

This section provides guidelines for writing your own warning processors.



Basics

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.

  1. Decide on the appropriate mode for the processor.
  2. Implement handling for the required commands.
  3. Decide whether or not you want a custom display script.
    If so, create one and make sure that your processor's install command emits it to stdout.
  4. If necessary, create a wrapper for executing the processor.
  5. Install the warning processor.

Execution Environment

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).

Python Warning Processor Utilities

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.

Considering Processor Application

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.

Display Scripts

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.

Display Script Authoring Guidelines

A warning processor display script...

Example Display Script

The bugzilla warning processor shipped with CodeSonar includes a display script: see $CSONAR/py/processors/bugzilla/display.py.

Other Warning Processor Sections

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.