Skip to content

Commit d9a1dce

Browse files
committed
CodeQL for VS Code: Initial commit.
0 parents  commit d9a1dce

File tree

133 files changed

+22112
-0
lines changed

Some content is hidden

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

133 files changed

+22112
-0
lines changed

.editorconfig

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[*.{ts,tsx,css,js,json}]
2+
indent_style = space
3+
indent_size = 2
4+
charset = utf-8
5+
end_of_line = lf
6+
trim_trailing_whitespace = true

.gitattributes

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Don't allow people to merge changes to these generated files, because the result
2+
# may be invalid. You need to run "rush update" again.
3+
pnpm-lock.yaml merge=binary
4+
shrinkwrap.yaml merge=binary
5+
npm-shrinkwrap.json merge=binary
6+
yarn.lock merge=binary
7+
8+
# Rush's JSON config files use JavaScript-style code comments. The rule below prevents pedantic
9+
# syntax highlighters such as GitHub's from highlighting these comments as errors. Your text editor
10+
# may also require a special configuration to allow comments in JSON.
11+
#
12+
# For more information, see this issue: https://github.com/Microsoft/web-build-tools/issues/1088
13+
#
14+
*.json linguist-language=JSON-with-Comments

.github/workflows/main.yml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Build Extension
2+
on: [push, pull_request]
3+
4+
jobs:
5+
build:
6+
name: Build
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
matrix:
10+
os: [ubuntu-latest, windows-latest]
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v1
14+
with:
15+
fetch-depth: 1
16+
17+
- name: Build
18+
run: |
19+
cd build
20+
npm install
21+
npm run build-ci
22+
shell: bash
23+
24+
- name: Prepare artifacts
25+
if: matrix.os == 'ubuntu-latest'
26+
run: |
27+
mkdir artifacts
28+
cp dist/*.vsix artifacts
29+
30+
- name: Upload artifacts
31+
uses: actions/upload-artifact@master
32+
if: matrix.os == 'ubuntu-latest'
33+
with:
34+
name: vscode-codeql-extension
35+
path: artifacts
36+
37+
test:
38+
name: Test
39+
runs-on: ${{ matrix.os }}
40+
strategy:
41+
matrix:
42+
os: [ubuntu-latest, windows-latest]
43+
steps:
44+
- name: Checkout
45+
uses: actions/checkout@v1
46+
with:
47+
fetch-depth: 1
48+
49+
# We have to build the dependencies in `lib` before running any tests.
50+
- name: Build
51+
run: |
52+
cd build
53+
npm install
54+
npm run build-ci
55+
shell: bash
56+
57+
- name: Run unit tests
58+
run: |
59+
cd extensions/ql-vscode
60+
npm run test
61+
62+
- name: Run integration tests (Linux)
63+
if: matrix.os == 'ubuntu-latest'
64+
run: |
65+
cd extensions/ql-vscode
66+
sudo apt-get install xvfb
67+
/usr/bin/xvfb-run npm run integration
68+
69+
- name: Run integration tests (Windows)
70+
if: matrix.os == 'windows-latest'
71+
run: |
72+
cd extensions/ql-vscode
73+
npm run integration

.github/workflows/release.yml

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Build and release a new version of the extension.
2+
# Based on example workflow at https://github.com/actions/upload-release-asset
3+
# licensed under https://github.com/actions/upload-release-asset/blob/master/LICENSE.
4+
# Reference for passing data between steps:
5+
# https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
6+
7+
name: Release
8+
on:
9+
push:
10+
# Path filters are not evaluated for pushes to tags.
11+
# (source: https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#onpushpull_requestpaths)
12+
# So this workflow is triggered in the following events:
13+
# - Release event: a SemVer tag, e.g. v1.0.0 or v1.0.0-alpha, is pushed
14+
tags:
15+
- 'v[0-9]+.[0-9]+.[0-9]+*'
16+
# OR
17+
# - Test event: this file is modified on a branch in the main repo containing `/actions/` in the name.
18+
branches:
19+
- '**/actions/**'
20+
paths:
21+
- '**/workflows/release.yml'
22+
23+
jobs:
24+
build:
25+
name: Release
26+
runs-on: ubuntu-latest
27+
# TODO Share steps with the main workflow.
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@master
31+
32+
- name: Build
33+
run: |
34+
cd build
35+
npm install
36+
# Release build instead of dev build.
37+
npm run build-release
38+
shell: bash
39+
40+
- name: Prepare artifacts
41+
id: prepare-artifacts
42+
run: |
43+
mkdir artifacts
44+
cp dist/*.vsix artifacts
45+
# Record the VSIX path as an output of this step.
46+
# This will be used later when uploading a release asset.
47+
VSIX_PATH="$(ls dist/*.vsix)"
48+
echo "::set-output name=vsix_path::$VSIX_PATH"
49+
# Transform the GitHub ref so it can be used in a filename.
50+
# This is mainly needed for testing branches that modify this workflow.
51+
REF_NAME="$(echo ${{ github.ref }} | sed -e 's:/:-:g')"
52+
echo "::set-output name=ref_name::$REF_NAME"
53+
54+
# Uploading artifacts is not necessary to create a release.
55+
# This is just in case the release itself fails and we want to access the built artifacts from Actions.
56+
# TODO Remove if not useful.
57+
- name: Upload artifacts
58+
uses: actions/upload-artifact@master
59+
with:
60+
name: vscode-codeql-extension
61+
path: artifacts
62+
63+
# TODO Run tests, or check that a test run on the same branch succeeded.
64+
65+
- name: Create release
66+
id: create-release
67+
uses: actions/[email protected]
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
with:
71+
tag_name: ${{ github.ref }}
72+
release_name: Release ${{ github.ref }}
73+
# This gives us a chance to manually review the created release before publishing it,
74+
# as well as to test the release workflow by pushing temporary tags.
75+
# Once we have set all required release metadata in this step, we can set this to `false`.
76+
draft: true
77+
prerelease: false
78+
79+
- name: Upload release asset
80+
uses: actions/[email protected]
81+
if: success()
82+
env:
83+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
with:
85+
# Get the `upload_url` from the `create-release` step above.
86+
upload_url: ${{ steps.create-release.outputs.upload_url }}
87+
# Get the `vsix_path` and `ref_name` from the `prepare-artifacts` step above.
88+
asset_path: ${{ steps.prepare-artifacts.outputs.vsix_path }}
89+
asset_name: ${{ format('vscode-codeql-{0}.vsix', steps.prepare-artifacts.outputs.ref_name) }}
90+
asset_content_type: application/zip

.gitignore

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Logs
2+
*.log
3+
4+
# Generated files
5+
/dist/
6+
out/
7+
server/
8+
node_modules/
9+
gen/
10+
11+
# Integration test artifacts
12+
**/.vscode-test/**
13+
14+
# Visual Studio workspace state
15+
.vs/
16+
17+
# Rush files
18+
/common/temp/**
19+
package-deps.json

.vscode/extensions.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
// See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
3+
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
4+
// List of extensions which should be recommended for users of this workspace.
5+
"recommendations": [
6+
"eamodio.tsl-problem-matcher"
7+
],
8+
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
9+
"unwantedRecommendations": []
10+
}

.vscode/launch.json

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
// A launch configuration that compiles the extension and then opens it inside a new window
2+
{
3+
"version": "0.2.0",
4+
"configurations": [
5+
{
6+
"name": "Launch Extension (vscode-codeql)",
7+
"type": "extensionHost",
8+
"request": "launch",
9+
"runtimeExecutable": "${execPath}",
10+
"args": [
11+
"--extensionDevelopmentPath=${workspaceRoot}/dist/vscode-codeql",
12+
"--disable-extensions"
13+
],
14+
"stopOnEntry": false,
15+
"sourceMaps": true,
16+
"outFiles": [
17+
"${workspaceRoot}/dist/vscode-codeql/out/**/*.js",
18+
"${workspaceRoot}/dist/vscode-codeql/node_modules/semmle-bqrs/out/**/*.js",
19+
"${workspaceRoot}/dist/vscode-codeql/node_modules/semmle-io/out/**/*.js",
20+
"${workspaceRoot}/dist/vscode-codeql/node_modules/semmle-io-node/out/**/*.js",
21+
"${workspaceRoot}/dist/vscode-codeql/node_modules/semmle-vscode-utils/out/**/*.js"
22+
],
23+
"preLaunchTask": "Build"
24+
},
25+
{
26+
"name": "Launch Unit Tests (vscode-codeql)",
27+
"type": "extensionHost",
28+
"request": "launch",
29+
"runtimeExecutable": "${execPath}",
30+
"args": [
31+
"--extensionDevelopmentPath=${workspaceRoot}/dist/vscode-codeql",
32+
"--extensionTestsPath=${workspaceRoot}/extensions/ql-vscode/out/test",
33+
"--disable-extensions"
34+
],
35+
"stopOnEntry": false,
36+
"sourceMaps": true,
37+
"outFiles": [
38+
"${workspaceRoot}/dist/vscode-codeql/out/**/*.js",
39+
"${workspaceRoot}/dist/vscode-codeql/node_modules/semmle-bqrs/out/**/*.js",
40+
"${workspaceRoot}/dist/vscode-codeql/node_modules/semmle-io/out/**/*.js",
41+
"${workspaceRoot}/dist/vscode-codeql/node_modules/semmle-io-node/out/**/*.js",
42+
"${workspaceRoot}/dist/vscode-codeql/node_modules/semmle-vscode-utils/out/**/*.js",
43+
"${workspaceRoot}/extensions/ql-vscode/out/test/**/*.js"
44+
],
45+
"preLaunchTask": "Build"
46+
},
47+
{
48+
"name": "Launch Integration Tests - No Workspace (vscode-codeql)",
49+
"type": "extensionHost",
50+
"request": "launch",
51+
"runtimeExecutable": "${execPath}",
52+
"args": [
53+
"--extensionDevelopmentPath=${workspaceRoot}/dist/vscode-codeql",
54+
"--extensionTestsPath=${workspaceRoot}/extensions/ql-vscode/out/vscode-tests/no-workspace/index",
55+
"--disable-extensions"
56+
],
57+
"stopOnEntry": false,
58+
"sourceMaps": true,
59+
"outFiles": [
60+
"${workspaceRoot}/dist/vscode-codeql/out/**/*.js",
61+
"${workspaceRoot}/extensions/ql-vscode/out/vscode-tests/**/*.js"
62+
],
63+
"preLaunchTask": "Build"
64+
},
65+
{
66+
"name": "Launch Integration Tests - Minimal Workspace (vscode-codeql)",
67+
"type": "extensionHost",
68+
"request": "launch",
69+
"runtimeExecutable": "${execPath}",
70+
"args": [
71+
"--extensionDevelopmentPath=${workspaceRoot}/dist/vscode-codeql",
72+
"--extensionTestsPath=${workspaceRoot}/extensions/ql-vscode/out/vscode-tests/minimal-workspace/index",
73+
"${workspaceRoot}/extensions/ql-vscode/test/data",
74+
],
75+
"stopOnEntry": false,
76+
"sourceMaps": true,
77+
"outFiles": [
78+
"${workspaceRoot}/dist/vscode-codeql/out/**/*.js",
79+
"${workspaceRoot}/extensions/ql-vscode/out/vscode-tests/**/*.js"
80+
],
81+
"preLaunchTask": "Build"
82+
}
83+
]
84+
}

.vscode/settings.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Place your settings in this file to overwrite default and user settings.
2+
{
3+
"files.exclude": {
4+
"out": false // set this to true to hide the "out" folder with the compiled JS files
5+
},
6+
"files.watcherExclude": {
7+
"**/.git/**": true,
8+
"**/node_modules/*/**": true
9+
},
10+
"search.exclude": {
11+
"out": true // set this to false to include "out" folder in search results
12+
},
13+
"typescript.tsdk": "./common/temp/node_modules/typescript/lib" // we want to use the TS server from our node_modules folder to control its version
14+
}

0 commit comments

Comments
 (0)