I must to refactor the project in which thousands of lines of js-code. Is there a tool to search for dependencies of global variables and functions in the project javascript-files? It would be desirable that the tool could construct a graph.
-
1You should add some more info, e.g. if this is JS code written for nodejs (if so, try the web-stats-graph module), or javascript slapped into <script> tags inside .html files (If so, you are out of luck). Or is it a mess of jQuery methods chained together ...?– knbCommented Oct 8, 2018 at 8:50
1 Answer
You can run doxygen on your project with the options set to include undocumented functions and to map dependencies (ideally with graphviz also installed) and it will give you, in a variety of formats, all of the functions and globals with where they are used.
- Free, Gratis & Open Source
- Cross Platform
- Works for multiple languages:
- Java
- C, C++, C#
- Python
- Fortan
- IDL
- VHDL
Update
For JavaScript the doxygen site has the following to say:
For those working with JavaScript it may be good to know that Jörg Schaible has written a perl script to let doxygen deal with it. Unfortunately his site at berlios.de has been removed. If you google for js2doxy.pl you can still find copies of the script however.
This may or may not be of some help to you.
-
2OP specifically asked for "JavaScript". I don't see that in the list. Commented Aug 1, 2016 at 7:46
-
1Sorry for the wait, we had some difficulty at work, which distracted me. Your decision looks complicated, I would prefer the NPM module. But in any case I will try to use it in the next week.– qodunpobCommented Aug 5, 2016 at 2:54
-
1
-
1@Mawg - More than 4 years since OP was seen on the site so don't hold your breath. Commented Sep 25 at 18:31
-
1I know. I checked. Before commenting :-( I feel somewhat frustrated when people don't come back to award an answer. I feel much more frustrated when the algorithm thows such questions to the front– MawgCommented Sep 26 at 8:07