Exclude files and folders from analysis

Table of Contents

Introduction #

Sider Scan allows you to exclude specific files and folders from the analysis. By using this feature to exclude unnecessary files for analysis, you can reduce the analysis time. It can also reduce noise in detecting duplicate code and increasing the possibility to find possible misses. To set this up, simply put a text file named “.scanignore” in the root folder to be analyzed, and describe the files and folders to be excluded from the analysis. The format is the same as “.gitignore” in Git.

How to setup #

First of all, please make sure that you have already specified the folder to be analyzed in the configuration screen. If you have not specified the folder yet, please refer to this page.

Next, create a text file named “.scanignore” in the root folder to be analyzed. The content of “.scanignore” is in the same format as the “.gitignore” file, which is a file exclusion function in Git. The following sections describe the basic description. For more information, please refer to the Git manual.

Exclude files
Describe the name of the file you want to exclude from the analysis.

.DS_Store

In this example, .DS_Store file is excluded from the analysis.

Exclude folders (directories)
Enter the name of the folder (directory) you want to exclude. Do not forget to put a slash / at the end of the folder name.

3rdparty/
logs/

In this example, 3rdparty folder and logs folder are excluded from the analysis.

Wildcards

The asterisk * matches zero or more characters except for the slash /. For example, writing *.cc will exclude all files with the extension cc from the analysis.
The question mark ? can also be used as a wildcard, but unlike the asterisk, it matches any single character except the slash /.

Negation

The exclamation mark ! can be used to negate the exclusion of files.

*.md
!Readme.md

In this example, all .md files in the root folder will be excluded from the analysis, but Readme.md will not be.

Double Asterisk

The double asterisk ** can be used to match any number of folders. For example, writing **/logs will exclude all files and folders named logs.
If you write logs/**/*.log, it will exclude all files with the .log extension in the logs folder and all its subfolders.

Comments

The line # starting with # is a comment.

# exclude MacOS file
.DS_Store
# exclude log files
logs/