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.2p0 | CONFIDENTIAL | CodeSecure Inc |
The csonar_utils Python package shipped with CodeSonar provides useful functionality for authoring Python warning processors.
This package is used by the example warning processors.
The csonar_utils package is located at $CSONAR/py/processors/csonar_utils/.
We strongly recommend using the Python installation that ships
with CodeSonar.
Your wrapper script can refer to this Python executable using the
CSONAR environment variable that is
available to the warning processor subprocess: "%CSONAR%\codesonar\bin\cspython.exe"
on Windows; "$CSONAR/codesonar/bin/cspython"
on other systems.
The most important piece of the csonar_utils package is the WarningProcessor class. We provide a brief overview here, for full details see the csonar_utils documentation.
| Commands | By default, warning processors implemented by subclassing WarningProcessor will accept the required commands, but do not specify any actions associated with those commands. To associate functionality with a command, define the corresponding on_commandname function: |
|---|---|
| XML Parser | The WarningProcessor class includes a parser for the XML input to the processor. To use this parser, define one or more of the following handlers: |
| Other Useful Methods |
WarningProcessor also provides
|
To write a Python warning processor using csonar_utils:
import sys, os
def import_module(module_name):
# ...
import_module('csonar_utils')
from csonar_utils import WarningProcessor
class MyProcessorName(WarningProcessor):
# class definitions
if __name__ == '__main__':
m = MyProcessorName()
m.start()
On Windows: create a batch file in hubdir/processors.
On other systems: create a wrapper script in hubdir/processors.
The following sections contain further information about warning processors.
| Warning Processors | Provides basic information about warning processors. |
|---|---|
| Warning Processors Shipped With CodeSonar | Describes the example warning processors and explains how to customize and install them. |
| Authoring Warning Processors | Outlines the requirements for a CodeSonar warning processor; describes how warning processors interact with the hub and with users; explains the input and output formats. |
To report problems with this documentation, please visit https://support.codesecure.com/.