The Code Issue sensor data type is designed for representation of data concerning problems found by static analysis tools such as Checkstyle or FindBugs.
Table 25.5, “CodeIssue SDT attributes” documents the CodeIssue SDT attributes.
Table 25.5. CodeIssue SDT attributes
| Attribute | Description |
|---|---|
| tstamp | The UTC time at which this data was collected. |
| tool | A string indicating the tool that collected this data, such as "Checkstyle". |
| runTime | An identification tag that can be used in analysis to combine measurements that were taken after one complete execution of the static analysis tool. Typically, this value is the UTC time (converted to milliseconds) the code issue was found. This time may differ from tstamp. |
| file | The absolute path to the source file from which code issue was collected. The file name extension is used to determine the source language type. |
| type | The type of code issue. This can be used to identify the rule that discovered this code issue. |
In addition to the above required fields for all CodeIssue data, there are a number of "optional but common" attributes that can appear on the property map. These are documented in Table 25.6, “CodeIssue SDT "optional but common" properties” so that static analysis tool sensor writers can produce CodeIssue sensor data that can be processed by the built-in analyses and reduction functions.
Table 25.6. CodeIssue SDT "optional but common" properties
| Property | Description |
|---|---|
| line | The line number of the code that the tool generated a code issue for. |
| severity | Severity level or severity type of the issue generated. |
| message | Message from the tool describing the reason the issue was created. |
The Checkstyle tool automates the process of checking Java code to ensure it adheres to a coding standards and generates a list of code standard violations. A sensor for Checkstyle represents this data as CodeIssue entries.
The PMD tool automates the process of checking Java code for potential problems. For example, possible bugs, dead code, suboptimal code, overcomplicated expressions, and duplicated code. A sensor for PMD represents this data as CodeIssue entries.
The FindBugs tool automates the process of checking Java code for potential problems based on the concept of bug patterns. A sensor for FindBugs represents this data as CodeIssue entries.
Once collected, CodeIssue data can be used to track trends in problematic code associated with a system as it is developed.