3

Usually, when I try to know more about a program based on its sources, I try to run doxygen on it and to extract the documentation and the global architecture of it (class hierarchy, modules, packages, call-stack, ...). It does help a lot. Another way, is also to run static-analyzers on the source such as cppcheck (C/C++), clang static-analyzer (c/c++) or pmd (Java), pylint (Python) and to look at the output.

I recently had to look at a Javascript program and I was a bit disappointed because I did not find any tool to perform good static analysis on it, nor tools to extract the software architecture (I found several scripts that were trying to convert the Javascript in a language accepted by Doxygen but none were able to work properly and extract something valuable). So, I wonder if I missed something when looking for these tools. Can somebody point me interesting tools about Javascript automated analysis ? Or, at least, explain to me why it is difficult (or impossible).

Note: I'm not speaking about Google Dart, but the usual Javascript (ECMAScript).

Kara
  • 6,115
  • 16
  • 50
  • 57
perror
  • 7,071
  • 16
  • 58
  • 85
  • Because JavaScript is a dynamic language without a rigid class/object structure, doing something like this would be quite difficult in general. – Pointy Apr 23 '13 at 14:11
  • Does this mean that it is pointless to extract an architecture from it ? Have you some pointers (articles, book chapter, links) to some argumented texts ? – perror Apr 24 '13 at 15:25
  • It's not pointless, it's just inherently very difficult in general. JavaScript variables aren't declared with explicit types, so any variable can hold any value. That makes it hard to analyze what's going on in a given piece of code. – Pointy Apr 24 '13 at 15:27
  • Okay, it can explain why there is so few tools. But, at least, there must be one or two attempts that work a little bit... That's my hope. – perror Apr 24 '13 at 15:30

1 Answers1

1

Static analysis tools for JavaScript have been discussed earlier. For architecture reconstruction tasks you might further consider JS/UML, IntelliJ IDEA, Visustin and Code Visual to Flowchart.

Community
  • 1
  • 1
Alexander Serebrenik
  • 3,567
  • 2
  • 16
  • 32