Integrating bug tracking with Klocwork Static Code Analysis

Integrating your bug tracking system with Static Code Analysis allows you to send bug tickets for Klocwork issues to your tracking system, and display the tracker's bug ID, a link to the bug ticket, and other information from the tracker in Static Code Analysis.

To enable integration, you create a Python script called 'review_action.py' and place it in the projects_root/config directory. Static Code Analysis will then display a button on the issue details page for all projects in that projects_root. When a user clicks the button, Static Code Analysis collects the information related to that issue (including its URL) and passes it to the script, which sends the problem report to the bug tracker.

If you call a 'set_bug_id' method in your Python script, the bug ID is stored with the Klocwork issue. The ID can then be displayed in the issue list and on the issue details page, and can be searched for in the issues list . Configuring the bug tracker schema as a kwadmin property turns the bug ID into a hyperlink to the bug tracker. After the bug ID is displayed in Static Code Analysis, it becomes a term that you can search on with a Klocwork full-text search.

Note that the scenario above is referring to the issue ID. You can use Static Code Analysis to display both grouped and ungrouped issues. By default, it will display groups in the issue-list and reports. When grouping is on, the issue list displays group IDs. When it is off, issue IDs are displayed. By default, desktop issues are shown with grouping off while server issues are shown with grouping on. For more information about the group ID, see Issue grouping.

You can also use the 'set_comment(comment)' method in your script to display citing comments from the bug tracker in Static Code Analysis, as well as any other comments added for the issue.

To set up the integration, you need to create a Python script that identifies your bug tracking system and specifies how you want the integration to work for your project. Optionally, you can specify the Static Code Analysis interface details, like the button you'll use to send a ticket and the information Static Code Analysis will display from the bug tracker.