How to exclude files and folders - Mend CLI - Code
This article describes how you can exclude files and folders in our SAST solution.
Exclude Configuration Options
There are multiple ways to configure the exclude parameter:
Via User Interface
Click on Dashboard > Applications, then click on the edit button under Actions.

After that, head into Miscellaneous Options

Via Configuration Parameter
By setting the “exclusions” parameter located inside the JSON configuration file.
Each path will be defined in quotation marks, separated by commas.
For example:"exclusions": ["[.]py$", "/src/app/"]
Via Environment Variable
By setting the environment variable “SASTCLI_PATH_EXCLUSIONS” before running a scan.
The list needs to be comma separated, for example:set SASTCLI_PATH_EXCLUSIONS="[.]py$,/src/app/"
After running a scan with exclude parameters, the parameters will also be visible on the application settings in the User Interface.
If you wish to remove some parts of the exclude parameters, it is recommended to remove the parameters from the application settings as well.
Exclusion Syntax
SAST CLI supports Regular Expressions (or Regex) syntax for defining certain patterns to be excluded. Here are the most common ones:
Windows | Linux / MacOS | Description |
---|---|---|
\\src\\app\\ | /src/app/ | exclude all files within the /src/app/ directory |
\\src\\app\\.*[.]py | /src/app/.*[.]py | exclude all files that ends with .py inside the /src/app/ directory |
\\src\\app\\.*[.](py|jsx) | /src/app/.*[.](py|jsx) | exclude all files that ends with .py or .jsx inside /src/app/ directory |
\\src\\app\\test.* | /src/app/test.* | exclude all files that start with “test” inside /src/app/ directory |
[.]py$ | [.]py$ | exclude all files that end with .py (in all directories) |
\\folder\stest\\ | /folder\stest/ | exclude folder with space named “folder test” |
For more information and syntax available for Regular Expressions, please refer to the following link: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Cheatsheet