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

Compare with Current View Page History

« Previous Version 4 Next »

How to Set Source Code Filters

 

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

This source code filter 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):

 

Specify the root directory

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



  2. Click on Advanced 



  3. A new window will appear



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

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



  4. If you want to add patterns, click on the + button. A new window will appear: 



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




Exclude patterns take precedence over include patterns.

If you define the patterns below, the analysis will not process any js file:

  • Include : src/**.js
  • Exclude: **/**.js

The exclude pattern defines: exclude all .js files in any directory and with any name. Therefore, the include pattern has no effect.

The table below explains how the whole mechanism works and what fileset will be analyzed by Kiuwan:

 

 

Include pattern

 

 

NO

YES

Exclude pattern

NO

The whole SOURCE_DIR will be analyzed

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

YES

Only 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 those files macthing the include patternwill be processed

  • No labels