Steps to navigate to Scan Configuration Option:
- Click on Projects option on the left side navigation pane.
- Inside your project, click on a repository and then click on three dots “…” on the top right corner. Select the Scan configuration option.
Scan Configuration window consists of:
- Exclusion
- Additional Options
- Inclusion
- Includes
Exclusion:
We can exclude particular source files by providing regular expressions. Regular Expression Format: JavaScript
Examples:
- To filter out files containing “test” keyword -> “.*test.*”
- To filter out everything but one file -> “^(?!.*parse-this-file-only.cpp*$).*”
- Use escape character to match special characters like +, . -> “.*test.c++*”
Additional Options:
- Parsing invalid code:
By default, invalid code parsing is enabled but, it can be disabled using the following option.–parse-invalid-code=OFF
Note:
There is limited support for invalid code parsing, and it is prone to parser crash (very rare), so if for some codebase parser is crashing, please disable the invalid code parsing.
There is limited support for invalid code parsing, and it is prone to parser crash (very rare), so if for some codebase parser is crashing, please disable the invalid code parsing.
- Recursive include header search
By default, the parser searches for any header file recursively in all the sub-directories of the source folder. This can lead to incorrect results if there are multiple header files with the same name but in different folders.
To disable searching in all sub-directories use the following option
—include-all=OFF
- Define macros
Macros can be defined with GCC like option format.
Example: To define macro MY_MACRO -> –clang=”-DMY_MACRO=”
Any option to compiler can be given with –clang=””
Inclusion
- A comma-separated list of regular expressions should be added in Scan Configuration pop-up window >> inclusion
Includes
- Look for Includes label and upload zip of include files.
- Click Save.