In this section
Checkstyle is a third-party open source tool that performs static analysis on Java code and reports potential problems. Checkstyle Analyzer is a Parasoft integration that allows Checkstyle to send violations to Parasoft (DTP) so that these results can be processed and viewed along with other data points. The integration also adds scope, authorship, and source control support that further enhance Checkstyle capabilities. Additionally, it allows the generation of a Parasoft Report that shows violations for each author and each severity.
This integration gives a development organization the ability to aggregate the results of all testing efforts across a variety of technologies, or even compare and contrast results from different analysis tools in one centralized location—increasing productivity and efficiency.
parasofttestcli.bat -Dsettings="C:\sample\checkstyle.settings.properties" -Dconfig="file:///C:\sample\checkstyle.properties" -Ddata.dir="C:\sample\sampleProjectFolder" |
The following settings are required.
-Dconfig
Path to the test configuration that the analyzer should use for its run. Make sure to prepend the file path with file:///
-Dsettings
Path to the settings configuration file (see Configuration).
-Ddata.dir
Path to the file or folder you want to test.
See the Parasoft Analyzer package documentation for a complete list of configurations.
The following settings are required to run the Checkstyle extension.
Enables the analyzer. Values are true
or false
.
Example:
jtest.analyzer.checkstyle.enabled=true
The installation directory of Checkstyle.
Example:
jtest.analyzer.checkstyle.dir= C:\\ThirdParty\\checkstyle-5.7
The following settings are not required to run the Checkstyle extension.
Custom limit for number of files to be tested in a single executed Checkstyle process.
Example:
jtest.analyzer.checkstyle.files.limit=1000
Custom timeout (seconds) for the Checkstyle process to start. Default is 5
.
Example:
jtest.analyzer.checkstyle.launch.timeout=20
Custom timeout (seconds) for the Checkstyle process to complete. Default is 360
.
Example.
jtest.analyzer.checkstyle.timeout=10
Custom launch file for Checkstyle process. Default is taken from the Checkstyle analyzer jar file. If one cannot be found, the extension attempts to use the checkstyle.ini file from the current working directory.
Example:
jtest.analyzer.checkstyle.launch.file=path\\to\\launch\\file
Parasoft DTP displays code analysis violations according to severity level, rule category, and other characteristics according to a rule map XML file. You can edit the rule map to change the default rule settings, as well determine how new rules that are not yet defined in the rule map are categorized and tagged in DTP.
The Checkstyle extension ships with an example rule map file in the <ANALYZER_HOME >/rules/builtin directory. Rules are specified using the following format:
<builtin> <category name=”Analyzer_name”> <category name=”Category_name”> <rule id=”rule_id” severity=”sev”/> |
You can modify this file to change mappings and add new rules:
name
property is required for category tags.id
and severity
properties are required for the rule element. Each id
value must be unique within a given rule map file.id
in the same rule map file, even if the rules are under different categories or analyzers, are not allowed.<builtin>
element.You can add rule documentation to the DTP web application so that it can display the documentation for each individual rule. Once the rule documentation is installed, you will be able to view it as you browse Checkstyle violations in DTP.
analyzerID=com.puppycrawl.tools.checkstyle
analyzerVersion=1.0
The following updates have been made to the Checkstyle extension.