Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

How to Set Source Code Filters

Specify the root directory

Before an analysis with Kiuwan is executed, you must specify the root directory where the source code files are located.

Image Removed

That root directory is the SOURCE_DIR of the analysis. 

Kiuwan scans all the files under SOURCE_DIR before running the analysis.

with Kiuwan Local Analyzer (KLA)

Table of Contents

The source code filter mechanism

Set source code filters

If there are files and directories you do not want to analyze, you can set a

source code

filter for them.

 

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):

 

Image Removed

 

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.

 

Image Removed

 

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.

 

Image Removed

 

Info

KLA has a source code filter mechanism based on Ant-style include and exclude patterns. Here are some example patterns (find more here): 

Image Added

Set source code filters

  1. Specify the root directory (SOURCE_DIRwhere the source code files are located in Folder to analyze.
    (By default, KLA analyzes every file in this folder).
    Image Added

  2. Click on Advanced
    Image Added

  3. A new window displays
    Image Added

    Include patterns specify

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

    Exclude

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

Please, bear in mind when defining patterns that 
  1. If you want to add patterns, click the + button. A new window will appear: 
    Image Added

  2. If you want to remove a pattern, select it and click the - button.
     If you want to edit an existing pattern or copy the text, double click on it.
    Image Added


Info

Exclude patterns take precedence over

Include

include patterns.

 

For example, if

If you define the patterns below

patterns

, the analysis will not process any js file

.

:

include
  • Include : src/**.js
exclude
  • Exclude: **/**.js
First,

The exclude pattern

is saying

defines:

"

exclude all .js files in any directory and with any name

"

.

That will exclude all the js files from SOURCE_DIR.

Therefore, the include pattern

makes nothing: the subset already does not contain any js file.

has no effect.

The table below explains

 

Info

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

The whole SOURCE_DIR will be analyzed

Only the resulting fileset after inclusion of matched files will be analyzed

YES

Only

Resulting

the resulting fileset after exclusion of matched files will be analyzed

First, the exclusion pattern reduces the SOURCE_DIR

Second, over the above fileset, only

will be processed

those files

macthing

matching the include pattern

 

will be processed