Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0afbea9

Browse files
author
Esben Sparre Andreasen
authored
Merge pull request #421 from xiemaisi/js/open-source-extractor
JavaScript: Open-source extractor
2 parents a8eabeb + f75ce7a commit 0afbea9

994 files changed

Lines changed: 134537 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.lgtm.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
path_classifiers:
22
library:
33
- javascript/externs
4+
- javascript/extractor/lib
45

56
test:
67
- csharp/ql/src
78
- csharp/ql/test
9+
- javascript/extractor/parser-tests
10+
- javascript/extractor/tests
811
- javascript/ql/src
912
- javascript/ql/test
1013

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[[ condition: enterprise-only ]]
2+
3+
# Improvements to JavaScript analysis
4+
5+
> NOTES
6+
>
7+
> Please describe your changes in terms that are suitable for
8+
> customers to read. These notes will have only minor tidying up
9+
> before they are published as part of the release notes.
10+
>
11+
> This file is written for lgtm users and should contain *only*
12+
> notes about changes that affect lgtm enterprise users. Add
13+
> any other customer-facing changes to the `studio-java.md`
14+
> file.
15+
>
16+
17+
## General improvements
18+
19+
> Changes that affect alerts in many files or from many queries
20+
> For example, changes to file classification
21+
22+
## Changes to code extraction
23+
24+
* Destructuring assignments are now modeled more precisely, which fixes both false-negative and false-positive results for the rules
25+
"Missing variable declaration" and "Useless assignment to local variable" in certain corner cases.
26+
* The TypeScript compiler is now bundled with the distribution, and no longer needs to be installed manually.
27+
Should the compiler version need to be overridden, set the `SEMMLE_TYPESCRIPT_HOME` environment variable to
28+
point to an installation of the `typescript` NPM package.

javascript/extractor/.classpath

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry excluding=".git" kind="src" path="lib/esregex"/>
5+
<classpathentry excluding=".git" kind="src" path="lib/external/doctrine"/>
6+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
7+
<classpathentry combineaccessrules="false" kind="src" path="/util-shared"/>
8+
<classpathentry combineaccessrules="false" kind="src" path="/util-java7"/>
9+
<classpathentry kind="lib" path="/resources/lib/js.jar" sourcepath="/resources/lib/js-src.jar"/>
10+
<classpathentry kind="lib" path="/resources/lib/jericho-html-3.3.jar" sourcepath="/resources/lib/jericho-html-3.3-sources.jar"/>
11+
<classpathentry kind="lib" path="/resources/lib/junit-4.11.jar" sourcepath="/resources/lib/junit-4.11-sources.jar"/>
12+
<classpathentry kind="lib" path="/resources/lib/gson-2.2.2-jar.jar" sourcepath="/resources/lib/gson-2.2.2-source.jar"/>
13+
<classpathentry kind="lib" path="/resources/lib/hamcrest-core-1.3.jar"/>
14+
<classpathentry kind="lib" path="/resources/lib/snakeyaml-1.18.jar" sourcepath="/resources/lib/snakeyaml-1.18-sources.jar"/>
15+
<classpathentry kind="lib" path="/resources/lib/slf4j-api-1.7.25.jar" sourcepath="/resources/lib/slf4j-api-1.7.25-sources.jar"/>
16+
<classpathentry kind="lib" path="/resources/lib/logback-classic-1.2.3.jar" sourcepath="/resources/lib/logback-classic-1.2.3-sources.jar"/>
17+
<classpathentry kind="lib" path="/resources/lib/logback-core-1.2.3.jar" sourcepath="/resources/lib/logback-core-1.2.3-sources.jar"/>
18+
<classpathentry kind="src" path="/util-java8"/>
19+
<classpathentry kind="output" path="bin"/>
20+
</classpath>

javascript/extractor/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
/bin

javascript/extractor/.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>extractor-javascript</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
eclipse.preferences.version=1
2+
encoding//tests/ts/input/xmlfile-utf16be.ts=UTF-16BE
3+
encoding//tests/ts/input/xmlfile-utf16le.ts=UTF-16LE

javascript/extractor/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# JavaScript extractor
2+
3+
This directory contains the source code of the JavaScript extractor. The extractor depends on various libraries that are not currently bundled with the source code, so at present it cannot be built in isolation.
4+
5+
The extractor consists of a parser for the latest version of ECMAScript, including a few proposed and historic extensions (see `src/com/semmle/jcorn`), classes for representing JavaScript and TypeScript ASTs (`src/com/semmle/js/ast` and `src/com/semmle/ts/ast`), and various other bits of functionality. Historically, the main entry point of the JavaScript extractor has been `com.semmle.js.extractor.Main`. However, this class is slowly being phased out in favour of `com.semmle.js.extractor.AutoBuild`, which is the entry point used by LGTM.
6+
7+
## License
8+
9+
Like the LGTM queries, the JavaScript extractor is licensed under [Apache License 2.0](LICENSE) by [Semmle](https://semmle.com).
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
esregex
2+
=======
3+
4+
Parser for ECMAScript 2018 regular expressions.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "esregex",
3+
"version": "1.0.0",
4+
"author": "Semmle",
5+
"description": "Parser for ECMAScript 2018 regular expressions",
6+
"devDependencies": {
7+
"nodeunit": "*"
8+
},
9+
"scripts": {
10+
"test": "node tests/runtests.js"
11+
},
12+
"license": "Apache 2.0"
13+
}

0 commit comments

Comments
 (0)