JavaScript Code Quality Analysis

More Info
expand_more

Abstract

Static analysis techniques provide a means to detect software errors early in the development process, without actually having to run the software that is being analyzed. These techniques are common for statically typed languages and have found their way into IDEs such as Eclipse and Visual Studio. However, applying the same techniques to dynamically typed languages is much less common. Tool support is less mature and the amount of published research is relatively small. For this project, we design and build a static analyis tool for JavaScript code. We start by giving background information on relevant parts of the JavaScript language, followed by a survey of existing tools and research. In the design of our analysis tool, we achieved a clear separation of responsibilities between the different modules for parsing, analysis, rule definition and reporting. The level of detail in the default reporter makes our tool an ideal candidate for integration in a JavaScript IDE. On the other hand, our tool is also suited for batch analysis of large code collections. To validate our tool, we set up an experiment in which we ran our analysis tool on two large collections of JavaScript code: one from a repository of open source JavaScript packages, mostly for server-side use; another one gathered from client-side code on a large number of popular websites. We present high-level global results as well as more detailed results for selected projects and websites.