Skip to content

Installing and running CPILint

Morten Wittrock edited this page Sep 2, 2024 · 9 revisions

This page describes how to get CPILint set up on your computer.

System requirements

The only requirement for running CPILint is that you have a Java 11 runtime installed on your computer. Everything else is included in the download.

Download the latest release

Please download the latest version from GitHub.

Installing on Windows

Uncompress the downloaded ZIP archive to the location, where you want to install CPILint. Then add the bin directory to your PATH environment variable using the Control Panel.

Installing on Linux and macOS

Uncompress the downloaded ZIP archive to the location, where you want to install CPILint. Then add the bin directory to your PATH variable, by editing the appropriate file (probably .bash_profile or .profile). Finally, run the following command to make the Bash launch script executable by your user:

chmod u+x <install dir>/bin/cpilint

The CPILINT_JAVA_HOME environment variable

If you set the environment variable CPILINT_JAVA_HOME to point to a Java runtime, the launch scripts will use that runtime to execute CPILint. If the variable is not set, the scripts will use JAVA_HOME instead. If that variable is also not set, the launch scripts will assume that the java command is in the PATH.

Validating your installation

To check whether CPILint was installed correctly, open a new command line window and enter the following command:

cpilint -version

If everything has been set up correctly, you should see output similar to the following:

CPILint version 1.0.5, copyright (c) 2019-2024 Morten N. Wittrock

To display usage information, run the following command:

cpilint -help

Running CPILint on Windows, Linux and macOS

Once the bin directory is in your PATH, you can run CPILint from the command line as follows:

cpilint <options>

Running CPILint in other environments

If you are in an environment with no launch script, you can still run CPILint. To do so, execute the following command:

java -classpath "<install dir>/lib/*:<install dir>/logback" dk.mwittrock.cpilint.CliClient <options>

Exit codes

CPILint returns the following exit codes:

  • 0 if the inspection finished and found no issues
  • 1 if the inspection finished and at least one issue was found
  • 2 if there was an error and the inspection didn't finish

Uninstalling CPILint

To remove CPILint from your system, merely delete the installation directory, and remove the bin directory from your PATH.