You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

 

Before the execution of a Kiuwan analysis, you must specify the root directory where the source files are located.

 

That root directory is the SOURCE_DIR of the analysis.

Kiuwan scans all the files under SOURCE_DIR before to run the analysis.

 

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 provides Source Code Filters to specify the exact fileset you want to analyze.

This mechanism is based on Include and Exclude Patterns

 

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.

 

 

Include pattern(s) specify what subset(s) of files will be analyzed.

Exclude pattern(s) specify what subset(s) of file will not be analyzed.

Please, bear in mind when defining patterns that Exclude patterns take precedence over Include 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.

 

There might be subtle combinations depending on the specified include/exclude patterns, so we recommend you to use exclude to reduce the resulting fileset to be analyzed.

 

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

  • No labels