Skip to content
Permalink
Browse files
CodeQL for VS Code: Initial commit.
  • Loading branch information
adityasharad committed Nov 13, 2019
0 parents commit d9a1dce7fa5c7ace412caa0f401cc489276317cb
Showing with 22,112 additions and 0 deletions.
  1. +6 −0 .editorconfig
  2. +14 −0 .gitattributes
  3. +73 −0 .github/workflows/main.yml
  4. +90 −0 .github/workflows/release.yml
  5. +19 −0 .gitignore
  6. +10 −0 .vscode/extensions.json
  7. +84 −0 .vscode/launch.json
  8. +14 −0 .vscode/settings.json
  9. +105 −0 .vscode/tasks.json
  10. +76 −0 CODE_OF_CONDUCT.md
  11. +135 −0 CONTRIBUTING.md
  12. +20 −0 LICENSE.md
  13. +29 −0 README.md
  14. +12 −0 build/README.md
  15. +1,294 −0 build/package-lock.json
  16. +17 −0 build/package.json
  17. +28 −0 common/config/LICENSE
  18. +12 −0 common/config/rush/.npmrc
  19. +32 −0 common/config/rush/command-line.json
  20. +43 −0 common/config/rush/common-versions.json
  21. +32 −0 common/config/rush/pnpmfile.js
  22. +6,646 −0 common/config/rush/shrinkwrap.yaml
  23. +6 −0 common/config/rush/version-policies.json
  24. +52 −0 common/scripts/install-run-rush.js
  25. +399 −0 common/scripts/install-run.js
  26. +28 −0 configs/typescript-config/common.tsconfig.json
  27. +8 −0 configs/typescript-config/extension.tsconfig.json
  28. +4 −0 configs/typescript-config/lib.tsconfig.json
  29. +18 −0 configs/typescript-config/package.json
  30. +16 −0 extensions/ql-vscode/.vscodeignore
  31. +98 −0 extensions/ql-vscode/README.md
  32. +19 −0 extensions/ql-vscode/gulpfile.js/index.js
  33. +61 −0 extensions/ql-vscode/gulpfile.js/webpack.config.ts
  34. +27 −0 extensions/ql-vscode/gulpfile.js/webpack.ts
  35. +72 −0 extensions/ql-vscode/language-configuration.json
  36. BIN extensions/ql-vscode/media/VS-marketplace-CodeQL-icon.png
  37. +58 −0 extensions/ql-vscode/media/black-plus.svg
  38. +56 −0 extensions/ql-vscode/media/check-dark-mode.svg
  39. +57 −0 extensions/ql-vscode/media/check-light-mode.svg
  40. +14 −0 extensions/ql-vscode/media/logo.svg
  41. +58 −0 extensions/ql-vscode/media/red-x.svg
  42. +58 −0 extensions/ql-vscode/media/white-plus.svg
  43. +344 −0 extensions/ql-vscode/package.json
  44. +308 −0 extensions/ql-vscode/src/archive-filesystem-provider.ts
  45. +11 −0 extensions/ql-vscode/src/blob.d.ts
  46. +96 −0 extensions/ql-vscode/src/cli-version.ts
  47. +496 −0 extensions/ql-vscode/src/cli.ts
  48. +188 −0 extensions/ql-vscode/src/config.ts
  49. +263 −0 extensions/ql-vscode/src/databases-ui.ts
  50. +631 −0 extensions/ql-vscode/src/databases.ts
  51. +677 −0 extensions/ql-vscode/src/distribution.ts
  52. +288 −0 extensions/ql-vscode/src/extension.ts
  53. +23 −0 extensions/ql-vscode/src/helpers-pure.ts
  54. +136 −0 extensions/ql-vscode/src/helpers.ts
  55. +26 −0 extensions/ql-vscode/src/ide-server.ts
  56. +103 −0 extensions/ql-vscode/src/interface-types.ts
  57. +477 −0 extensions/ql-vscode/src/interface.ts
  58. +40 −0 extensions/ql-vscode/src/logging.ts
  59. +918 −0 extensions/ql-vscode/src/messages.ts
  60. +663 −0 extensions/ql-vscode/src/queries.ts
  61. +182 −0 extensions/ql-vscode/src/query-history.ts
  62. +163 −0 extensions/ql-vscode/src/queryserver-client.ts
  63. +398 −0 extensions/ql-vscode/src/view/LICENSE
  64. +349 −0 extensions/ql-vscode/src/view/alert-table.tsx
  65. +22 −0 extensions/ql-vscode/src/view/octicons.tsx
  66. +118 −0 extensions/ql-vscode/src/view/raw-results-table.tsx
  67. +70 −0 extensions/ql-vscode/src/view/result-table-utils.tsx
  68. +147 −0 extensions/ql-vscode/src/view/result-tables.tsx
  69. +329 −0 extensions/ql-vscode/src/view/results.tsx
  70. +140 −0 extensions/ql-vscode/src/view/resultsView.css
  71. +23 −0 extensions/ql-vscode/src/view/tsconfig.json
  72. +61 −0 extensions/ql-vscode/src/vscode-tests/index-template.ts
  73. +26 −0 extensions/ql-vscode/src/vscode-tests/minimal-workspace/activation.test.ts
  74. +4 −0 extensions/ql-vscode/src/vscode-tests/minimal-workspace/index.ts
  75. +13 −0 extensions/ql-vscode/src/vscode-tests/no-workspace/activation.test.ts
  76. +38 −0 extensions/ql-vscode/src/vscode-tests/no-workspace/archive-filesystem-provider.test.ts
  77. +50 −0 extensions/ql-vscode/src/vscode-tests/no-workspace/cli-version.test.ts
  78. BIN ...ons/ql-vscode/src/vscode-tests/no-workspace/data/archive-filesystem-provider-test/single_file.zip
  79. +178 −0 extensions/ql-vscode/src/vscode-tests/no-workspace/distribution.test.ts
  80. +4 −0 extensions/ql-vscode/src/vscode-tests/no-workspace/index.ts
  81. +34 −0 extensions/ql-vscode/src/vscode-tests/no-workspace/webview-uri.test.ts
  82. +44 −0 extensions/ql-vscode/src/vscode-tests/run-integration-tests.ts
  83. +353 −0 extensions/ql-vscode/syntaxes/dbscheme.tmLanguage.yml
  84. +1,006 −0 extensions/ql-vscode/syntaxes/ql.tmLanguage.yml
  85. +2 −0 extensions/ql-vscode/test/.gitignore
  86. +4 −0 extensions/ql-vscode/test/data/multiple-result-sets.ql
  87. +1 −0 extensions/ql-vscode/test/data/query.ql
  88. 0 extensions/ql-vscode/test/data/test.dbscheme
  89. +4 −0 extensions/ql-vscode/test/data/test.dbscheme.stats
  90. +32 −0 extensions/ql-vscode/test/pure-tests/location.test.ts
  91. +227 −0 extensions/ql-vscode/test/pure-tests/query-test.ts
  92. +3 −0 extensions/ql-vscode/tsconfig.json
  93. +7 −0 lib/semmle-bqrs/gulpfile.js/index.js
  94. +32 −0 lib/semmle-bqrs/package.json
  95. +407 −0 lib/semmle-bqrs/src/bqrs-custom.ts
  96. +191 −0 lib/semmle-bqrs/src/bqrs-file.ts
  97. +202 −0 lib/semmle-bqrs/src/bqrs-parse.ts
  98. +100 −0 lib/semmle-bqrs/src/bqrs-results.ts
  99. +66 −0 lib/semmle-bqrs/src/bqrs-schema.ts
  100. +18 −0 lib/semmle-bqrs/src/bqrs.ts
  101. +7 −0 lib/semmle-bqrs/src/index.ts
  102. +49 −0 lib/semmle-bqrs/src/path-problem-query-results.ts
  103. +24 −0 lib/semmle-bqrs/src/problem-query-results.ts
  104. +3 −0 lib/semmle-bqrs/tsconfig.json
  105. +7 −0 lib/semmle-io-node/gulpfile.js/index.js
  106. +32 −0 lib/semmle-io-node/package.json
  107. +66 −0 lib/semmle-io-node/src/file-reader.ts
  108. +1 −0 lib/semmle-io-node/src/index.ts
  109. +3 −0 lib/semmle-io-node/tsconfig.json
  110. +7 −0 lib/semmle-io/gulpfile.js/index.js
  111. +30 −0 lib/semmle-io/package.json
  112. +303 −0 lib/semmle-io/src/digester.ts
  113. +2 −0 lib/semmle-io/src/index.ts
  114. +8 −0 lib/semmle-io/src/random-access-reader.ts
  115. +3 −0 lib/semmle-io/tsconfig.json
  116. +7 −0 lib/semmle-vscode-utils/gulpfile.js/index.js
  117. +26 −0 lib/semmle-vscode-utils/package.json
  118. +63 −0 lib/semmle-vscode-utils/src/disposable-object.ts
  119. +1 −0 lib/semmle-vscode-utils/src/index.ts
  120. +3 −0 lib/semmle-vscode-utils/tsconfig.json
  121. +58 −0 rush.json
  122. +7 −0 tools/build-tasks/gulpfile.js/index.js
  123. +47 −0 tools/build-tasks/package.json
  124. +189 −0 tools/build-tasks/src/deploy.ts
  125. +4 −0 tools/build-tasks/src/index.ts
  126. +23 −0 tools/build-tasks/src/package.ts
  127. +17 −0 tools/build-tasks/src/pnpm.ts
  128. +146 −0 tools/build-tasks/src/rush.ts
  129. +6 −0 tools/build-tasks/src/tests.ts
  130. +245 −0 tools/build-tasks/src/textmate.ts
  131. +68 −0 tools/build-tasks/src/typescript.ts
  132. +3 −0 tools/build-tasks/tsconfig.json
  133. +18 −0 tsfmt.json
