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
inspectcommand using the following syntax:
inspect project-path inspection-path output-path [-vX] [-d subdirectory-path]
The command options are as follows:
The full path to the inspect.bat ( inspect.sh on macOS and Linux) script located in the <IDE_HOME>/bin directory.
The full path to the directory that contains the project to be inspected.
| 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: |
The full path to an existing directory where the XML file with the inspection report will be stored.
(optional) The verbosity level of the output, where
(optional) The full path to the subdirectory to be inspected.
<IDE_HOME>\bin\inspect.bat project-path inspection-path output-path -v2 -d subdirectory-path
<IDE_HOME>\bin\inspect.bat E:\MyProject E:\MyProject\.idea\inspectionProfiles\Project_Default.xml E:\MyProject\inspection-results-dir -v2 -d E:\MyProject\subdirectory
CLion.app/Contents/bin/inspect.sh project-path inspection-path output-path -v2 -d subdirectory-path
CLion.app/Contents/bin/inspect.sh ~/MyProject ~/MyProject/.idea/inspectionProfiles/Project_Default.xml ~/MyProject/inspection-results-dir -v2 -d ~/MyProject/subdirectory
<IDE_HOME>/bin/inspect.sh project-path inspection-path output-path -v2 -d subdirectory-path
<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 agains which you ran the inspection.
On the main menu, choose.
In the Select Path dialog box that opens, click the directory where the XML file with the inspection results is stored.
Click OK. The Inspection results are displayed in the Offline View tab in the Inspection Results Tool Window.