HTML5 and JavaScript - Using the filters.json file

This documentation is not maintained. Please refer to doc.castsoftware.com/technologies to find the latest updates.

Summary: using the filters.json file provided in the extension.

Introduction

The HTML5 and JavaScript extension is provided with a file called filters.json at the root of the extension folder on your Node:

%PROGRAMDATA%\CAST\CAST\Extensions\com.castsoftware.html5.<version>\filters.json

This file lists all items that will be ignored during an analysis. The file is pre-populated with items, but it is also possible to modify the file manually and add your own custom filters.

Filter syntax

One line in the filters.json file is equal to one filter. Lines are separated by commas:

{ "type" : "FilePath|FileContent", "value" : "<path>|<content>" },
{ "type" : "FilePath|FileContent", "value" : "<path>|<content>" }

Ignoring files

To ignore a specific file, add the file name as follows. In the example below, all files named "bootstrap.js" will be ignored wherever they are found in the delivered source code:

{ "type" : "FilePath", "value" : "**/bootstrap.js" }

In the following example, the file named "module.js" will be ignored when it is present in the path "/assets/js/":

{ "type" : "FilePath", "value" : "**/assets/js/module.js" }

Ignoring folders

To ignore entire folders and their contents, specify the folder path/name. In the examples below, all files contained in the "node-modules" folder and in the "ui-bootstrap/assets" folder (wherever they are found in the delivered source code) will be ignored:

{ "type" : "FilePath", "value" : "**/node_modules/**" },
{ "type" : "FilePath", "value" : "**/ui-bootstrap/assets/**" }

Ignoring file content

To ignore content in files, you can use the syntax shown below. In the example below, all files containing "Copyright DHTMLX LTD" will be ignored wherever they are found in the delivered source code:

{ "type" : "FileContent", "value" : "Copyright DHTMLX LTD" }

Wildcards

To ignore files named in a similar way you can use a * wildcard. In the example below, the following will be ignored wherever they are found in the delivered source code:

  • all files named "blanket*.js" 
  • all *.js files located in the "test" folder
  • all files containing the content "cupQ.*MIT License" (for example "Copyright 2016 Google Inc")
{ "type" : "FilePath", "value" : "**/blanket*.js" },
{ "type" : "FilePath", "value" : "**/test/*.js" },
{ "type" : "FileContent", "value" : "Copyright.*Google Inc" },