Description

When analyzing an application using HTML5/Javascript extension, some JavaScript files are missing in Knowledge Base, and in the analysis log file. It can be seen that they are skipped.

HTML5 Analysis log
Starting processing of file 'D:\XXX_Workspace\YYY\XXXX_unminifiedscripts\unminified-scripts\underscore_min.js'
[com.castsoftware.html5] File D:\XXX_Workspace\YYY\XXXX_unminifiedscripts\unminified-scripts\underscore_min.js has been skipped
File processed : 'D:\XXX_Workspace\YYY\XXXX_unminifiedscripts\unminified-scripts\underscore_min.js
Observed in CAST Extension
Release
Yes/No
1.7(tick)
1.6(tick)
1.5(tick)
1.4(tick)
1.3(tick)
1.2(tick)
1.1(tick)
1.0(tick)


Observed on RDBMS
RDBMS
Yes/No
Oracle Server(tick)
Microsoft SQL Server(error)
CSS2(tick)
CSS3(tick)
Step by Step Scenario
  1. ServMan → Manage Extensions → install HTML5/Javascript extension on the triplet
  2. Create a user-defined Universal Analysis Unit for HTML5/Javascript
  3. Run the analysis on javascript source code.
Action Plan
  1. If the skipped file is a minified file (its name ends in min.js, just like in the example): this is expected behavior as minified files are automatically skipped.
    Also, it is not always necessary to have min.js as an extension of the file.
    • How to identify if a JavaScript file is a minified file: Minified packed typically has almost no spaces (typically in strings) and very long lines. Basically, all the framework files are minified files. The files are minified because when the framework files are called by control to load in memory it should take a minimum amount of memory to load and work as expected. Also, it is not possible to change the format of the minified file back to the normal JavaScript file because we will encounter several syntax errors if we try to do it.
  2. If the skipped file is part of a Third-Party framework, then this is an expected behavior too.
    • Indeed, frameworks like JQuery or Node.js modules are not part of the customer application itself, and thus should not be analyzed.
    • As explained in .NET - ASP.NET MVC Razor support  you can check file filters.json located at the root of the extension folder for a complete list of default exclusions, based on file paths and file contents. If you are not sure, you may check with the development team whether the file is home-made or belongs to a third-party tool or framework.  
    • If one of the skipped files has a name that includes some framework name whereas it is not a framework file, which is not a good practice, in terms of naming convention, but still could happen, then you may want to edit file filters.json in order to modify the filter
  3. Modify the filter: there are two types of filters, one based on file names, the other one based on file contents. You should check in file filters.json why your file was skipped.
    Example: file jquery.excludedreports.js is home-made, although it contains the expression jquery in its name. JQuery is a known framework and is excluded thanks to the following line in filters.json

    Filter on file path
    { "type" : "FilePath", "value" : "**/jquery*.js" }

    Then you may want to change the filter so that it be more restrictive and skip only file jquery.js but not jquery.excludedreports.js

    Modified filter
    { "type" : "FilePath", "value" : "**/jquery.js" }

    After relaunching analysis you can see that file jquery.excludedreports.js will not be excluded anymore.

Notes/comments

Ticket # 10839

Related Pages