@@ -0,0 +1,6 @@
[*.{ts,tsx,css,js,json}]
indent_style = space
indent_size = 2
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
@@ -0,0 +1,14 @@
# Don't allow people to merge changes to these generated files, because the result
# may be invalid. You need to run "rush update" again.
pnpm-lock.yaml merge=binary
shrinkwrap.yaml merge=binary
npm-shrinkwrap.json merge=binary
yarn.lock merge=binary

# Rush's JSON config files use JavaScript-style code comments. The rule below prevents pedantic
# syntax highlighters such as GitHub's from highlighting these comments as errors. Your text editor
# may also require a special configuration to allow comments in JSON.
#
# For more information, see this issue: https://github.com/Microsoft/web-build-tools/issues/1088
#
*.json linguist-language=JSON-with-Comments
@@ -0,0 +1,73 @@
name: Build Extension
on: [push, pull_request]

jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v1
with:
fetch-depth: 1

- name: Build
run: |
cd build
npm install
npm run build-ci
shell: bash

- name: Prepare artifacts
if: matrix.os == 'ubuntu-latest'
run: |
mkdir artifacts
cp dist/*.vsix artifacts
- name: Upload artifacts
uses: actions/upload-artifact@master
if: matrix.os == 'ubuntu-latest'
with:
name: vscode-codeql-extension
path: artifacts

test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v1
with:
fetch-depth: 1

# We have to build the dependencies in `lib` before running any tests.
- name: Build
run: |
cd build
npm install
npm run build-ci
shell: bash

- name: Run unit tests
run: |
cd extensions/ql-vscode
npm run test
- name: Run integration tests (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
cd extensions/ql-vscode
sudo apt-get install xvfb
/usr/bin/xvfb-run npm run integration
- name: Run integration tests (Windows)
if: matrix.os == 'windows-latest'
run: |
cd extensions/ql-vscode
npm run integration
@@ -0,0 +1,90 @@
# Build and release a new version of the extension.
# Based on example workflow at https://github.com/actions/upload-release-asset
# licensed under https://github.com/actions/upload-release-asset/blob/master/LICENSE.
# Reference for passing data between steps:
# https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps

name: Release
on:
push:
# Path filters are not evaluated for pushes to tags.
# (source: https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#onpushpull_requestpaths)
# So this workflow is triggered in the following events:
# - Release event: a SemVer tag, e.g. v1.0.0 or v1.0.0-alpha, is pushed
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
# OR
# - Test event: this file is modified on a branch in the main repo containing `/actions/` in the name.
branches:
- '**/actions/**'
paths:
- '**/workflows/release.yml'

