This is a JavaScript parser for jQAssistant. It enables jQAssistant to scan and to analyze JavaScript file.
Download the jQAssistant command line tool for your system: jQAssistant - Get Started.
Next download the latest version from the release tab. Put the jqassistant-javascript-plugin-*.jar
into the plugins folder of the jQAssistant command
line tool.
Now scan your code and wait for the plugin to finish:
jqassistant.sh scan -f
You can then start a local Neo4j server to start querying the database at http://localhost:7474:
jqassistant.sh server
The JavaScript plugin uses the following labels in the resulting graph:
Label | Description |
---|---|
:JavaScript |
Parent label for all nodes related to the JavaScript plugin. |
:JavaScriptFile |
A file that contains JavaScript code artifacts, such as classes, functions etc. |
:Class |
Represents a JavaScript class. |
:Function |
Represents a JavaScript function. |
:Variable |
Represents a JavaScript variable. |
:Value |
Represents nodes that can contain values for code artifacts (files, classes, functions, and variables). |
:Array |
Nodes that represent JavaScript arrays. |
:Object |
Nodes that represent JavaScript objects. |
:Number |
Nodes that represent JavaScript numbers. |
:Boolean |
Nodes that represent JavaScript booleans. |
:Undefined |
Nodes that represent JavaScript undefined. |
:Null |
Nodes that represent JavaScript null. |
:String |
Nodes that represent JavaScript null. |
(:JavaScriptFile) -[DECLARES] -> (:Variable)
(:JavaScriptFile) -[DECLARES] -> (:Class)
(:JavaScriptFile) -[DECLARES] -> (:Function)
(:Class) -[DECLARES] -> (:Variable)
(:Class) -[DECLARES] -> (:Function)
(:Function) -[DECLARES] -> (:Variable)
(:Function) -[INVOKES] -> (:Function)
(:Variable) -[HAS] -> (:Value)
A value node can be either an array
, object
, number
, boolean
, string
, undefined
or zero
.
The framework automatically creates file nodes, which the plugin does not continue to use, since the listeners create their own file nodes. For directories it does not behave like this. It is a good idea to delete these empty nodes.
The test coverage is limited to the use of an integration test which exemplarily covers all components (nodes) and edges. Unit tests are missing.
The mapping of JavaScript is limited to the static analysis of source code artifacts. To extract further content, you would have to execute the source code and read the runtime information, e.g. using the runtime engine Rhino. This was not part of the work.
Please have a look at the issue section in GitHub. If you can't find your bug open a ticket with an reproducible example and your error logs.