Source Code Filters
Before the execution of a Kiuwan analysis, you must specify the root directory where the source files are located.
Likely, your SOURCE_DIR contains files and directories that you do not want to be analyzed.
Most common reasons are because your application contains open-source, 3rd-party or auto-generated code.
In those cases, you will not want that code to be analyzed because the defects found in those will not be corrected and, also, are disturbing (decreasing) the indicators of your application.
Kiuwan’s include and exclude patterns are Ant-style patterns, used to create subsets of files given a certain fileset.
Some example patterns might be (look at https://ant.apache.org/manual/dirtasks.html for a full reference of Ant-syntax):
How to define exclusion and inclusion patterns
When using Kiuwan Local Analyzer GUI, you can define both patterns by clicking on Advanced button and next dialog will open.
By default, you will find that there are some pre-defined exclude patterns (common patterns that usually do not contain useful code to be analyzed) that you can modify if needed.
There are +/- buttons to add/remove patterns.
To create a new one, next dialog will be open and added to the current set of patterns.
For example, if you define below patterns, the analysis will not process any js file.
- include : src/**.js
- exclude: **/**.js
First, exclude pattern is saying: "exclude all .js files in any directory and with any name". That will exclude all the js files from SOURCE_DIR. Therefore, include pattern makes nothing: the subset already does not contain any js file.
Table below explain how the whole mechanism works and what fileset will be analyzed by Kiuwan
| | Include pattern |
---|
| | NO | YES |
---|
Exclude pattern | NO | Whole SOURCE_DIR will be analyzed | Only resulting fileset after inclusion of matched files will be analyzed |
---|
YES | Only Resulting fileset after exclusion of matched files will be analyzed | First, exclusion pattern reduces SOURCE_DIR Second, over the above fileset, only will be processed those files macthing the include pattern |