Command line code review reference

This topic describes the parameters you must specify to run a code review analysis from a command line interface..

Purpose

The parameters for a command line code review application specify the scope of the analysis, the location of the source code, the rules to apply, and the location of the analysis results. The application can also write analysis results to stdout.

The instruction to run the code review command line application has the following syntax

Using the Eclipse executable file:

<path to Eclipse executable>eclipse -data <path to Java source files> -application com.ibm.xtools.analysis.commandline.AnalyzeApplication -rulefile <path to rules file> -directory or -projects <path to Java source code> or <comma-separated list of project names>-exportdirectory <path to results directory> <optional parameters>

Using the Java™ launcher:

<path to Java executable>java -cp path to Eclipse startup.jar org.eclipse.core.launcher.Main-data <path to Java source files> -application com.ibm.xtools.analysis.commandline.AnalyzeApplication -rulefile <path to rules file> -directory or -projects <path to Java source code> or <comma-separated list of project names>-exportdirectory <path to results directory> <optional parameters>
Note: Enclose with quotation marks any paths that contain spaces. For example: "C:\Program Files\IBM\SDP70\startup.jar".

Parameters

-data fully qualified path to Java source files
Mandatory. This can be the path to an existing Eclipse workspace, or the location of a temporary workspace.
-application com.ibm.xtools.analysis.commandline.AnalyzeApplication
Mandatory. The identifier of the Eclipse command line analysis application.
-rulefile fully qualified path to a rules file
Mandatory. The rules file contains the code review rules to apply during the analysis.
-projects comma separated list of project names
Mandatory (if the source code is part of an existing Eclipse workspace project). If you do not specify a workspace project, the code review runs on all the projects in the workspace.
-exportdirectory fully qualified path to results directory
Mandatory. This is the path to a directory that will contain the analysis results.
-verbose
Optional. This option takes no value, but writes all results to stdout.
-directory fully qualified path to the directory of a Java project
Mandatory (if the source code is not in an existing Eclipse workspace). This is the path to source directory of a Java project that is not in an exiting Eclipse workspace. The -data option creates a temporary project, called com.ibm.xtools.analysis.commandline.temp, and creates a source directory that links to the directory you specify with the -directory option.
-includeFile fully qualified path to a text file
Optional. This is a fully qualified path to a text file that lists source code files to include in the analysis. This option provides fine control over the source code files in the location you specify with the -directory option. The text file must contain a line-separated list of source code files to include in the analysis. The paths you list in the text file must be relative to the source folder and must not be fully qualified paths.
-excludeFile fully qualified path to a text file
Optional. This is a fully qualified path to a text file that lists source code files to exclude from the analysis. This option provides fine control over the source code files in the location you specify with the -directory option. The text file must contain a line-separated list of source code files to exclude from the analysis. The paths you list in the text file must be relative to the source folder and must not be fully qualified paths.

Sample

The following sample instruction runs a code review analysis using the Java launcher:
c:\ibmj9_50\jre\bin\java.exe -cp C:\progra~1\IBM\SDP70\startup.jar org.eclipse.core.launcher.Main
-data "C:\Documents and Settings\default user\IBM\rationalsdp7.0\workspace-rsa-en"
-application com.ibm.xtools.analysis.commandline.AnalyzeApplication
-rulefile c:\temp\commlinecoderev.dat -projects hello.world1 -exportdirectory c:\temp
-verbose