Checkstyle

Use the Checkstyle bundled plugin to verify that Java code complies with a defined coding standard. The plugin uses the Checkstyle development tool to perform automated code checking. Checkstyle is highly configurable and can support most coding standards.

Create server configuration file

The Checkstyle libraries are embedded in the plugin, so there are no external tools to install.

To customize the Checkstyle rules to be checked by this plugin, create an XML configuration file on the PulseUno server in the following location:

<pulse_data>conf/experts/com.serena.starlight/checkstyle/

The default file name is config.xml.

The Checkstyle plugin searches for a configuration file in the following sequence:

  1. If the Configuration File Name field specifies a filename, the plugin looks for that file in this location:

    <pulse_data>/conf/experts/com.serena.starlight/checkstyle/.

  2. If the Configuration File Name field is empty, the plugin looks for config.xml in the same directory on the PulseUno server.
  3. If the Configuration File Name field is empty, and config.xml does not exist, the plugin uses a built-in configuration based on Sun Coding Conventions.
Note: The Checkstyle tool has properties that you can configure using system properties. The Checkstyle plugin passes system properties used to start the JVM hosting PulseUno through to the Checkstyle tool.

Back to top

Configure Checkstyle plugin

Because Checkstyle operates on source code files, add the Checkstyle plugin to a chain that populates a workspace.

To configure the Checkstyle step:

  1. Add the Checkstyle step to a chain, as described in Create chains.

  2. Enter the plugin configuration details:

    Field Description
    Title Enter a name for the plugin step or accept the default name.
    Configuration location

    Select one of the following options:

    • The built-in configuration that uses the default configuration file.

    • A local configuration file stored on the Agent (specified in the Configuration File Name field).
    • A configuration file stored in a stream (specified in the Configuration File Name field).
    Configuration name (Optional) Specify the path and filename of a configuration file that you created on the PulseUno server.
    Properties

    (Optional) Specify environment properties. Enter each key-value pair on a new line, for example:

    checkstyle.suppressions.file=${checkstyle.pulse.stream.directory}/config/checkstyle-suppression.xml

Back to top

See also: