In this section:

Prerequisites

Jtest supports static analysis with Checkstyle 5.5, 5.6, 5.7, 6.5, and 7.6.

To enable Checkstyle rules and to use plugins dropped into this folder:

  1. Go to INSTALL_DIR/etc and open the framework.properties configuration file.
  2. Find the felix.auto.start.4 set and add the following .jar file as the first entry: org.apache.felix.fileinstall-3.4.0.jar.

Downloading and Installing Checkstyle

  1. Download Checkstyle from the following website: http://sourceforge.net/projects/checkstyle/files.
  2. Unpack Checkstyle to install.
  3. Copy the configs, plugins, and rules folders from the [INSTALL_DIR]/integration/checkstyle directory into the Checkstyle installation directory.
  4. Modify the jtestcli.properties file to include the following properties:

    jtest.analyzer.checkstyle.enabled=true
    jtest.analyzer.checkstyle.dir=CHECKSTYLE/INSTALLATION/DIRECTORY
    rules.provider_cs.analyzer=com.puppycrawl.tools.checkstyle
    rules.provider_cs.data=${jtest.home}/rules/csrules.xml

Analyzing Code with Checkstyle

Specify the Checkstyle user test configurations to perform analysis with Checkstyle:

  • user://Checkstyle - Enables every rule
  • user://Checkstyle Recommended - Enables Checkstyle recommended rules

Optional Customizations

You can customize your Checkstyle integration by configuring the following properties. 

# Custom limit for number of files to be tested in a single executed Checkstyle process. Default is 50.
# However, if subsequent files are placed in the same directory, they will be still scheduled to that
# process unless the "hard" limit is reached (twice the "regular" limit).
jtest.analyzer.checkstyle.files.limit=50

# Custom timeout (seconds) for the Checkstyle process to start. Default is 5 seconds.
jtest.analyzer.checkstyle.launch.timeout=5

# Custom timeout (seconds) for the Checkstyle process to complete. Default is 60 seconds.
jtest.analyzer.checkstyle.timeout=60

# Custom launch file for Checkstyle process. Default is taken from the Checkstyle analyzer jar file. 
# If one cannot be found, attempts to use file 'checkstyle.ini' from current working directory.
jtest.analyzer.checkstyle.launch.file=CUSTOM/LAUNCH/FILE

The rulemap.txt file located in the [INSTALL_DIR]/integration/checkstyle directory contains information about how rule IDs used in test configuration are mapped to Checkstyle rule types.

  • No labels