-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Javascript: use codeql_pack
for javascript extractor
#16656
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
load("@semmle_code//:dist.bzl", "pack_zip") | ||
load("//misc/bazel:pkg.bzl", "codeql_pkg_files") | ||
|
||
pack_zip( | ||
codeql_pkg_files( | ||
name = "tools", | ||
srcs = glob(["**/*"]), | ||
excludes = [ | ||
"BUILD.bazel", | ||
], | ||
exes = glob(["**/*"]), | ||
prefix = "tools", | ||
visibility = ["//csharp:__pkg__"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
load("@semmle_code//:dist.bzl", "pack_zip") | ||
load("//misc/bazel:pkg.bzl", "codeql_pkg_files", "strip_prefix") | ||
|
||
pack_zip( | ||
codeql_pkg_files( | ||
name = "downgrades", | ||
srcs = glob( | ||
["**/*"], | ||
exclude = ["BUILD.bazel"], | ||
), | ||
prefix = "downgrades", | ||
visibility = ["//visibility:public"], | ||
strip_prefix = strip_prefix.from_pkg(), | ||
visibility = ["//javascript:__pkg__"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
load("@semmle_code//:dist.bzl", "pack_zip") | ||
load("//misc/bazel:pkg.bzl", "codeql_pkg_files", "strip_prefix") | ||
|
||
pack_zip( | ||
codeql_pkg_files( | ||
name = "externs", | ||
srcs = glob( | ||
["**/*"], | ||
exclude = ["BUILD.bazel"], | ||
), | ||
prefix = "tools/data/externs", | ||
visibility = ["//visibility:public"], | ||
strip_prefix = strip_prefix.from_pkg(), | ||
visibility = ["//javascript:__pkg__"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
load("//misc/bazel:pkg.bzl", "codeql_pkg_files") | ||
|
||
codeql_pkg_files( | ||
name = "resources", | ||
srcs = glob( | ||
["**/*"], | ||
exclude = [ | ||
"tools/*.sh", | ||
"BUILD.bazel", | ||
], | ||
), | ||
exes = glob(["tools/*.sh"]), | ||
strip_prefix = "", | ||
visibility = ["//javascript:__pkg__"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
name: "javascript" | ||
aliases: | ||
- javascript-typescript | ||
- typescript | ||
display_name: "JavaScript/TypeScript" | ||
version: 1.22.1 | ||
column_kind: "utf16" | ||
unicode_newlines: true | ||
build_modes: | ||
- none | ||
file_coverage_languages: | ||
- name: javascript | ||
display_name: JavaScript | ||
scc_languages: | ||
- JavaScript | ||
- name: typescript | ||
display_name: TypeScript | ||
scc_languages: | ||
- TypeScript | ||
- TypeScript Typings | ||
github_api_languages: | ||
- JavaScript | ||
- TypeScript | ||
scc_languages: | ||
- JavaScript | ||
- TypeScript | ||
- TypeScript Typings | ||
file_types: | ||
- name: javascript | ||
display_name: JavaScript | ||
extensions: | ||
- .js | ||
- .jsx | ||
- name: ecmascript | ||
display_name: ECMAScript | ||
extensions: | ||
- .es | ||
- .es6 | ||
- .mjs | ||
- name: typescript | ||
display_name: TypeScript | ||
extensions: | ||
- .ts | ||
- .tsx | ||
- name: html | ||
display_name: HTML | ||
extensions: | ||
- .html | ||
- .htm | ||
- .xhtm | ||
- .xhtml | ||
- name: vue | ||
display_name: Vue.js component | ||
extensions: | ||
- .vue | ||
- name: data | ||
display_name: Data or configuration files | ||
extensions: | ||
- .json | ||
- .yml | ||
- .yaml | ||
- .raml | ||
legacy_qltest_extraction: true | ||
options: | ||
trap: | ||
title: TRAP options | ||
description: Options about how the extractor handles TRAP files | ||
type: object | ||
visibility: 3 | ||
properties: | ||
cache: | ||
title: TRAP cache options | ||
description: Options about how the extractor handles its TRAP cache | ||
type: object | ||
properties: | ||
dir: | ||
title: TRAP cache directory | ||
description: The directory of the TRAP cache to use | ||
type: string | ||
bound: | ||
title: TRAP cache bound | ||
description: A soft limit (in MB) on the size of the TRAP cache | ||
type: string | ||
pattern: "[0-9]+" | ||
write: | ||
title: TRAP cache writeable | ||
description: Whether to write to the TRAP cache as well as reading it | ||
type: string | ||
pattern: "(true|TRUE|false|FALSE)" | ||
skip_types: | ||
title: Skip type extraction for TypeScript | ||
description: Whether to skip the extraction of types in a TypeScript application | ||
type: string | ||
pattern: "^(false|true)$" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
@echo off | ||
SETLOCAL EnableDelayedExpansion | ||
|
||
set jvm_args=-Xss16m | ||
|
||
rem If CODEQL_RAM is set, use half for Java and half for TS. | ||
if NOT [%CODEQL_RAM%] == [] ( | ||
set /a "half_ram=CODEQL_RAM/2" | ||
set LGTM_TYPESCRIPT_RAM=%half_ram% | ||
set jvm_args=!jvm_args! -Xmx!half_ram!m | ||
) | ||
|
||
rem If CODEQL_THREADS is set, propagate via LGTM_THREADS. | ||
if NOT [%CODEQL_THREADS%] == [] ( | ||
set LGTM_THREADS=%CODEQL_THREADS% | ||
) | ||
|
||
rem The JS autobuilder expects to find typescript modules under SEMMLE_DIST/tools. | ||
rem They are included in the pack, but we need to set SEMMLE_DIST appropriately. | ||
set SEMMLE_DIST=%CODEQL_EXTRACTOR_JAVASCRIPT_ROOT% | ||
|
||
rem The JS autobuilder expects LGTM_SRC to be set to the source root. | ||
set LGTM_SRC=%CD% | ||
|
||
type NUL && "%CODEQL_JAVA_HOME%\bin\java.exe" %jvm_args% ^ | ||
-cp "%CODEQL_EXTRACTOR_JAVASCRIPT_ROOT%\tools\extractor-javascript.jar" ^ | ||
com.semmle.js.extractor.AutoBuild | ||
exit /b %ERRORLEVEL% | ||
|
||
ENDLOCAL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
jvm_args=-Xss16m | ||
|
||
# If CODEQL_RAM is set, use half for Java and half for TS. | ||
if [ -n "${CODEQL_RAM:-}" ] ; then | ||
half_ram="$(( CODEQL_RAM / 2 ))" | ||
LGTM_TYPESCRIPT_RAM="$half_ram" | ||
export LGTM_TYPESCRIPT_RAM | ||
jvm_args="$jvm_args -Xmx${half_ram}m" | ||
fi | ||
|
||
# If CODEQL_THREADS is set, propagate via LGTM_THREADS. | ||
if [ -n "${CODEQL_THREADS:-}" ] ; then | ||
LGTM_THREADS="$CODEQL_THREADS" | ||
export LGTM_THREADS | ||
fi | ||
|
||
# The JS autobuilder expects to find typescript modules under SEMMLE_DIST/tools. | ||
# They are included in the pack, but we need to set SEMMLE_DIST appropriately. | ||
# We want to word-split $jvm_args, so disable the shellcheck warning. | ||
# shellcheck disable=SC2086 | ||
env SEMMLE_DIST="$CODEQL_EXTRACTOR_JAVASCRIPT_ROOT" \ | ||
LGTM_SRC="$(pwd)" \ | ||
"${CODEQL_JAVA_HOME}/bin/java" $jvm_args \ | ||
-cp "$CODEQL_EXTRACTOR_JAVASCRIPT_ROOT/tools/extractor-javascript.jar" \ | ||
com.semmle.js.extractor.AutoBuild |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"paths-ignore": [ | ||
"**/node_modules/**", | ||
"**/bower_components/**", | ||
"**/*.min.js", | ||
"**/*-min.js" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@echo off | ||
type "%CODEQL_EXTRACTOR_JAVASCRIPT_ROOT%\tools\baseline-config.json" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
|
||
cat "$CODEQL_EXTRACTOR_JAVASCRIPT_ROOT/tools/baseline-config.json" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
|
||
echo "Not implemented." 1>&2 | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
target | ||
extractor-pack | ||
.vscode/launch.json | ||
.cache | ||
ql/test/**/*.testproj | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
extractor/target | ||
extractor-pack | ||
.vscode/launch.json | ||
.cache | ||
ql/test/**/*.testproj | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this file and the scripts in the
tools
folder are copied unchanged from the internal repository and will be removed from the internal repository in the near future?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes exactly, only a
CONTRIBUTING.md
file was dropped. I'm not sure what it did there in the first place tbh.