jobs:
build:
name: Release
runs-on: ubuntu-latest
# TODO Share steps with the main workflow.
steps:
- name: Checkout
uses: actions/checkout@master

- name: Build
run: |
cd build
npm install
# Release build instead of dev build.
npm run build-release
shell: bash

- name: Prepare artifacts
id: prepare-artifacts
run: |
mkdir artifacts
cp dist/*.vsix artifacts
# Record the VSIX path as an output of this step.
# This will be used later when uploading a release asset.
VSIX_PATH="$(ls dist/*.vsix)"
echo "::set-output name=vsix_path::$VSIX_PATH"
# Transform the GitHub ref so it can be used in a filename.
# This is mainly needed for testing branches that modify this workflow.
REF_NAME="$(echo ${{ github.ref }} | sed -e 's:/:-:g')"
echo "::set-output name=ref_name::$REF_NAME"
# Uploading artifacts is not necessary to create a release.
# This is just in case the release itself fails and we want to access the built artifacts from Actions.
# TODO Remove if not useful.
- name: Upload artifacts
uses: actions/upload-artifact@master
with:
name: vscode-codeql-extension
path: artifacts

# TODO Run tests, or check that a test run on the same branch succeeded.

- name: Create release
id: create-release
uses: actions/create-release@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
# This gives us a chance to manually review the created release before publishing it,
# as well as to test the release workflow by pushing temporary tags.
# Once we have set all required release metadata in this step, we can set this to `false`.
draft: true
prerelease: false

- name: Upload release asset
uses: actions/upload-release-asset@v1.0.1
if: success()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# Get the `upload_url` from the `create-release` step above.
upload_url: ${{ steps.create-release.outputs.upload_url }}
# Get the `vsix_path` and `ref_name` from the `prepare-artifacts` step above.
asset_path: ${{ steps.prepare-artifacts.outputs.vsix_path }}
asset_name: ${{ format('vscode-codeql-{0}.vsix', steps.prepare-artifacts.outputs.ref_name) }}
asset_content_type: application/zip
@@ -0,0 +1,19 @@
# Logs
*.log

# Generated files
/dist/
out/
server/
node_modules/
gen/

# Integration test artifacts
**/.vscode-test/**

# Visual Studio workspace state
.vs/

# Rush files
/common/temp/**
package-deps.json
@@ -0,0 +1,10 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"eamodio.tsl-problem-matcher"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
}
@@ -0,0 +1,84 @@
// A launch configuration that compiles the extension and then opens it inside a new window
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Extension (vscode-codeql)",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}/dist/vscode-codeql",
"--disable-extensions"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/dist/vscode-codeql/out/**/*.js",
"${workspaceRoot}/dist/vscode-codeql/node_modules/semmle-bqrs/out/**/*.js",
"${workspaceRoot}/dist/vscode-codeql/node_modules/semmle-io/out/**/*.js",
"${workspaceRoot}/dist/vscode-codeql/node_modules/semmle-io-node/out/**/*.js",
"${workspaceRoot}/dist/vscode-codeql/node_modules/semmle-vscode-utils/out/**/*.js"
],
"preLaunchTask": "Build"
},
{
"name": "Launch Unit Tests (vscode-codeql)",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}/dist/vscode-codeql",
"--extensionTestsPath=${workspaceRoot}/extensions/ql-vscode/out/test",
"--disable-extensions"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/dist/vscode-codeql/out/**/*.js",
"${workspaceRoot}/dist/vscode-codeql/node_modules/semmle-bqrs/out/**/*.js",
"${workspaceRoot}/dist/vscode-codeql/node_modules/semmle-io/out/**/*.js",
"${workspaceRoot}/dist/vscode-codeql/node_modules/semmle-io-node/out/**/*.js",
"${workspaceRoot}/dist/vscode-codeql/node_modules/semmle-vscode-utils/out/**/*.js",
"${workspaceRoot}/extensions/ql-vscode/out/test/**/*.js"
],
"preLaunchTask": "Build"
},
{
"name": "Launch Integration Tests - No Workspace (vscode-codeql)",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}/dist/vscode-codeql",
"--extensionTestsPath=${workspaceRoot}/extensions/ql-vscode/out/vscode-tests/no-workspace/index",
"--disable-extensions"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/dist/vscode-codeql/out/**/*.js",
"${workspaceRoot}/extensions/ql-vscode/out/vscode-tests/**/*.js"
],
"preLaunchTask": "Build"
},
{
"name": "Launch Integration Tests - Minimal Workspace (vscode-codeql)",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}/dist/vscode-codeql",
"--extensionTestsPath=${workspaceRoot}/extensions/ql-vscode/out/vscode-tests/minimal-workspace/index",
"${workspaceRoot}/extensions/ql-vscode/test/data",
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/dist/vscode-codeql/out/**/*.js",
"${workspaceRoot}/extensions/ql-vscode/out/vscode-tests/**/*.js"
],
"preLaunchTask": "Build"
}
]
}
@@ -0,0 +1,14 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"out": false // set this to true to hide the "out" folder with the compiled JS files
},
"files.watcherExclude": {
"**/.git/**": true,
"**/node_modules/*/**": true
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
},
"typescript.tsdk": "./common/temp/node_modules/typescript/lib" // we want to use the TS server from our node_modules folder to control its version
}

0 comments on commit d9a1dce

Please sign in to comment.