“JSNose: Detecting JavaScript Code Smells”, Amin Milani Fard, and Ali Mesbah.
In Proceedings of the International Conference on Source Code Analysis and Manipulation (SCAM), 116–125, 2013


JavaScript is a powerful and flexible prototype-based scripting language that is increasingly used by developers to create interactive web applications. The language is interpreted, dynamic, weakly-typed, and has first-class functions. In addition, it interacts with other web languages such as CSS and HTML at runtime. All these characteristics make JavaScript code particularly error-prone and challenging to write and maintain. Code smells are patterns in the source code that can adversely influence program comprehension and maintainability of the program in the long term. We propose a set of 13 JavaScript code smells, collected from various developer resources. We present a JavaScript code smell detection technique called JSNose. Our metric-based approach combines static and dynamic analysis to detect smells in client-side code. This automated technique can help developers to spot code that could benefit from refactoring. We evaluate the smell finding capabilities of our technique through an empirical study. By analyzing 11 web applications, we investigate which smells detected by JSNose are more prevalent.


  author = {Milani Fard, Amin and Mesbah, Ali},
  title = {JSNose: Detecting JavaScript Code Smells},
  booktitle = {Proceedings of the International Conference on Source Code Analysis and Manipulation (SCAM)},
  publisher = {IEEE Computer Society},
  pages = {116--125},
  year = {2013},
  url = {http://www.ece.ubc.ca/~amesbah/docs/scam13.pdf}