|
1 | | -# jQAssistant Java Source Parser Plugin # |
| 1 | +# jQAssistant JavaScript Source Parser Plugin # |
2 | 2 |
|
3 | | -[](https://github.com/softvis-research/jqa-javasrc-plugin/blob/master/LICENSE) |
4 | | -[](https://travis-ci.com/softvis-research/jqa-javasrc-plugin) |
| 3 | +[](https://github.com/softvis-research/jqa-githubissues-plugin/blob/master/LICENSE) |
| 4 | +[](https://travis-ci.com/softvis-research/jqa-javascript-plugin) |
| 5 | +[](https://codecov.io/gh/softvis-research/jqa-javascript-plugin) |
5 | 6 |
|
6 | | -This is a java source parser for [jQAssistant](https://www.jqassistant.org). |
7 | | -It enables jQAssistant to scan and to analyze Java source code files. |
8 | 7 |
|
9 | | -## Configuration Parameters for Maven ## |
| 8 | +This is a JavaScript parser for [jQAssistant](https://www.jqassistant.org). It enables jQAssistant to scan and to analyze [JavaScript](https://www.ecma-international.org/ecma-262/9.0/index.html#Title) files. |
10 | 9 |
|
| 10 | +## Getting Started |
| 11 | +### Standalone |
| 12 | +Download [jQAssistant](https://jqassistant.org/get-started/) for command line usage. To build the project create a new maven run configuration for the project with the goals ```clean install```. You can find the resulting jar file in the target folder of the project. Then run: |
| 13 | + |
| 14 | +```bash |
| 15 | +# Scan the GitHub-Repositories |
| 16 | +jqassistant-commandline-neo4jv3-1.4.0/bin/jqassistant.sh scan -f |
| 17 | + |
| 18 | +# Start a Neo4J web UI to explore the result: |
| 19 | +jqassistant-commandline-neo4jv3-1.4.0/bin/jqassistant.sh server |
| 20 | +``` |
| 21 | + |
| 22 | +## Labels and relations |
| 23 | + |
| 24 | +### Labels |
| 25 | +The JavaScript plugin uses the following labels in the resulting graph: |
| 26 | + |
| 27 | +| Label | Description | |
| 28 | +| ----- | ------------------------------------------------------------ | |
| 29 | +|```:JavaScript```|Parent label for all nodes related to the JavaScript plugin.| |
| 30 | +|```:JavaScriptFile```|A file that contains JavaScript code artifacts, such as classes, functions etc. |
| 31 | +|```:Class```|Represents a JavaScript class.| "repo-user/repo-name"| |
| 32 | +|```:Function```|Represents a JavaScript function.| "repo-user/repo-name#issue-number" | |
| 33 | +|```:Variable```|Represents a JavaScript variable.| "repo-user/repo-name#milestone-id" | |
| 34 | +|```:Value```|Represents nodes that can contain values for code artifacts (files, classes, functions, and variables).| |
| 35 | +|```:Array```|Nodes that represent JavaScript [arrays](https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array).| |
| 36 | +|```:Object```|Nodes that represent JavaScript [objects](https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Object).| |
| 37 | +|```:Number```|Nodes that represent JavaScript [numbers](https://www.w3schools.com/js/js_numbers.asp).| |
| 38 | +|```:Boolean```|Nodes that represent JavaScript [booleans](https://www.w3schools.com/js/js_booleans.asp).| |
| 39 | +|```:Undefined```|Nodes that represent JavaScript [undefined](https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/undefined).| |
| 40 | +|```:Null```|Nodes that represent JavaScript [null](https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/null).| |
| 41 | +|```:String```|Nodes that represent JavaScript [null](https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/String).| |
| 42 | + |
| 43 | +### Relations |
| 44 | +#### JavaScriptFile |
| 45 | +```java |
| 46 | +(:JavaScriptFile) -[DECLARES] -> (:Variable) |
| 47 | +(:JavaScriptFile) -[DECLARES] -> (:Class) |
| 48 | +(:JavaScriptFile) -[DECLARES] -> (:Function) |
| 49 | +``` |
| 50 | +#### Class |
| 51 | +```java |
| 52 | +(:Class) -[DECLARES] -> (:Variable) |
| 53 | +(:Class) -[DECLARES] -> (:Function) |
| 54 | +``` |
| 55 | +#### Function |
| 56 | +```java |
| 57 | +(:Function) -[DECLARES] -> (:Variable) |
| 58 | +(:Function) -[INVOKES] -> (:Function) |
11 | 59 | ``` |
12 | | -<configuration> |
13 | | - <scanIncludes> |
14 | | - <scanInclude> |
15 | | - <path>[PATH TO SOURCE ROOT FOLDER]</path> |
16 | | - <scope>java:src</scope> |
17 | | - </scanInclude> |
18 | | - </scanIncludes> |
19 | | - <scanProperties> |
20 | | - <jqassistant.plugin.javasrc.jar.dirname>[PATH TO FOLDER WITH JAR DEPENDENCIES]</jqassistant.plugin.javasrc.jar.dirname> |
21 | | - </scanProperties> |
22 | | -</configuration> |
| 60 | +#### Variable |
| 61 | +```java |
| 62 | +(:Variable) -[HAS] -> (:Value) |
23 | 63 | ``` |
| 64 | +#### Value |
| 65 | +A value node can be either an ```array```, ```object```, ```number```, ```boolean```, ```string```, ```undefined``` or ```zero```. |
| 66 | + |
| 67 | +## Known problems |
| 68 | + |
| 69 | +### Weird nodes |
| 70 | +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. |
| 71 | +### Test coverage |
| 72 | +The test coverage is limited to the use of an integration test which exemplarily covers all components (nodes) and edges. Unit tests are missing. |
| 73 | +### Static source code analysis is limited |
| 74 | +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](https://github.com/mozilla/rhino). This was not part of the work. |
| 75 | + |
| 76 | +### Did you find a bug? |
| 77 | +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. |
0 commit comments