Run an incremental Mend SAST CLI code scan
Overview
The Mend CLI offers the option to run incremental scans of your custom code which check only the changes in your code since the previous Mend CLI SAST scan. This reduces the run time of your scan, because a much smaller code base has to be analyzed.
Note: This article specifically covers the usage of the Mend CLI’s incremental code scan feature. For general information on scanning your custom code (SAST) with the Mend CLI, check out these articles:
Getting it done
Prerequisites before starting the incremental Mend CLI code scan
The following prerequisites are required before running an incremental Mend CLI code scan:
Provide the Mend CLI with access to read your application’s source code on a file system.
You must first run a full scan and upload it as a baseline for all future incremental scans, using the
--upload-baseline
parameter. An example of this configuration and the command is provided below:CODEmend code --dir <pathname_to_project> --upload-baseline
Run the incremental Mend CLI code scan
To initiate the incremental Mend CLI code scan, run the following command:
mend code --dir <pathname_to_project> --inc
Notes:
Backwards compatibility is supported for the previously used
mend sast
command. However, we recommend switching to the updatedmend code
command at your earliest availability.If --inc is used together with --upload-baseline, a full scan is executed when the previous baseline was created with an older version of the engine.