Running Inspections Offline
In addition to running code inspections from the main menu or from the context menus of the Project Tool Window, you can also launch the inspector from the command line, without actually running CLion.
This way you can perform regular code inspections as a part of your development process, which is especially important for large projects. Inspection results are stored in the XML format, and you can download and view these results at any time.
To launch a code inspection from the command line
- In the command line, run the
inspect
command the using the following syntax:inspect project-path inspection-path output-path [-vX] [-d subdirectory-path]
The command options are as follows:
Option | Description |
---|---|
inspect | The full path to the inspect.bat ( inspect.sh on macOS and Linux) script located in the <IDE_HOME>/bin directory. |
project-path | The full path to the directory that contains the project to be inspected. |
inspection-path | The full path to the inspection profile, against which the project is to be inspected. By default, inspection profiles are stored under the following directory:
|
output-path | The full path to an existing directory where the inspection report will be stored. |
-vX | (optional) The verbosity level of the output, where X is 0 for quiet, 1 – for noisy, and 2 – for extra noisy. |
-d subdirectory-path | (optional) The full path to the subdirectory to be inspected. |
Examples
- Syntax
-
<IDE_HOME>\bin\inspect.bat project-path inspection-path output-path -v2 -d subdirectory-path
- Example
-
<IDE_HOME>\bin\inspect.bat E:\MyProject E:\MyProject\.idea\inspectionProfiles\Project_Default.xml E:\MyProject\inspection-results-dir -v2 -d E:\MyProject\subdirectory
- Syntax
-
CLion.app/Contents/bin/inspect.sh project-path inspection-path output-path -v2 -d subdirectory-path
- Example
-
CLion.app/Contents/bin/inspect.sh ~/MyProject ~/MyProject/.idea/inspectionProfiles/Project_Default.xml ~/MyProject/inspection-results-dir -v2 -d ~/MyProject/subdirectory
- Syntax
-
<IDE_HOME>/bin/inspect.sh project-path inspection-path output-path -v2 -d subdirectory-path
- Example
-
<IDE_HOME>/bin/inspect.sh ~/MyProject ~/MyProject/.idea/inspectionProfiles/Project_Default.xml ~/MyProject/inspection-results-dir -v2 -d ~/MyProject/subdirectory
Viewing the results of an offline inspection
Having performed an offline inspection and exported the inspection results to a directory in the XML format, you can always download and view these results.
- Open the project the inspection was performed against.
- On the main menu, choose .
- In the Select Path dialog box that opens, navigate to the directory that contains inspection results in XML format.
- Click OK. Inspection results display in the Offline View tab in the Inspection Results Tool Window.