The Command Line Interface
The ARCAD CodeChecker Command Line Interface executes campaigns of code quality tests from the command line. Use the CLI to execute predefined campaigns from a command line.
The ARCAD CodeChecker CLI is distributed as a zip file. Extract the content into the folder of your choice. Go to the /bin folder to launch the CLI.
The CLI needs to have access to a Java 8 Runtime Environment that needs to be installed and accessible from anywhere in a command line terminal (run <code>java -version </code> to find the current accessible Java version).
The CodeChecker CLI is also available as an RPM package for IBM i platforms, that can be installed using rpm or yum.
Before you start, open a terminal session and run the yum version command to make sure everything is correctly installed in your environment.
It is recommended to adjust the path to use the absolute path of programs, so you do not need to specify it manually. In this particular case, it allows you to use codechecker
instead of /QOpenSys/pkgs/bin/codechecker
to run a CodeChecker CLI command.
For more information about RPM packages, refer to the installation and path management documentations.
Follow the subsequent steps to install the CodeChecker CLI on IBM i:
Step 1 Copy the codecheckerCLI-X.Y.Z.ibmi7.2.ppc64.rpm file and paste it in any folder on the IFS of the IBM i target.
Step 2 Open a terminal session and locate yourself in the folder where the rpm file is stored.
Step 3 Run the yum install codecheckerCLI-X.Y.Z.ibmi7.2.ppc64.rpm command to install the package.
Step 4 Enter y and press enter to confirm.
Result The new CodeChecker CLI is successfully installed.
To remove the CodeChecker CLI, open a terminal session on the target IBM i and run the yum remove codecheckerCLI command. Enter y and press enter to confirm.
To call any action using the CLI, the following syntax is used: codechecker <subcommand> <parameters>
.
If no subcommand is entered, the CLI then displays a list of the subcommands available.
Each subcommand requires one or more parameters. To display the list of supported parameters for any subcommand, run the subcommand without any parameters. If nothing is provided, the system prompts you to fill in the blanks required to accomplish the subcommands tasks.
Parameters between [brackets] are optional. Each parameter has a long and a short form (example: --server, -S) and are separated from their value by the equal sign = or a space.
There are two subcommands available in the CodeChecker CLI:
The following parameters are common to all CLI commands.
- -C, --crypted
- Is used if the password is Base 64 encrypted.
- -H, --help
-
Displays the help message for the command.
- -L, --log-file
- Indicates the path to the file where the logs are written.
- -P, --password
- Indicates the password used to connect to the server.
- -S, --server
- Indicates the URL to the server to which to connect.
- -U, --user
- Indicates the user used to connect to the server.
- -V, --verbose
- Enables the DEBUG and TRACE log levels.
This subcommand executes a campaign.
Usage: codechecker executeCampaign [-CHrV] -P[=<password>] [-P[=<password>]]...-c=<codeReviewCode> [-f=<failOnStatus>][-L=<logFile>] [-m=<maxLogLevel>][-o=<campaignSummaryOutput>] -S=<serverURL>-t=<targetCode> [-u=<issuesListOutput>]-U=<user>
The available parameters for the executeCampaign subcommand are the following:
- -c, --codereview
- Indicates a Code Review code.
- -f, --fail-status
- Indicates the Campaign status for which the execution fails. Possible values are NOTICE, WARNING, FATAL or ERROR.
- -m, --max-level
- Indicates the maximum level of log to display. Possible values are DEBUG, INFO, WARNING or ERROR.
- -n, --fail-on-error
- The execution of a campaign via the CLI is set to fail if the campaign encounters error(s) during the process.
- -o, --summary-output
- Indicates the file where the JSON campaign summary must be written.
- -p, --sonar-project
- Indicates the folder to create a SonarQube project (issues report + source). The content of that directory can then be used to invoke the Sonar Scanner CLI to upload the campaign results in SonarQube.
- -r, --reset-target
- Resets a specified target and clears existing issues before executing the campaign.
- -s, --ibmi-server
- Indicates an IBM i server code, as defined in ARCAD CodeChecker.
- -t, --target
- Indicates the target code.
- -u, --issues-output
- Indicates where the JSON issues list are written. The value expected is a file path.
This subcommand executes an ARCAD campaign.
Usage: codechecker executeArcadCampaign [-CHqV] -P[=<password>] [-P [=<password>]]... -a=<applicationCode> -c=<codeReviewCode> -e=<environmentId> [-f=<failOnStatus>] -i=<arcadInstance> -l=<arcadLanguage> [-L=<logFile>] [-m=<maxLogLevel>] [-o=<campaignSummaryOutput>] -s=<serverCode> -S=<serverURL> -U=<user> -v=<versionNumber>
The available parameters for the executeArcadCampaign subcommand are the following:
- -a, --application
- Indicates an ARCAD application code.
- -c, --codereview
- Indicates a Code Review code.
- -e, --environment
- Indicates an ARCAD application environment code.
- -d, --arcad-list
- Indicates the path of an ARCAD list that gathers the campaign outputs. You can either set the path by its name or by using a LIBRARY/NAME format.
- Once launched, the ARCAD list emptied if it exists and then filled with one entry per source member retrieved during the campaign execution.
-
Important!
This parameter is supported only when you run the CLI on IBM i. - -f, --fail-status
- Indicates the Campaign status for which the execution fails. Possible values are NOTICE, WARNING, FATAL or ERROR.
- -i, --instance
- Indicates an ARCAD instance code.
- -l, --language
- Indicates an ARCAD language code (it can be ENG or FRA).
- -m, --max-level
- Indicates the maximum level of log to display. Possible values are DEBUG, INFO, WARNING or ERROR.
- -n, --fail-on-error
- The execution of a campaign via the CLI is set to fail if the campaign encounters error(s) during the process.
- -o, --summary-output
- Indicates the file where the JSON campaign summary must be written.
- -p, --sonar-project
- Indicates the folder to create a SonarQube project (issues report + source). The content of that directory can then be used to invoke the Sonar Scanner CLI to upload the campaign results in SonarQube.
- -q, --sonar
- Is used to upload the campaign result to SonarQube (if the SonarQube connection is configured).
- -r, --reset-target
- Resets a specified target and clears existing issues before executing the campaign.
- -s, --ibmi-server
- Indicates an IBM i server code, as defined in ARCAD CodeChecker.
- -u, --issues-output
- Indicates where the JSON issues list are written. The value expected is a file path.
- -v, --version
- Indicates an ARCAD application version number.
This subcommand allows sources to be uploaded on the CodeChecker Server from an external location and the creation of an External Target type.
Usage: codechecker executeLocalCampaign [-CHnqrV] -P[=<password>]-c=<codeReviewCode>[-d=<targetDescription>][-f=<failOnStatus>] [-L=<logFile>][-m=<maxLogLevel>][-o=<campaignSummaryOutput>][-p=<sonarProjectOutput>][-s=<ibmiServer>] -S=<serverURL>-t=<targetCode> [-u=<issuesListOutput>]-U=<user> [-x=<deltaPath>][-z=<splitSize>] <mainPath><mainPath>
Root source folder
The available parameters for the executeLocalCampaign subcommand are the following:
- -c, --codereview
- Indicates a Code Review code.
- -d, --description
- Indicates the target's description.
- -f, --fail-status
- Indicates the Campaign status for which the execution fails. Possible values are NOTICE, WARNING, FATAL or ERROR.
- -m, --max-level
- Indicates the maximum level of log to display. Possible values are DEBUG, INFO, WARNING or ERROR.
- -n, --fail-on-error
-
Indicates whether the CLI execution fails if the campaign contains errors.
- -o, --summary-output
- Indicates the file where the JSON campaign summary must be written.
- -p, --sonar-project
- Indicates the folder to create a SonarQube project (issues report + source). The content of that directory can then be used to invoke the Sonar Scanner CLI to upload the campaign results in SonarQube.
- -q, --sonar
- Is used to upload the campaign result to SonarQube (if the SonarQube connection is configured).
- -r, --reset-target
- Resets a specified target and clears existing issues before executing the campaign.
- -s, --ibmi-server
- Indicates an IBM i server code, as defined in ARCAD CodeChecker.
- -t, --target
- Indicates a target code. If the target does not exist, it is created with this value set in this code parameter.
- -u, --issues-output
- Indicates where the JSON issues list are written. The value expected is a file path.
- -x, --delta-folder
- Indicates the root source delta folder.
- -z, --split-size
- Indicates, in kilobytes, the size used to split the source package sent to the server. By default, the split size is set to 5120 Kb.