Compare commits

...

2549 Commits

Author SHA1 Message Date
Anders Starcke Henriksen
c7bb22c312 Merge pull request #2299 from github/v1.8.2
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
v1.8.2
2023-04-12 14:52:57 +02:00
Anders Starcke Henriksen
3c8dc04845 v1.8.2 2023-04-12 14:26:17 +02:00
Koen Vlaswinkel
b0940e6da9 Merge pull request #2279 from github/koesie10/fix-result-view-selected
Fix empty result view when switching between queries
2023-04-11 17:33:58 +02:00
Robert
048428b237 Merge pull request #2294 from github/robertbrignull/no_distribution_install
Don't rate limit if no CLI is installed
2023-04-11 16:18:55 +01:00
Koen Vlaswinkel
957f71c9d4 Merge pull request #2293 from github/koesie10/use-data-extensions-in-editor
Use data extensions for finding external API calls
2023-04-11 16:01:26 +02:00
Robert
361cb60044 Don't rate limit if no CLI is installed 2023-04-11 12:45:48 +01:00
Koen Vlaswinkel
ae08a1b598 Use data extensions for finding external API calls
The data extension editor was only using the default data extensions
found in the `ql` submodule to find external API calls. This will add
support for using data extensions found in the workspace.

Rather than using the `codeQL.runningQueries.useExtensionPacks` setting,
this will always include data extensions since the editor doesn't make
sense to use without data extensions. We will also forbid the user from
opening this view unless they are using a CLI which supports data
extension packs.
2023-04-11 13:31:51 +02:00
Charis Kyriakou
deb2b83642 Update selected code flow when data flow paths change (#2288) 2023-04-11 11:02:03 +01:00
Koen Vlaswinkel
0115259778 Merge pull request #2271 from github/koesie10/data-extension-editor-cli-tests
Split and add tests for external API usages query
2023-04-11 11:46:29 +02:00
Koen Vlaswinkel
ccf9466fd9 Merge pull request #2260 from github/koesie10/data-extension-editor-stories
Add stories for data extension editor
2023-04-11 11:19:04 +02:00
Koen Vlaswinkel
6dfa726110 Merge remote-tracking branch 'origin/main' into koesie10/data-extension-editor-cli-tests 2023-04-11 11:13:07 +02:00
Koen Vlaswinkel
9f3baadee9 Rename getResults to readQueryResults 2023-04-11 11:10:45 +02:00
Koen Vlaswinkel
ad3a728012 Merge pull request #2267 from github/koesie10/data-extension-editor-generate-flow-model
Add generating of flow model to data extension editor
2023-04-11 11:07:30 +02:00
Koen Vlaswinkel
24c40af78f Add comment to @ts-ignore 2023-04-11 10:31:37 +02:00
Koen Vlaswinkel
41e0dc2961 Remove unnecessary null check 2023-04-11 10:30:32 +02:00
Koen Vlaswinkel
102976e167 Use functions instead of class for generating flow model
We were using a single-use class for generating the flow model, while we
are actually able to do it using two functions. This is more in line
with our existing codebase.
2023-04-11 10:27:46 +02:00
Koen Vlaswinkel
4e8df309fb Add comments for adding flow database 2023-04-11 10:22:10 +02:00
Nora
36f7555fdd Merge pull request #2281 from github/nora/refactor-repo-task
Repo task:  new data model and mapping
2023-04-06 18:12:19 +02:00
Nora
2cb5928cd8 Remove unnecessary directory creation that is handled by outputJson 2023-04-06 14:58:29 +00:00
Nora
2963d7eb5f Remove unnecessary return statements in repo task and repo states 2023-04-06 14:58:29 +00:00
Nora
1beddf7640 Map data types 2023-04-06 14:58:29 +00:00
Nora
f21117e5dd Extract read and write to store 2023-04-06 14:58:29 +00:00
Koen Vlaswinkel
dbc7f90c20 Throw error instead of returning undefined 2023-04-06 16:54:20 +02:00
Koen Vlaswinkel
af8e0bb454 Rename getAddsTo 2023-04-06 16:49:20 +02:00
Koen Vlaswinkel
18db74ed2d Add type check for query results 2023-04-06 16:35:04 +02:00
Koen Vlaswinkel
d5403ad926 Introduce type for modeled method with signature 2023-04-06 16:33:43 +02:00
Koen Vlaswinkel
fcc937657d Merge pull request #2280 from github/koesie10/fix-webview-disposed
Fix error when closing MRVA webview during extension activation
2023-04-06 16:33:26 +02:00
Koen Vlaswinkel
0d00e5c5b7 Remove undefined from readModeledMethod return type 2023-04-06 16:27:34 +02:00
Koen Vlaswinkel
3214a376ad Clarify definitions to be extensible predicate definitions 2023-04-06 16:24:25 +02:00
Koen Vlaswinkel
5a3a1a5cd7 Add comment for flow model progress 2023-04-06 16:23:10 +02:00
Koen Vlaswinkel
d3ff87ab71 Update language used for generating modeled methods 2023-04-06 16:21:48 +02:00
Koen Vlaswinkel
42d4034744 Extract getting ql submodule folder to function 2023-04-06 16:20:01 +02:00
Koen Vlaswinkel
4fa229f8a2 Rename generateExternalApi to generateModeledMethods 2023-04-06 16:16:37 +02:00
Nora
15a9093c98 Merge pull request #2270 from github/nora/model-repo-states
Repo States: new data model and mapping
2023-04-06 15:26:26 +02:00
Nora
1595d6f4aa Fix default and use assertNever 2023-04-06 12:59:30 +00:00
Koen Vlaswinkel
6c95ac7c79 Fix error when closing MRVA webview during extension activation
This fixes the "Webview is disposed" error which occurs when the user
closes the variant analysis webview while the extension is still
activating. We will now check whether the webview is disposed before
restoring the view.
2023-04-06 14:57:58 +02:00
Nora
103070ee7a Use shorthand 2023-04-06 12:52:45 +00:00
Nora
7e3c0265fe Use new methods in test 2023-04-06 12:49:14 +00:00
Nora
8eaf1e9adc Retain error message 2023-04-06 12:48:53 +00:00
Koen Vlaswinkel
978af54e2a Fix potential concurrency bug in results view
This was pointed out by CodeQL: when calling `setState` and using
`this.props`, it may not be up-to-date because `setState` may run
concurrently. Therefore, we should use the `setState` callback variant
to ensure we get the latest props.

This refactors the code a bit to ensure we're not using `this.props`
anywhere, including in the `getResultSets` function which is called
in the `setState` callback.
2023-04-06 14:25:11 +02:00
Koen Vlaswinkel
84928fa2fe Add test for empty result view bug 2023-04-06 14:10:58 +02:00
Koen Vlaswinkel
2a4a91207a Fix empty result view when switching between queries
When updating to React 18, we removed the loading step from the updating
of the state of the result view since React would batch the updates
anyway. However, this caused a bug where the result view would be empty
when switching between queries. This is because the result view would
retain the old selected result set name. This would not happen
previously because React would re-render the view at least once, which
would cause the result view to be unmounted and re-created.

This fixes it by resetting the selected result set if we can't find the
result set in the new result sets.
2023-04-06 13:58:15 +02:00
Koen Vlaswinkel
bb05220b2c Fix Babel compilation error
The default Storybook Babel config did not recognize the `public`
keyword in our custom errors (e.g. `ExhaustivityCheckingError`
and `RedactableError`). To fix this, we can use Storybook's V7 mode to
supply a custom Babel config. This fixes the compilation error.

See: https://storybook.js.org/docs/react/configure/babel
2023-04-06 13:35:10 +02:00
Koen Vlaswinkel
1bcc13af7c Add story for DataExtensionsEditor 2023-04-06 13:35:04 +02:00
Koen Vlaswinkel
3ae16d9534 Add story for MethodRow 2023-04-06 13:32:10 +02:00
Koen Vlaswinkel
0b1b03d5b0 Merge remote-tracking branch 'origin/main' into koesie10/data-extension-editor-cli-tests 2023-04-06 12:46:36 +02:00
Koen Vlaswinkel
083cf44f66 Merge remote-tracking branch 'origin/main' into koesie10/data-extension-editor-generate-flow-model 2023-04-06 12:43:51 +02:00
Koen Vlaswinkel
3628f4bf36 Merge pull request #2266 from github/koesie10/data-extension-editor-jump-to-usage
Add link to example usage in data extensions editor
2023-04-06 12:18:35 +02:00
Nora
3f5bc85004 Map enum properly 2023-04-06 09:58:08 +00:00
Nora
14ad348f24 new repo states data type and mapping 2023-04-06 09:58:07 +00:00
Nora
84fd198391 Merge pull request #2242 from github/nora/query-history-refactoring
Query History: create and map data model to domain model
2023-04-06 11:40:18 +02:00
Koen Vlaswinkel
a1809b0bac Merge similar messages for adding modeled methods 2023-04-06 11:22:52 +02:00
Koen Vlaswinkel
f78f535a95 Merge remote-tracking branch 'origin/main' into koesie10/data-extension-editor-generate-flow-model 2023-04-06 11:21:04 +02:00
Koen Vlaswinkel
b3ce6423d3 Merge remote-tracking branch 'origin/main' into koesie10/data-extension-editor-jump-to-usage 2023-04-06 11:18:17 +02:00
Nora
e62142b780 Introduce data models and refactor mapper 2023-04-06 09:17:42 +00:00
Koen Vlaswinkel
20e937026d Merge pull request #2265 from github/koesie10/data-extension-editor-yaml-load
Load existing data extension YAML in editor
2023-04-06 11:16:41 +02:00
Koen Vlaswinkel
c0818d86d9 Move creation of YAML string from webview to extension 2023-04-06 10:52:46 +02:00
Koen Vlaswinkel
82f96178bf Move loading of YAML from webview to extension 2023-04-06 10:49:01 +02:00
Koen Vlaswinkel
2da21a41bc Merge remote-tracking branch 'origin/main' into koesie10/data-extension-editor-jump-to-usage 2023-04-06 10:43:30 +02:00
Koen Vlaswinkel
df2e22bad2 Merge remote-tracking branch 'origin/main' into koesie10/data-extension-editor-yaml-load 2023-04-06 10:36:59 +02:00
Koen Vlaswinkel
d60bcf31a8 Merge pull request #2264 from github/koesie10/data-extension-editor-yaml
Add saving of data extension editor table to YAML
2023-04-06 10:35:46 +02:00
Koen Vlaswinkel
9f78092857 Merge pull request #2276 from github/koesie10/markdown-lint-ci
Add markdownlint to CI
2023-04-06 10:26:11 +02:00
Koen Vlaswinkel
3945f64ace Add alias for yaml imports 2023-04-06 10:15:20 +02:00
Koen Vlaswinkel
fa1200ddf9 Rename loadExistingYaml 2023-04-06 10:14:29 +02:00
Koen Vlaswinkel
083b736aec Change getter to method 2023-04-06 10:12:52 +02:00
Koen Vlaswinkel
f35d11bc9c Merge branch 'main' into koesie10/markdown-lint-ci 2023-04-06 10:11:58 +02:00
Koen Vlaswinkel
7470e72e76 Merge pull request #2269 from github/koesie10/upgrade-ts-jest
Upgrade ts-jest
2023-04-06 09:52:47 +02:00
Koen Vlaswinkel
ae40ae4f9a Merge branch 'main' into koesie10/upgrade-ts-jest 2023-04-06 09:40:35 +02:00
Koen Vlaswinkel
82e3d48533 Merge pull request #2275 from github/koesie10/markdown-lint-generated-files
Fix markdownlint errors for generated files
2023-04-06 09:33:27 +02:00
Koen Vlaswinkel
df04f39651 Merge branch 'main' into koesie10/markdown-lint-generated-files 2023-04-05 17:19:49 +02:00
Koen Vlaswinkel
80cbaf9e7c Merge branch 'koesie10/data-extension-editor-yaml-load' into koesie10/data-extension-editor-generate-flow-model 2023-04-05 17:06:49 +02:00
Koen Vlaswinkel
478d683743 Merge branch 'koesie10/data-extension-editor-yaml' into koesie10/data-extension-editor-yaml-load 2023-04-05 17:03:29 +02:00
Koen Vlaswinkel
64723d03b1 Merge remote-tracking branch 'origin/main' into koesie10/data-extension-editor-yaml 2023-04-05 17:00:18 +02:00
Koen Vlaswinkel
97af137252 Merge pull request #2263 from github/koesie10/data-extensions-editor-calls
Show external API calls in data extensions editor
2023-04-05 16:55:20 +02:00
Koen Vlaswinkel
c4f61553d4 Merge branch 'main' into koesie10/data-extensions-editor-calls 2023-04-05 16:43:32 +02:00
Koen Vlaswinkel
5d7d1b25ab Merge pull request #2268 from github/markdown-lint-local
Set up markdownlint with GitHub's additional rules in VSCode and as npm script
2023-04-05 16:41:40 +02:00
Koen Vlaswinkel
f7bcd58100 Add markdownlint to CI 2023-04-05 16:41:34 +02:00
Koen Vlaswinkel
f062f8b821 Fix markdownlint errors for generated files 2023-04-05 16:40:47 +02:00
Robert
e455e57124 Merge pull request #2272 from github/robertbrignull/splitCommand/codeQL.monitorVariantAnalysis
Split up codeQL.monitorVariantAnalysis command
2023-04-05 15:35:21 +01:00
Sam Partington
f277b85554 Add more exclusions 2023-04-05 15:07:10 +01:00
Robert
3b7861edfc Merge branch 'main' into robertbrignull/splitCommand/codeQL.monitorVariantAnalysis 2023-04-05 14:55:19 +01:00
github-actions[bot]
1b43e989ab Bump CLI version from v2.12.5 to v2.12.6 for integration tests (#2274)
Co-authored-by: github-actions[bot] <github-actions@github.com>
2023-04-05 13:39:02 +00:00
Sam Partington
7a5e654a80 Add comment about base config
https://github.com/github/vscode-codeql/pull/2268#discussion_r1158488461
2023-04-05 14:35:07 +01:00
Sam Partington
bd7eea6cc0 Clarify which extension
https://github.com/github/vscode-codeql/pull/2268#discussion_r1158475799
2023-04-05 14:24:39 +01:00
Robert
e84d488005 Merge pull request #2273 from github/robertbrignull/splitCommand/codeQL.restartQueryServer
Split up codeQL.restartQueryServer command
2023-04-05 14:23:07 +01:00
Koen Vlaswinkel
d402d86589 Add comment about progress max step 2023-04-05 15:14:25 +02:00
Robert
145764c39b Split up codeQL.restartQueryServer command 2023-04-05 13:35:40 +01:00
Koen Vlaswinkel
5ce3b22351 Add tests for external API query
This adds tests for the external API query and retrieving of results. It
does not use the "real" CLI integration, but instead mocks the CLI
server and query runner.

To make mocking easier and require less type casting, I've narrowed some
of the arguments of some other functions. They now use `Pick` to only
require the properties they need.
2023-04-05 13:58:58 +02:00
Sam Partington
b2f817d9f1 Ensure vscode extension considers github-markdownlint config 2023-04-05 12:50:52 +01:00
Sam Partington
e85cba8999 Fix duplicate headers, remove rule-disablement 2023-04-05 12:43:09 +01:00
Robert
322293449a Split up codeQL.monitorVariantAnalysis command 2023-04-05 12:42:02 +01:00
Sam Partington
b0029bfbc4 Fix markdown that was treated as HTML 2023-04-05 12:34:39 +01:00
Sam Partington
9855bef84a Remove bare links 2023-04-05 12:32:45 +01:00
Sam Partington
951a520bdb Ensure github-markdownlint rules considered for all linting 2023-04-05 12:25:21 +01:00
Sam Partington
6458690d9f Move common markdownlint config to top-level file 2023-04-05 12:11:49 +01:00
Koen Vlaswinkel
c245f338f5 Extract external API usage query to separate file 2023-04-05 12:36:44 +02:00
Koen Vlaswinkel
c02374125e Upgrade ts-jest
The version of ts-jest we were using was given a warning that it did
not support TypeScript 5, even though it was working fine. The latest
version of ts-jest adds official support for TypeScript and removes the
warning.
2023-04-05 11:49:20 +02:00
Koen Vlaswinkel
d9b362ddff Add simple error handling to external API usage extraction 2023-04-05 11:33:00 +02:00
Sam Partington
56b36baa82 Move config file to right place in relation to node_modules
https://github.com/github/vscode-codeql/pull/2268#pullrequestreview-1371042057

Still need to consider how to ensure that the extension picks
up the right config.
2023-04-05 10:26:43 +01:00
Koen Vlaswinkel
e37da4f6a4 Small clean-up of MethodRow 2023-04-05 11:22:57 +02:00
Koen Vlaswinkel
8ec753fb6c Extract supported percentage calculation to separate file 2023-04-05 11:21:17 +02:00
Koen Vlaswinkel
e300b40ee5 Rename MethodRow parameters to be in line with type 2023-04-05 11:15:05 +02:00
Koen Vlaswinkel
4b54679ee9 Add simple unit test for BQRS decoding to external API usages 2023-04-05 11:14:04 +02:00
Koen Vlaswinkel
d51ff42ab3 Extract external API usage from BQRS in the extension 2023-04-05 11:03:31 +02:00
Koen Vlaswinkel
8741ba9379 Rename externalApiInfo to signature 2023-04-05 10:57:35 +02:00
Koen Vlaswinkel
115b807b23 Initialize query storage dir in data extension module 2023-04-05 10:55:07 +02:00
Koen Vlaswinkel
7baf11f6c0 Split the data extensions editor domain models file 2023-04-05 10:50:23 +02:00
Sam Partington
b51d731b70 Add missing trailing newline 2023-04-04 16:56:41 +01:00
Sam Partington
fa8ad791cf Fix markdown in testing.md 2023-04-04 16:14:27 +01:00
Sam Partington
404ad65f92 Fix markdown in test-plan.md 2023-04-04 16:08:47 +01:00
Sam Partington
7a48cc0dc6 Fix violations in releasing doc 2023-04-04 16:01:42 +01:00
Sam Partington
c86dcafd2e Fix generic links 2023-04-04 15:59:57 +01:00
Sam Partington
767f9934e9 Lint the whole codebase, not just the extension folders 2023-04-04 15:58:20 +01:00
Nora
9015a57732 Merge pull request #2261 from github/nora/repo-states-refactoring
Repo States: Extract read/write methods to repo states store
2023-04-04 14:45:09 +02:00
Koen Vlaswinkel
7f65122adb Add generating of flow model to data extension editor
This adds the automatic generation of sources/sinks/summary flows to the
data extension editor using the flow model queries. This is based on the
Python script available in the CodeQL repo.

See: https://github.com/github/codeql/blob/main/java/ql/src/utils/modelgenerator/GenerateFlowModel.py
2023-04-04 13:54:35 +02:00
Koen Vlaswinkel
06cf608ed4 Add link to example usage in data extensions editor
This will allow a user to click on the number of usages to jump to an
example usage in the code.
2023-04-04 13:47:10 +02:00
Sam Partington
ec17cbd8a9 Indent images to show markdownlint they're part of the list 2023-04-04 12:45:19 +01:00
Sam Partington
7ba52de3fe Give link some non-generic text 2023-04-04 12:38:35 +01:00
Koen Vlaswinkel
ef7ee9ef3d Load existing data extension YAML in editor
This loads in the existing data extension YAML file for the selected
database. It only supports the filename we save it to, and will not load
it from any other data extension YAML files.
2023-04-04 13:37:34 +02:00
Sam Partington
5ddd2b385a Disable rule for a couple of specific instances 2023-04-04 12:35:48 +01:00
Koen Vlaswinkel
6d133f800f Add saving of data extension editor table to YAML
This adds the ability to save the modeled methods in the data extensions
editor to a YAML file named after the database name. It will save it to
the `ql` submodule for now. Support for data extension packs will be
added later.
2023-04-04 13:32:52 +02:00
Sam Partington
cc091eec47 Fix list style
We may want to disable this rule, but the change is worthwhile
here for consistency
2023-04-04 12:31:12 +01:00
Sam Partington
888b9b8aa6 Ensure markdownlint can find config when run as script 2023-04-04 12:29:54 +01:00
Sam Partington
1fb4ebe18a Ignore certain linting rules 2023-04-04 12:25:15 +01:00
Sam Partington
03638f5558 Install markdownlint VSCode extension, CLI and github config
cf https://github.com/github/markdownlint-github
2023-04-04 12:24:58 +01:00
Koen Vlaswinkel
73bd6d696c Show external API calls in data extensions editor
This updates the view of the data extensions editor to show a table of
possible sources/sinks/flow summaries that can be edited. It's not yet
possible to save the changes or load the existing file.
2023-04-04 13:17:16 +02:00
Koen Vlaswinkel
60e39636e7 Merge pull request #2262 from github/koesie10/data-extension-editor-setup
Add empty data extension editor view
2023-04-04 12:52:41 +02:00
Koen Vlaswinkel
478c095d65 Add empty data extension editor view
This adds an empty data extension editor view which is only available
behind the `codeQL.dataExtensions.editor` and `codeQL.canary` settings.
2023-04-04 12:14:19 +02:00
Koen Vlaswinkel
35cb1137e8 Merge pull request #2258 from github/koesie10/upgrade-storybook
Upgrade Storybook for TS 5.0 compatibility
2023-04-04 11:30:19 +02:00
Nora
2464537467 Extract read/write to extra file 2023-04-04 09:00:14 +00:00
Koen Vlaswinkel
78337543df Upgrade Storybook for TS 5.0 compatibility
This upgrades Storybook to an alpha version to ensure we can start
Storybook when using TypeScript 5.0. This is temporary until we can
upgrade to Storybook 7 or to a released version of 6.5.17.
2023-04-03 15:26:19 +02:00
Koen Vlaswinkel
0af341407c Merge pull request #2168 from github/koesie10/react-strict-mode
Enable React strict mode
2023-04-03 11:13:04 +02:00
Koen Vlaswinkel
de521e8e48 Merge pull request #2252 from github/dependabot/npm_and_yarn/extensions/ql-vscode/typescript-5.0.2
Bump typescript from 4.6.4 to 5.0.2 in /extensions/ql-vscode
2023-04-03 11:08:39 +02:00
Koen Vlaswinkel
0015a59971 Merge pull request #2254 from github/dependabot/npm_and_yarn/extensions/ql-vscode/ts-loader-9.4.2
Bump ts-loader from 8.1.0 to 9.4.2 in /extensions/ql-vscode
2023-04-03 11:06:28 +02:00
Koen Vlaswinkel
fce8f87c10 Update types for updated TypeScript 2023-04-03 10:54:58 +02:00
Koen Vlaswinkel
2eb420b656 Merge branch 'main' into koesie10/react-strict-mode 2023-04-03 10:47:29 +02:00
Koen Vlaswinkel
980e27a6ca Merge pull request #2167 from github/koesie10/react-18
Upgrade to React 18
2023-04-03 10:47:20 +02:00
Koen Vlaswinkel
e997dab8cf Merge branch 'main' into koesie10/react-18 2023-04-03 10:14:38 +02:00
Koen Vlaswinkel
64503770e0 Merge pull request #2255 from github/koesie10/results-view-regression-unit-test
Add simple regression unit test for the results view
2023-04-03 10:14:26 +02:00
Dave Bartolomeo
4bba53d5ad Merge pull request #2246 from github/dbartol/debug-extension-packs
Move extension pack resolution into `LocalQueries`
2023-03-31 14:36:35 -04:00
Dave Bartolomeo
b67e3b7c35 Merge pull request #2245 from github/dbartol/local-queries-commands
Move `LocalQueries` commands to be member functions
2023-03-31 14:31:44 -04:00
Koen Vlaswinkel
cb2b4f432a Reduce nesting in if-statement 2023-03-31 16:13:22 +02:00
Koen Vlaswinkel
b4b020800e Use getErrorMessage 2023-03-31 13:52:46 +02:00
Koen Vlaswinkel
918fb75fe3 Better error message and check for results info 2023-03-31 13:52:21 +02:00
Koen Vlaswinkel
d5610c1a6f Add simple regression unit test for the results view
This adds a really simple regression unit test for the results view
which checks that the results view can render a SARIF file. This is
in preparation for the upgrade to React 18 to ensure that we don't
break the basic functionality of the results view.
2023-03-31 13:48:10 +02:00
Dave Bartolomeo
6e51d81a9b Merge branch 'main' into dbartol/local-queries-commands 2023-03-30 10:33:43 -04:00
Dave Bartolomeo
0da5aab1e9 Merge branch 'main' into dbartol/debug-extension-packs 2023-03-30 10:33:16 -04:00
Dave Bartolomeo
dd9f6bf185 Merge pull request #2244 from github/dbartol/debug-context
Refactor local query evaluation to prepare for debug adapter
2023-03-30 10:23:11 -04:00
Dave Bartolomeo
110f5f9d07 Merge remote-tracking branch 'origin/main' into dbartol/debug-context 2023-03-30 10:09:08 -04:00
dependabot[bot]
9058814fcf Bump ts-loader from 8.1.0 to 9.4.2 in /extensions/ql-vscode
Bumps [ts-loader](https://github.com/TypeStrong/ts-loader) from 8.1.0 to 9.4.2.
- [Release notes](https://github.com/TypeStrong/ts-loader/releases)
- [Changelog](https://github.com/TypeStrong/ts-loader/blob/main/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/ts-loader/compare/v8.1.0...v9.4.2)

---
updated-dependencies:
- dependency-name: ts-loader
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-30 14:00:11 +00:00
dependabot[bot]
875f894741 Bump typescript from 4.6.4 to 5.0.2 in /extensions/ql-vscode
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.6.4 to 5.0.2.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v4.6.4...v5.0.2)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-30 13:58:59 +00:00
Dave Bartolomeo
c6309a9800 Show warning instead of error when using extension packs with legacy query server 2023-03-30 09:53:33 -04:00
Koen Vlaswinkel
8a4f2837e2 Merge pull request #2249 from github/koesie10/improve-monitor-error-message
Improve monitor error message
2023-03-30 11:40:38 +02:00
Robert
1e004514ea Merge pull request #2237 from github/robertbrignull/use_app_commands_6
Convert call sites to use typed commands (part 6): createVSCodeCommandManager in tests
2023-03-30 10:30:26 +01:00
Dave Bartolomeo
aef836f9b1 Move LocalQueries commands to be member functions 2023-03-29 18:20:11 +00:00
Dave Bartolomeo
41e0702d3a Update extensions/ql-vscode/src/run-queries-shared.ts
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2023-03-29 14:15:05 -04:00
Koen Vlaswinkel
0bf01274e8 Merge pull request #2248 from github/koesie10/fail-vsce-workflow-on-failure
Fail VSCE workflow on failure
2023-03-29 16:00:22 +02:00
Koen Vlaswinkel
91af71dbb6 Merge pull request #2247 from github/koesie10/use-gh-release-create
Use gh release create instead of deprecated actions
2023-03-29 16:00:07 +02:00
Koen Vlaswinkel
b06d935256 Improve monitor error message
This will improve the error message shown when monitoring fails. Instead
of showing "Error while monitoring variant analysis: Not Found", this
will now show "Error while monitoring variant analysis "Empty block
(javascript) [29/3/2023 10:45:10]: Not Found". This should make it
easier for the user to figure out which query history item is
problematic.

We're not using the full query history item label here because that
would require access to the query history item, which we don't yet have
here. Adding it here would add a dependency on the query history, which
seems undesirable.
2023-03-29 14:43:07 +02:00
Koen Vlaswinkel
70aa6df6c4 Fail VSCE workflow on failure
We were ignoring errors coming from `vsce publish` and this was causing
the workflow to succeed even when the publish failed. This will remove
the `||` and let the workflow fail if the publish fails.
2023-03-29 12:56:41 +02:00
Koen Vlaswinkel
58a1e27e64 Use gh release create instead of deprecated actions 2023-03-29 12:09:34 +02:00
Dave Bartolomeo
c712b2999c Merge branch 'dbartol/debug-context' of https://github.com/github/vscode-codeql into dbartol/debug-context 2023-03-28 18:52:38 -04:00
Dave Bartolomeo
d84baedb52 Use default value for id parameter of createQueryRun() 2023-03-28 18:51:19 -04:00
Dave Bartolomeo
a8cd9c2abb Fix bad param reference 2023-03-28 18:46:27 -04:00
Dave Bartolomeo
62cd4e3c64 Move extension pack resolution into LocalQueries
This way the debug configuration will be able to override it.
2023-03-28 18:26:33 -04:00
Dave Bartolomeo
24ecd6feb8 Update extensions/ql-vscode/src/run-queries-shared.ts
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2023-03-28 18:24:54 -04:00
Dave Bartolomeo
a00db34999 Mock CancellationToken slightly better 2023-03-28 17:24:00 -04:00
Dave Bartolomeo
f247687dd9 Better encapsulation of LocalQueryRun 2023-03-28 13:19:04 -04:00
Dave Bartolomeo
39e7caa972 Fix feedback 2023-03-28 12:59:27 -04:00
Dave Bartolomeo
2cb329bf03 Remove redundant check for custom log directory 2023-03-28 12:56:35 -04:00
Dave Bartolomeo
258cb55de0 Fix the _other_ typo 2023-03-28 12:52:49 -04:00
Dave Bartolomeo
b358f11e62 Fix integration tests on Windows 2023-03-28 12:05:58 -04:00
Dave Bartolomeo
fb7a0c80e4 Fix typo 2023-03-28 11:32:07 -04:00
Dave Bartolomeo
bf0af78d9f Remove unnecessary spread operator 2023-03-28 11:28:09 -04:00
Dave Bartolomeo
5251f06c0a Add comment about QueryOutputDir as a base class of QueryEvaluationInfo 2023-03-28 11:26:47 -04:00
Shati Patel
e6efac0a92 Open correct tutorial workspace on Windows (#2240) 2023-03-28 15:26:10 +01:00
Robert
92d66c6297 Merge pull request #2234 from github/robertbrignull/use_app_commands_4_alt
Convert call sites to use typed commands (part 4): cleanDatabases
2023-03-28 15:18:00 +01:00
Robert
1043448222 Add types to command runners 2023-03-28 14:56:23 +01:00
Dave Bartolomeo
1acf31232e Fix test expectation 2023-03-27 13:44:03 -04:00
Dave Bartolomeo
8c3fbb80b5 Fix test code 2023-03-27 13:20:29 -04:00
Dave Bartolomeo
4ddf1c2c1a Merge remote-tracking branch 'origin/main' into dbartol/debug-context 2023-03-27 16:09:25 +00:00
Dave Bartolomeo
348e9231e3 Use LocalQueryRun in LocalQueries 2023-03-27 11:48:31 -04:00
Dave Bartolomeo
543bada323 Add comments 2023-03-27 11:00:34 -04:00
Andrew Eisenberg
23f783beef Merge pull request #2238 from github/aeisenberg/restart-lang-server 2023-03-24 15:56:09 -07:00
Dave Bartolomeo
4019e6c9dd Fix test code 2023-03-24 18:37:10 -04:00
Dave Bartolomeo
d004f206f7 Move UI-related code from QueryRunner into LocalQueries 2023-03-24 18:32:16 -04:00
Dave Bartolomeo
f99f465365 Refactor query evaluation code to separate UI concerns 2023-03-24 17:27:53 -04:00
Andrew Eisenberg
2e0023fb3c Restart language server on command
Ensure that the language server is restarted when the "Restart
Query Server" command is invoked.
2023-03-24 10:22:14 -07:00
Robert
a27f58d489 Convert tests that call real commands to use createVSCodeCommandManager 2023-03-24 17:05:02 +00:00
Robert
1e4672bb4c Merge pull request #2236 from github/robertbrignull/update_codeql_pack_lock
Commit autogenerated changes to codeql-pack.lock.yml
2023-03-24 16:37:55 +00:00
Robert
aecccf1af8 Commit autogenerated changes 2023-03-24 16:26:04 +00:00
Robert
d35ab77aaf Merge pull request #2235 from github/robertbrignull/use_app_commands_5
Convert call sites to use typed commands (part 5): VariantAnalysisView
2023-03-24 14:45:21 +00:00
Robert
93436ad610 Convert extensions/ql-vscode/src/variant-analysis/variant-analysis-view.ts to call typed commands 2023-03-24 14:10:19 +00:00
Robert
d4a8eb9834 Merge pull request #2229 from github/robertbrignull/use_app_commands_3
Convert call sites to use typed commands (part 3)
2023-03-24 13:07:16 +00:00
Robert
d5fd39f9f8 Convert cleanDatabases to not use commands 2023-03-24 11:55:57 +00:00
Robert
3bdf6c5225 Merge branch 'main' into robertbrignull/use_app_commands_3 2023-03-24 11:41:16 +00:00
Nora
cd03002f42 Merge pull request #2231 from github/nora/rename-query-history-serialization
Rename query history read and write methods
2023-03-24 12:13:24 +01:00
Nora
3b42b6720d Rename to readQueryHistoryFromFile 2023-03-24 11:00:52 +00:00
Robert
92f50afb19 Merge pull request #2230 from github/robertbrignull/activate_extension
Use undefined instead of Record<string, never> type when unable to activate extension
2023-03-24 10:37:12 +00:00
Robert
b14ebc6f2b Remove ExtensionContext argument from VSCodeMockGitHubApiServer 2023-03-24 10:33:18 +00:00
Koen Vlaswinkel
7c74764367 Merge pull request #2225 from github/dependabot/npm_and_yarn/extensions/ql-vscode/glob-9.3.2
Bump glob from 7.2.0 to 9.3.2 in /extensions/ql-vscode
2023-03-24 11:28:15 +01:00
Robert
091216f6fe Update error message 2023-03-24 10:23:30 +00:00
Robert
1326c0a9dc Remove unnecessary checks 2023-03-24 10:23:19 +00:00
Koen Vlaswinkel
1c8eb33a0e Remove glob-promise and upgrade to glob 9
The `glob` package now uses promises in version 9, so we don't need the
separate `glob-promise` package anymore.

This also updates one call site to use `cwd` instead of `join` to
avoid possible issues due to a breaking change in version 8 which treats
Windows path separators differently. By changing the `cwd`, we should
not run into these issues.

Removing the `resolutions` of `glob-parent` did not change the
`package-lock.json`, so this does not have any effect on the package
version we are using.
2023-03-24 10:45:17 +01:00
Nora
76ef7ff5b7 Rename read and write methods 2023-03-24 09:36:27 +00:00
dependabot[bot]
a7b3e3d31e Bump glob from 7.2.0 to 9.3.2 in /extensions/ql-vscode
Bumps [glob](https://github.com/isaacs/node-glob) from 7.2.0 to 9.3.2.
- [Release notes](https://github.com/isaacs/node-glob/releases)
- [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/node-glob/compare/v7.2.0...v9.3.2)

---
updated-dependencies:
- dependency-name: glob
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-24 08:16:52 +00:00
Charis Kyriakou
331c92e0dd Merge pull request #2223 from github/dependabot/npm_and_yarn/extensions/ql-vscode/fs-extra-and-types/fs-extra-11.1.1
Bump fs-extra and @types/fs-extra in /extensions/ql-vscode
2023-03-24 08:15:02 +00:00
Robert
1b9a7f89c3 Remove Record<string, never> type when activating extension 2023-03-23 17:31:32 +00:00
Charis Kyriakou
770ec51810 Remove unnecessary mock setup 2023-03-23 16:47:03 +00:00
Robert
a630663681 Convert extensions/ql-vscode/src/variant-analysis/variant-analysis-monitor.ts to call typed commands 2023-03-23 16:35:36 +00:00
Charis Kyriakou
c9e0618884 Merge pull request #2224 from github/dependabot/npm_and_yarn/extensions/ql-vscode/msw-1.2.0
Bump msw from 0.49.0 to 1.2.0 in /extensions/ql-vscode
2023-03-23 16:30:00 +00:00
Charis Kyriakou
b65790b22b Deal with request with no body 2023-03-23 16:14:11 +00:00
Elena Tanasoiu
1d3d8da063 Merge pull request #2227 from github/elena/disable-local-retry
Only retry tests in CI
2023-03-23 16:13:30 +00:00
Robert
7b53c471b6 Convert extensions/ql-vscode/src/variant-analysis/variant-analysis-manager.ts to call typed commands 2023-03-23 16:04:17 +00:00
Robert
fc3bce8d41 Convert extensions/ql-vscode/src/variant-analysis/export-results.ts to call typed commands 2023-03-23 16:03:20 +00:00
Robert
b7edf1efec Convert extensions/ql-vscode/src/query-server/queryserver-client.ts to call typed commands 2023-03-23 15:58:22 +00:00
Charis Kyriakou
8641b83506 Rename SetupServerApi to SetupServer 2023-03-23 15:56:53 +00:00
Koen Vlaswinkel
2a0fd46952 Merge branch 'koesie10/react-18' into koesie10/react-strict-mode 2023-03-23 16:54:49 +01:00
Koen Vlaswinkel
d4464c8662 Merge remote-tracking branch 'origin/main' into koesie10/react-18 2023-03-23 16:53:17 +01:00
Robert
f84bf2dba0 Convert extensions/ql-vscode/src/mocks/vscode-mock-gh-api-server.ts to call typed commands 2023-03-23 15:53:12 +00:00
Robert
6b3a235a77 Convert extensions/ql-vscode/src/log-insights/summary-language-support.ts to call typed commands 2023-03-23 15:53:12 +00:00
Elena Tanasoiu
07c79058af Merge branch 'main' into elena/disable-local-retry 2023-03-23 15:36:33 +00:00
Elena Tanasoiu
c882a9fc14 Only retry tests in CI
We introduced this change to help with reducing flakiness in CI [1].

This has a slightly different effect locally, where every failed test
will output three times.

This in turn makes it harder to read, especially when you have multiple
failing tests.

Since the original intent for this behaviour was to be used in CI, I'm
proposing we disable it when the CI env variable isn't set.

I've opted to set it for all jobs involving tests, just for consistency.
I'm happy to limit it to just the places where it's required.

[1]: https://github.com/github/vscode-codeql/pull/2059
2023-03-23 15:28:51 +00:00
Robert
d56a986cc5 Merge pull request #2222 from github/robertbrignull/use_app_commands_2
Convert call sites to use typed commands (part 2): QueryHistoryManager
2023-03-23 15:07:31 +00:00
Koen Vlaswinkel
16b9abed43 Merge pull request #2220 from github/koesie10/update-unique-command-use-typed-commands
Add support for typed commands to CodeQL query
2023-03-23 16:00:33 +01:00
Charis Kyriakou
7837f3077c Merge pull request #2221 from github/dependabot/npm_and_yarn/extensions/ql-vscode/octokit/plugin-throttling-5.0.1
Bump @octokit/plugin-throttling from 4.3.2 to 5.0.1 in /extensions/ql-vscode
2023-03-23 14:25:55 +00:00
Robert
180b84b3da Use correct variable name 2023-03-23 14:25:15 +00:00
dependabot[bot]
53067f8249 Bump msw from 0.49.0 to 1.2.0 in /extensions/ql-vscode
Bumps [msw](https://github.com/mswjs/msw) from 0.49.0 to 1.2.0.
- [Release notes](https://github.com/mswjs/msw/releases)
- [Changelog](https://github.com/mswjs/msw/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mswjs/msw/compare/v0.49.0...v1.2.0)

---
updated-dependencies:
- dependency-name: msw
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-23 14:02:27 +00:00
dependabot[bot]
faec3cda5d Bump fs-extra and @types/fs-extra in /extensions/ql-vscode
Bumps [fs-extra](https://github.com/jprichardson/node-fs-extra) and [@types/fs-extra](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/fs-extra). These dependencies needed to be updated together.

Updates `fs-extra` from 10.0.1 to 11.1.1
- [Release notes](https://github.com/jprichardson/node-fs-extra/releases)
- [Changelog](https://github.com/jprichardson/node-fs-extra/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jprichardson/node-fs-extra/compare/10.0.1...11.1.1)

Updates `@types/fs-extra` from 9.0.6 to 11.0.1
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/fs-extra)

---
updated-dependencies:
- dependency-name: fs-extra
  dependency-type: direct:production
  update-type: version-update:semver-major
- dependency-name: "@types/fs-extra"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-23 14:00:56 +00:00
dependabot[bot]
de0a8bf94d Bump @octokit/plugin-throttling in /extensions/ql-vscode
Bumps [@octokit/plugin-throttling](https://github.com/octokit/plugin-throttling.js) from 4.3.2 to 5.0.1.
- [Release notes](https://github.com/octokit/plugin-throttling.js/releases)
- [Commits](https://github.com/octokit/plugin-throttling.js/compare/v4.3.2...v5.0.1)

---
updated-dependencies:
- dependency-name: "@octokit/plugin-throttling"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-23 13:59:20 +00:00
Robert
c84c69f529 Convert extensions/ql-vscode/src/vscode-utils/external-files.ts to call typed commands 2023-03-23 13:49:11 +00:00
Robert
a9e495118c Convert extensions/ql-vscode/src/query-history/query-history-manager.ts to call typed commands 2023-03-23 13:49:11 +00:00
Robert
2e7952cb37 Pull tryOpenExternalFile out to a separate file so it can be more easily tested 2023-03-23 13:49:11 +00:00
Robert
6bcfdda0a9 Merge pull request #2217 from github/robertbrignull/use_app_commands_1
Convert call sites to use typed commands (part 1)
2023-03-23 13:18:49 +00:00
Robert
e0dd8c7392 Add comment about codeQLDatabases.focus 2023-03-23 13:04:30 +00:00
Koen Vlaswinkel
164536338b Merge pull request #2219 from github/koesie10/fix-command-runner-references
Remove remaining references to `commandRunner`
2023-03-23 14:03:39 +01:00
Koen Vlaswinkel
f57bfb6875 Add support for typed commands to CodeQL query
This adds support for detecting the `CommandManager.execute` method in
the unique command use query.

This may not be the best way to implement this. There's a method
`hasUnderlyingType` on `this.getReceiver().getType()`, but I couldn't
really figure out how to get it recognize `CommandManager`. It might be
possible if we can construct the type of `CommandManager`, but this will
probably include the filepath to the `CommandManager` class, which might
not neccessarily be something we want: moving the `CommandManager` class
should not require updating the query. I'm very happy to hear other
suggestions.
2023-03-23 13:55:52 +01:00
Koen Vlaswinkel
d0c4e5b8c5 Remove remaining references to commandRunner 2023-03-23 13:30:06 +01:00
Koen Vlaswinkel
96c9a4aca7 Merge pull request #2215 from github/koesie10/rename-command-runner
Rename and move `commandRunner`
2023-03-23 13:20:49 +01:00
Robert
14dc391229 Convert extensions/ql-vscode/src/legacy-query-server/queryserver-client.ts to call typed commands 2023-03-23 11:42:14 +00:00
Robert
d7e061e159 Convert extensions/ql-vscode/src/databases/ui/db-panel.ts to use typed commands 2023-03-23 11:42:14 +00:00
Robert
2a2cb26597 Convert extensions/ql-vscode/src/test-ui.ts to call typed commands 2023-03-23 11:42:14 +00:00
Robert
ff418b5487 Convert extensions/ql-vscode/src/query-editor.ts to call typed commands 2023-03-23 11:42:14 +00:00
Robert
8b9003e845 Convert extensions/ql-vscode/src/local-databases.ts to call typed commands 2023-03-23 11:42:12 +00:00
Robert
c394b7c4f0 Convert extensions/ql-vscode/src/helpers.ts to call typed commands 2023-03-23 11:42:09 +00:00
Robert
ddf5b3aac2 Convert extensions/ql-vscode/src/databaseFetcher.ts to call typed commands 2023-03-23 11:42:06 +00:00
github-actions[bot]
75634b3654 Bump version to v1.8.2 (#2218) 2023-03-23 11:39:09 +00:00
Shati Patel
4c7c1cb0e6 v1.8.1 (#2216)
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
2023-03-23 11:00:29 +00:00
Robert
13c3c8efe4 Convert extensions/ql-vscode/src/cli.ts to call typed commands 2023-03-23 10:49:48 +00:00
Robert
a3c4c8fb61 Merge pull request #2212 from github/robertbrignull/app_executeCommand
Replace app.executeCommand with app.commands.execute
2023-03-23 10:28:36 +00:00
Koen Vlaswinkel
73b0a0565f Merge pull request #2214 from github/koesie10/remove-command-runner-with-progress
Remove `commandRunnerWithProgress`
2023-03-23 11:26:20 +01:00
Koen Vlaswinkel
aa268cfc5f Rename and move commandRunner
The `commandRunner` name doesn't really make sense since it doesn't
"run" a command, but rather registers a command. This renames it
to `registerCommandWithErrorHandling` and moves it to the
`common/vscode` directory.
2023-03-23 11:14:44 +01:00
Robert
8fbde9fba1 Limit setContext keys 2023-03-23 10:12:20 +00:00
Koen Vlaswinkel
aca0489fdc Remove commandRunnerWithProgress
The `commandRunnerWithProgress` is unused because all commands have been
converted to using `commandRunner` in combination with `withProgress`.
2023-03-23 11:09:32 +01:00
Koen Vlaswinkel
dae472ca05 Merge pull request #2213 from github/koesie10/check-for-updates-typed-command
Add `codeQL.checkForUpdatesToCLI` type for command
2023-03-23 10:49:18 +01:00
Koen Vlaswinkel
20f85f2b81 Merge pull request #2210 from github/koesie10/base-typed-commands
Convert some base commands to typed commands
2023-03-23 10:03:53 +01:00
Koen Vlaswinkel
81cce9fa8b Add codeQL.checkForUpdatesToCLI type for command
The `codeQL.checkForUpdatesToCLI` command is registered pre-activation,
and we don't really want to create the command manager before
activation, so this will just add the correct type without registering
it using the command manager.
2023-03-23 09:58:27 +01:00
Koen Vlaswinkel
a27ca2e177 Merge remote-tracking branch 'origin/main' into koesie10/base-typed-commands 2023-03-23 09:51:24 +01:00
Robert
3e9c2c85d3 Remove app.executeCommand 2023-03-22 17:13:12 +00:00
Robert
297fa2ebd3 Merge pull request #2207 from github/robertbrignull/extension_commands
Start using app.commands.execute for all commands called from extension.ts
2023-03-22 16:59:53 +00:00
Shati Patel
844e58a1b1 Tidy up recent changelog entries (#2211) 2023-03-22 16:54:17 +00:00
Robert
9948b93b76 Merge branch 'main' into robertbrignull/extension_commands 2023-03-22 16:35:56 +00:00
Koen Vlaswinkel
e1d5a4ddaa Merge remote-tracking branch 'origin/main' into koesie10/base-typed-commands 2023-03-22 17:22:26 +01:00
Koen Vlaswinkel
7059f46141 Merge pull request #2209 from github/koesie10/query-editor-typed-commands
Convert query editing commands to typed commands
2023-03-22 17:21:31 +01:00
Koen Vlaswinkel
fe6ff6801a Convert some base commands to typed commands 2023-03-22 17:02:16 +01:00
Koen Vlaswinkel
be3459c1aa Convert query editing commands to typed commands 2023-03-22 16:52:59 +01:00
Koen Vlaswinkel
5ac5de8a5b Move query editing commands to separate file 2023-03-22 16:50:44 +01:00
Koen Vlaswinkel
322c1a8835 Merge pull request #2206 from github/koesie10/test-ui-typed-commands
Convert test UI commands to typed commands
2023-03-22 16:42:18 +01:00
Robert
5d6a2e6d7f rename types 2023-03-22 15:37:39 +00:00
Robert
0e79b92829 Merge branch 'main' into robertbrignull/extension_commands 2023-03-22 15:36:31 +00:00
Koen Vlaswinkel
59378daff3 Merge remote-tracking branch 'origin/main' into koesie10/test-ui-typed-commands 2023-03-22 16:29:36 +01:00
Koen Vlaswinkel
125af1139b Merge pull request #2208 from github/koesie10/mock-server-typed-commands
Convert mock API server commands to typed commands
2023-03-22 16:28:28 +01:00
Robert
6afdf6357b Merge pull request #2202 from github/robertbrignull/extract_progress
Move withProgress and associated code to a separate file
2023-03-22 15:19:50 +00:00
Koen Vlaswinkel
fd7013f754 Convert mock API server commands to typed commands 2023-03-22 16:04:49 +01:00
Robert
408c042b3b Fix remaining imports 2023-03-22 14:49:04 +00:00
Koen Vlaswinkel
b2fceb9b2d Merge pull request #2205 from github/koesie10/results-view-typed-commands
Convert results view commands to typed commands
2023-03-22 15:46:08 +01:00
Robert
819e596b9b Merge branch 'main' into robertbrignull/extract_progress 2023-03-22 14:31:55 +00:00
Robert
31af28e73b Add link to docs 2023-03-22 14:28:10 +00:00
Koen Vlaswinkel
c6d8a09f19 Add support for Partial in the command manager
The command manager types didn't fully support commands defined with
`Partial` because it deduced that the command function was `undefined`
when the function was not defined. However, if the command is not
present, the command registration will not be called. This fixes the
types by specifying that the command definition will never be
`undefined`.
2023-03-22 15:27:18 +01:00
Robert
39d4675b44 Start using app.commands.execute for all commands called from extension.ts 2023-03-22 14:16:55 +00:00
Koen Vlaswinkel
e74a2e4a15 Remove UIService
This class seems to have been introduced at some point to reduce the
dependency on VS Code from the test UI service. However, none of its
methods are being used anymore, and by using typed commands we have
already reduced the dependency on VS Code. Therefore, we can simply
remove this class.
2023-03-22 15:14:22 +01:00
Koen Vlaswinkel
9f85f56055 Convert test UI commands to typed commands 2023-03-22 15:13:05 +01:00
Koen Vlaswinkel
ac57f5005d Convert results view commands to typed commands 2023-03-22 15:06:15 +01:00
Koen Vlaswinkel
88a9ecbeab Merge pull request #2204 from github/koesie10/summary-language-support-typed-commands
Convert summary language commands to typed commands
2023-03-22 14:52:45 +01:00
Koen Vlaswinkel
9f7c7b2ed8 Merge pull request #2203 from github/koesie10/ast-viewer-typed-commands
Convert AST viewer commands to typed commands
2023-03-22 14:44:04 +01:00
Koen Vlaswinkel
1f8070c8b5 Convert summary language commands to typed commands 2023-03-22 14:26:06 +01:00
Koen Vlaswinkel
bc29231fec Convert AST viewer commands to typed commands 2023-03-22 14:11:43 +01:00
Koen Vlaswinkel
e724577d82 Merge pull request #2196 from github/koesie10/ast-cfg-typed-commands
Convert AST and CFG commands to typed commands
2023-03-22 13:32:34 +01:00
Robert
b914b97be7 Pull progress to separate file 2023-03-22 12:07:16 +00:00
Koen Vlaswinkel
9d4b19f91f Merge remote-tracking branch 'origin/main' into koesie10/ast-cfg-typed-commands 2023-03-22 13:03:21 +01:00
Koen Vlaswinkel
8a66bb4017 Merge pull request #2198 from github/koesie10/packaging-typed-commands
Convert packaging to typed commands
2023-03-22 13:02:21 +01:00
Robert
e55fb8c7a7 Merge pull request #2191 from github/robertbrignull/variant_analysis_commands
Convert all variant analysis commands to typed commands
2023-03-22 11:56:31 +00:00
Robert
a6fefdbabb Merge branch 'main' into robertbrignull/variant_analysis_commands 2023-03-22 11:44:25 +00:00
Robert
2334e4e7b2 Merge pull request #2192 from github/robertbrignull/export_selected_results_command
Move codeQL.exportSelectedVariantAnalysisResults to query history manager
2023-03-22 11:41:13 +00:00
Koen Vlaswinkel
5c06bcc6bd Merge remote-tracking branch 'origin/main' into koesie10/packaging-typed-commands 2023-03-22 12:39:36 +01:00
Koen Vlaswinkel
3240809d11 Merge pull request #2200 from github/koesie10/restart-typed-command
Convert codeQL.restartQueryServer to a typed command
2023-03-22 12:37:20 +01:00
Koen Vlaswinkel
3e66e7aaf3 Merge remote-tracking branch 'origin/main' into koesie10/restart-typed-command 2023-03-22 12:10:54 +01:00
Koen Vlaswinkel
71831fe460 Merge pull request #2201 from github/koesie10/eval-log-viewer-typed-command
Convert codeQLEvalLogViewer.clear to a typed command
2023-03-22 12:07:34 +01:00
Robert
0983733a67 fix typo 2023-03-22 10:51:03 +00:00
Robert
0166f9a557 Merge branch 'main' into robertbrignull/variant_analysis_commands 2023-03-22 10:50:17 +00:00
Robert
5af0ebcb24 convert to type imports 2023-03-22 10:49:50 +00:00
Koen Vlaswinkel
9d6c78b656 Merge branch 'main' into koesie10/ast-cfg-typed-commands 2023-03-22 11:37:23 +01:00
Koen Vlaswinkel
56c83eb480 Merge pull request #2195 from github/koesie10/move-database-commands
Move remaining local database commands to databases UI
2023-03-22 11:36:56 +01:00
Koen Vlaswinkel
aa0d011daa Convert codeQLEvalLogViewer.clear to a typed command 2023-03-22 11:34:39 +01:00
Koen Vlaswinkel
76558b8d41 Merge pull request #2194 from github/koesie10/typed-local-query-commands
Convert local query commands to typed commands
2023-03-22 11:34:34 +01:00
Koen Vlaswinkel
eb5659a628 Merge branch 'main' into koesie10/move-database-commands 2023-03-22 11:22:48 +01:00
Koen Vlaswinkel
11b4de1820 Merge branch 'main' into koesie10/typed-local-query-commands 2023-03-22 11:20:02 +01:00
Koen Vlaswinkel
2c8c7cec8f Convert codeQL.restartQueryServer to a typed command 2023-03-22 10:29:09 +01:00
Koen Vlaswinkel
1c6d9f3f22 Use commandRunner for codeQL.restartQueryServer 2023-03-22 10:26:29 +01:00
Elena Tanasoiu
f196e34fa5 Merge pull request #2188 from github/elena/force-workspace-in-codespace
Codespace: Open tutorial workspace on extension start
2023-03-22 08:30:31 +00:00
Koen Vlaswinkel
7c7a64ca5b Convert packaging commands to typed commands 2023-03-22 09:22:07 +01:00
Koen Vlaswinkel
dfff7ae8de Move packaging commands to withProgress 2023-03-22 09:22:07 +01:00
Koen Vlaswinkel
ef267f87bb Move packaging command registration to separate file 2023-03-22 09:22:07 +01:00
Elena Tanasoiu
a7800ce3bc Merge branch 'main' into elena/force-workspace-in-codespace 2023-03-22 07:46:19 +00:00
github-actions[bot]
168af11e00 Bump CLI version from v2.12.4 to v2.12.5 for integration tests (#2197)
Co-authored-by: github-actions[bot] <github-actions@github.com>
2023-03-21 16:27:58 +00:00
Koen Vlaswinkel
17bab1c09c Remove unnecessary viewAst function 2023-03-21 16:10:05 +01:00
Koen Vlaswinkel
b3092be5d3 Convert AST and CFG commands to typed commands 2023-03-21 16:09:15 +01:00
Koen Vlaswinkel
1909fee91f Remove use of commandRunnerWithProgress in AST and CFG commands 2023-03-21 16:04:41 +01:00
Koen Vlaswinkel
6ff2670ec2 Remove duplication of AST and CFG command implementations 2023-03-21 16:02:05 +01:00
Koen Vlaswinkel
0379575256 Move AST and CFG commands to separate file 2023-03-21 15:58:12 +01:00
Elena Tanasoiu
8fd9ebf2d8 Limit comparison to Uri path
We attempted to specify exactly which URI we're expecting here.

However, `Uri.parse` behaves differently in the test than it does in
the code so we've inadvertently created a flakey test [1]. The URI we
generate in the test has a `scheme: 'c'` while the one in the code has
a `scheme: 'C'` property.

This only happens on windows, not ubuntu.

Let's narrow the comparison to just the path of the URI.

[1]: https://github.com/github/vscode-codeql/actions/runs/4478429334/jobs/7871178529#step:7:231
2023-03-21 14:26:22 +00:00
Koen Vlaswinkel
bed56ef648 Make public methods private in local databases UI
Some of the methods in the `DatabaseUI` were public because they were
used in the `extension.ts` file. We have moved these method calls into
this file, so they do not need to be public anymore. We can also get rid
of the separation between some of these methods, so I've moved them into
the function that calls them.
2023-03-21 14:50:24 +01:00
Koen Vlaswinkel
7ab986fabe Move codeQL.chooseDatabaseGithub command 2023-03-21 14:48:14 +01:00
Koen Vlaswinkel
15d30d5342 Move codeQL.chooseDatabaseInternet command 2023-03-21 14:47:26 +01:00
Koen Vlaswinkel
71f22b9a7a Move codeQL.chooseDatabaseArchive command 2023-03-21 14:45:54 +01:00
Koen Vlaswinkel
32b6ad53cf Move codeQL.chooseDatabaseFolder command 2023-03-21 14:44:46 +01:00
Koen Vlaswinkel
ac2f4475c0 Group local database commands by type 2023-03-21 14:40:04 +01:00
Elena Tanasoiu
108943d135 existsSync -> pathExists
Use async version of file check.
2023-03-21 13:19:33 +00:00
Gulshan Singh
bb0c53d65d Display EntityValue labels in CSV export (#2170) 2023-03-21 11:59:18 +00:00
Nora
82d03091d0 Merge pull request #2193 from github/nora/query-history-data-model
Move query-serialization
2023-03-21 12:23:18 +01:00
Elena Tanasoiu
c1a515ed82 Open tutorial before extension activation
To reduce lag when checking for the existence of the tutorial workspace.
2023-03-21 11:20:14 +00:00
Elena Tanasoiu
0368d537ad Ask the user for permission to reload workspace
To make this a nicer experience for the user, we're adding a prompt
to let them know we're about to reload the workspace.
2023-03-21 11:20:14 +00:00
Elena Tanasoiu
7059802a25 Add more logging before attempting to open tutorial workspace 2023-03-21 11:20:14 +00:00
Elena Tanasoiu
0f4fcdf676 Add comment with PR description
This adds the explanation from the PR description in a comment and
removes comment that's no longer helpful.
2023-03-21 11:20:14 +00:00
Elena Tanasoiu
ce413a6385 Stub isCodespaceTemplate correctly
Now that we fixed our expectation in the previous commit, we could see we
were stubbing this to false instead of true.

So now the test is checking the right scenario.
2023-03-21 11:20:13 +00:00
Elena Tanasoiu
8db9f52df3 Adjust the rest of the test expectations
Our expectation was quite narrow: we expect to not call an `openFolder`
command. We didn't specify any params for it, which might mean this
expectation wasn't working like it should.

Let's just check that `executeCommand` isn't called at all.
2023-03-21 11:20:13 +00:00
Elena Tanasoiu
782e413c64 Add workspace filepath to test expectation 2023-03-21 11:20:13 +00:00
Elena Tanasoiu
fade710f95 Call it commandSpy everywhere 2023-03-21 11:20:13 +00:00
Elena Tanasoiu
737a1f5c37 Use existing file path consistently 2023-03-21 11:19:56 +00:00
Koen Vlaswinkel
7950c1c982 Convert local query commands to typed commands
The local query commands are using a separate logger, and this is not
supported by the command manager because it is quite specific to this
extension. Therefore, we create a separate command manager which uses
a different logger to separate the commands.
2023-03-21 12:08:44 +01:00
Koen Vlaswinkel
f37a6c5e9e Convert commandRunnerWithProgress to commandRunner 2023-03-21 12:08:44 +01:00
Koen Vlaswinkel
649179f62e Rename local queries manager variable names 2023-03-21 12:08:44 +01:00
Koen Vlaswinkel
8a2630d1b7 Move local queries commands to separate file 2023-03-21 12:08:44 +01:00
Nora
fa29bcc5fd Rename serializer 2023-03-21 11:03:58 +00:00
Nora
5cd50a67e7 Move query-serialization 2023-03-21 10:39:02 +00:00
Koen Vlaswinkel
f7b6d4c4a4 Merge pull request #2189 from github/koesie10/typed-local-database-ui-commands
Convert local database commands to typed commands
2023-03-21 10:39:57 +01:00
Koen Vlaswinkel
58bffe1edf Merge remote-tracking branch 'origin/main' into koesie10/typed-local-database-ui-commands 2023-03-21 10:27:31 +01:00
Robert
0c9df6edba Convert the codeQL.openVariantAnalysisView command 2023-03-20 17:41:23 +00:00
Robert
ac0d920156 Convert the codeQL.loadVariantAnalysisRepoResults command 2023-03-20 17:41:23 +00:00
Robert
5f2a8fa1d5 Convert the codeQL.autoDownloadVariantAnalysisResult command 2023-03-20 17:41:21 +00:00
Robert
b55910d2b9 Convert the codeQL.monitorVariantAnalysis command 2023-03-20 17:32:35 +00:00
Robert
e586f3de53 Move codeQL.exportSelectedVariantAnalysisResults to query history manager 2023-03-20 16:59:51 +00:00
Robert
08849c1df4 Convert codeQL.copyVariantAnalysisRepoList command 2023-03-20 16:50:53 +00:00
Robert
aa64459353 Convert existing variant analysis commands to bind(this) 2023-03-20 16:50:53 +00:00
Robert
3c229d244e Merge pull request #2186 from github/robertbrignull/export_results_telemetry
Add telemetry for exporting variant analysis results
2023-03-20 16:47:49 +00:00
Robert
fb70382929 Fix tests to not reference deleted command 2023-03-20 16:33:55 +00:00
Robert
f49314f6f3 Merge branch 'main' into robertbrignull/export_results_telemetry 2023-03-20 15:46:41 +00:00
Koen Vlaswinkel
9044d11d2b Merge pull request #2190 from github/koesie10/typed-new-database-panel-commands
Convert new database panel to typed commands
2023-03-20 16:25:04 +01:00
Elena Tanasoiu
5444a9e55e Fail gracefully if we can't set up code tour
We're running this at the extension start-up. We don't want it to block the extension
from completing activation, so let's swallow any errors from the code tour and output
them, instead of letting this affect the rest of the extension activation.
2023-03-20 15:01:04 +00:00
Elena Tanasoiu
4fa3c459a1 Open tutorial workspace on extension start
When opening https://github.com/github/codespaces-codeql/ in a
codespace, it's easy to miss the prompt that tells you to open the
tutorial.code-workspace file.

In fact people actively dismiss the alert to get it out of the way.

If you miss that prompt, you end up with a single-rooted workspace,
which causes various other problems.

While there is an open issue to allow VS Code to open a default
workspace [1], there doesn't seem to have been any progress on it
in the last two years.

So we're taking matters into our own hands and forcing the extension
to open the tutorial workspace, if it detects it.

This will only happen if the following three conditions are met:
- the .tours folder exists
- the tutorial.code-workspace file exists
- the CODESPACES_TEMPLATE setting hasn't been set

NB: the `CODESPACES_TEMPLATE` setting can only be found if the
tutorial.code-workspace has already been opened. So it's a good
indicator that we're in the folder, but the user has ignored the prompt.

[1]: https://github.com/microsoft/vscode-remote-release/issues/3665
2023-03-20 13:31:20 +00:00
Koen Vlaswinkel
2e9a22e86d Convert new database panel to typed commands
This converts the new database panel to use typed commands. There should
be no changes in behaviour.
2023-03-20 13:52:32 +01:00
Robert
b76bef4246 Remove the codeQL.exportVariantAnalysisResults command 2023-03-20 12:33:51 +00:00
Koen Vlaswinkel
e603de41c1 Convert local database commands to typed commands 2023-03-20 11:39:53 +01:00
Koen Vlaswinkel
dbd832f1a0 Switch local databases to function definitions
The local databases UI was essentially the only class which was defining
methods using assignment to a class property rather than using function
definitions and binding them. This switches it to use function
definitions and binding, which is more consistent with the rest of the
codebase.
2023-03-20 11:29:45 +01:00
Robert
5b2093df8f Merge pull request #2185 from github/robertbrignull/remove_internal_commands
Remove two more internal-only commands
2023-03-20 10:24:31 +00:00
Koen Vlaswinkel
af63e5094f Convert commandRunnerWithProgress invocations to withProgress 2023-03-20 11:19:32 +01:00
Robert
94db1dff73 Remove codeQL.openVariantAnalysisQueryText command 2023-03-17 16:13:21 +00:00
Robert
a44ecadae5 Add telemetry for exporting variant analysis results 2023-03-17 16:09:00 +00:00
Robert
a375afd61b Remove codeQL.cancelVariantAnalysis command 2023-03-17 15:48:00 +00:00
Charis Kyriakou
42ce27b112 Merge pull request #2183 from github/charis/remove-primer
Remove primer packages and make styled-components a top-level dependency
2023-03-17 14:46:02 +00:00
Koen Vlaswinkel
f86c0b826a Merge pull request #2176 from github/koesie10/query-history-commands-typed
Convert query history commands to typed commands
2023-03-17 15:28:21 +01:00
Charis Kyriakou
2d46365406 Add styled-components as a top level dependency 2023-03-17 14:19:22 +00:00
Charis Kyriakou
50e89ba1a3 Remove primer packages 2023-03-17 13:46:43 +00:00
Charis Kyriakou
7914403da0 Wire up data flow paths view (#2182) 2023-03-17 13:30:32 +00:00
Koen Vlaswinkel
5be08d7c92 Revert change to context menu name 2023-03-17 12:29:25 +01:00
Robert
df24a705b0 Merge pull request #2179 from github/robertbrignull/remove_openVariantAnalysisQueryFile_command
Remove codeQL.openVariantAnalysisQueryFile command
2023-03-17 11:23:31 +00:00
Koen Vlaswinkel
fce51ca9a2 Convert query history commands to typed commands 2023-03-17 10:54:40 +01:00
Charis Kyriakou
8a5273058b Add new data flow paths view (empty) (#2172) 2023-03-17 09:25:03 +00:00
Koen Vlaswinkel
f3274b39d2 Merge pull request #2015 from github/dependabot/npm_and_yarn/extensions/ql-vscode/glob-promise-6.0.2
Bump glob-promise from 4.2.2 to 6.0.2 in /extensions/ql-vscode
2023-03-17 09:49:53 +01:00
Koen Vlaswinkel
38e551bb2a Merge pull request #1930 from github/dependabot/npm_and_yarn/extensions/ql-vscode/tar-stream-3.0.0
Bump tar-stream from 2.2.0 to 3.0.0 in /extensions/ql-vscode
2023-03-17 09:48:52 +01:00
dependabot[bot]
cc53cd54c4 Bump webpack-cli from 4.6.0 to 5.0.1 in /extensions/ql-vscode (#2181)
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 4.6.0 to 5.0.1.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.6.0...webpack-cli@5.0.1)

---
updated-dependencies:
- dependency-name: webpack-cli
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-16 09:38:00 -07:00
Robert
61cc9191f9 Merge pull request #2139 from github/robertbrignull/webview_error_telemetry
Add listeners for unhandled errors to web views
2023-03-16 11:18:52 +00:00
Robert
f2f1b1d6a3 Collect common messages 2023-03-16 10:59:02 +00:00
Robert
64531f5a6f Check undefined instead of using typeof 2023-03-16 10:54:29 +00:00
Robert
29bb7ce01e Emit telemetry when opening variant analysis query file 2023-03-16 10:39:02 +00:00
Robert
9045253624 Merge pull request #2178 from github/robertbrignull/split-commands/codeQLQueryHistory.openQuery
Split up codeQLQueryHistory.openQuery command
2023-03-15 17:12:06 +00:00
Robert
34ab409050 Remove codeQL.openVariantAnalysisQueryFile command 2023-03-15 17:06:17 +00:00
Robert
e6f543670a Split up codeQLQueryHistory.openQuery command 2023-03-15 16:54:46 +00:00
Robert
04c24d0996 Merge pull request #2177 from github/robertbrignull/split-commands/codeQLQueryHistory.removeHistoryItem
Split up the codeQLQueryHistory.removeHistoryItem command
2023-03-15 16:54:24 +00:00
Koen Vlaswinkel
41ca0ffba6 Merge pull request #2175 from github/dependabot/npm_and_yarn/extensions/ql-vscode/lint-staged-13.2.0
Bump lint-staged from 10.2.11 to 13.2.0 in /extensions/ql-vscode
2023-03-15 17:16:03 +01:00
Robert
84f60ccb8c Avoid duplicate use of the codeQLQueryHistory.removeHistoryItem command 2023-03-15 16:11:40 +00:00
dependabot[bot]
0fa0fa3523 Bump tar-stream from 2.2.0 to 3.0.0 in /extensions/ql-vscode
Bumps [tar-stream](https://github.com/mafintosh/tar-stream) from 2.2.0 to 3.0.0.
- [Release notes](https://github.com/mafintosh/tar-stream/releases)
- [Commits](https://github.com/mafintosh/tar-stream/compare/v2.2.0...v3.0.0)

---
updated-dependencies:
- dependency-name: tar-stream
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-15 16:10:41 +00:00
dependabot[bot]
fe554ee2a7 Bump glob-promise from 4.2.2 to 6.0.2 in /extensions/ql-vscode
Bumps [glob-promise](https://github.com/ahmadnassri/node-glob-promise) from 4.2.2 to 6.0.2.
- [Release notes](https://github.com/ahmadnassri/node-glob-promise/releases)
- [Commits](https://github.com/ahmadnassri/node-glob-promise/compare/v4.2.2...v6.0.2)

---
updated-dependencies:
- dependency-name: glob-promise
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-15 16:09:35 +00:00
Koen Vlaswinkel
019af98f40 Merge pull request #2171 from github/koesie10/commands-with-progress
Convert run variant analysis command to new commands package
2023-03-15 16:39:35 +01:00
Koen Vlaswinkel
c853bafb91 Merge remote-tracking branch 'origin/main' into koesie10/commands-with-progress 2023-03-15 15:43:34 +01:00
Robert
c632c38220 Merge pull request #2087 from github/robertbrignull/no-nested-functions
Avoid having functions that aren't at the top level in extension.ts
2023-03-15 14:21:23 +00:00
Robert
fd570abdcd Merge branch 'main' into robertbrignull/no-nested-functions 2023-03-15 13:37:35 +00:00
Robert
e81d585336 Swap arguments so command arg comes last 2023-03-15 13:36:57 +00:00
Anders Starcke Henriksen
dc55ef9985 Merge pull request #2157 from github/starcke/commands-registration
Commands registration
2023-03-15 14:05:25 +01:00
Robert
3fe069975a Avoid reporting errors twice 2023-03-15 12:26:58 +00:00
Anders Starcke Henriksen
5303ec67cb Name updates. 2023-03-15 12:04:52 +01:00
Robert
969fdb6337 Make type checking all use typeof 2023-03-15 10:21:25 +00:00
Robert
47fa752c5c Merge branch 'main' into robertbrignull/webview_error_telemetry 2023-03-15 09:56:58 +00:00
dependabot[bot]
639c8728dd Bump lint-staged from 10.2.11 to 13.2.0 in /extensions/ql-vscode
Bumps [lint-staged](https://github.com/okonet/lint-staged) from 10.2.11 to 13.2.0.
- [Release notes](https://github.com/okonet/lint-staged/releases)
- [Commits](https://github.com/okonet/lint-staged/compare/v10.2.11...v13.2.0)

---
updated-dependencies:
- dependency-name: lint-staged
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-15 09:22:59 +00:00
Koen Vlaswinkel
3d9f55ffea Merge pull request #2174 from github/dependabot/npm_and_yarn/extensions/ql-vscode/webpack-5.76.0
Bump webpack from 5.73.0 to 5.76.0 in /extensions/ql-vscode
2023-03-15 10:20:43 +01:00
dependabot[bot]
ebd18cd245 Bump webpack from 5.73.0 to 5.76.0 in /extensions/ql-vscode
Bumps [webpack](https://github.com/webpack/webpack) from 5.73.0 to 5.76.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.73.0...v5.76.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-15 02:21:22 +00:00
Robert
7571304fb2 Move viewAst to top level 2023-03-14 17:57:23 +00:00
Robert
764830e69d Move runVariantAnalysis to top level 2023-03-14 17:55:35 +00:00
Robert
9d59abd0a8 Move openReferencedFile to top level 2023-03-14 17:53:50 +00:00
Robert
165542d115 Move previewQueryHelp to top level 2023-03-14 17:51:57 +00:00
Robert
d8371708b3 Move compileAndRunQueryOnMultipleDatabases to top level 2023-03-14 17:49:58 +00:00
Robert
c3f4a012a9 Move DatabaseQuickPickItem to top level 2023-03-14 17:49:07 +00:00
Robert
e2e197f4d9 Move compileAndRunQuery to top level 2023-03-14 17:46:37 +00:00
Robert
c366342f95 Move showResultsForCompletedQuery to top level 2023-03-14 17:43:58 +00:00
Robert
b05977516e Move showResultsForComparison to top level 2023-03-14 17:43:07 +00:00
Andrew Eisenberg
444de8cc3d Merge pull request #2072 from github/aeisenberg/mrva-extension-packs
Inject extension pack dependencies into MRVA packs
2023-03-14 10:41:35 -07:00
Robert
ee759abea9 Move installOrUpdateThenTryActivate to top level 2023-03-14 17:40:39 +00:00
Robert
a8f67d72f5 Move getDistributionDisplayingDistributionWarnings to top level 2023-03-14 17:38:36 +00:00
Robert
118be4a19a Move installOrUpdateDistribution to top level 2023-03-14 17:36:30 +00:00
Robert
8d3ae78db2 Move installOrUpdateDistributionWithProgressTitle to top level 2023-03-14 17:34:10 +00:00
Robert
ada5f51e85 Move codeQlVersionRange to top level 2023-03-14 17:31:11 +00:00
Robert
82f4941415 Move shouldUpdateOnNextActivationKey to top level 2023-03-14 17:30:49 +00:00
Robert
23e1715c4a Move DistributionUpdateConfig to top level 2023-03-14 17:27:48 +00:00
Andrew Eisenberg
250dc15fe5 Add extension packs to variant analysis queries
This change allows the `codeQL.runningQueries.useExtensionPacks`
setting to be respected when running variant analysis queries. When
set to `all`, before uploading the generated query pack, all extension
packs in the workspace will be injected as dependencies into the qlpack
file.
2023-03-14 08:55:01 -07:00
Koen Vlaswinkel
db967443dd Remove viewLoaded callback comment
This removes the comment about the `viewLoaded` callback since it refers
to upgrade instructions.
2023-03-14 16:12:48 +01:00
Koen Vlaswinkel
b888ca07ae Extract variable for React root 2023-03-14 16:10:32 +01:00
Koen Vlaswinkel
c3b023cf4b Convert run variant analysis command to new commands package 2023-03-14 13:09:31 +01:00
Koen Vlaswinkel
52b00fe434 Merge branch 'main' into starcke/commands-registration 2023-03-14 12:55:25 +01:00
Koen Vlaswinkel
64d97aaf7e Merge pull request #2165 from github/koesie10/simpler-progress-task
Simpler `withProgress` calls
2023-03-14 12:06:59 +01:00
Koen Vlaswinkel
964640c757 Remove default location values in withProgress calls 2023-03-14 11:00:59 +01:00
Koen Vlaswinkel
d437ebe215 Merge branch 'koesie10/react-18' into koesie10/react-strict-mode 2023-03-14 10:48:28 +01:00
Koen Vlaswinkel
36eb2cd2ea Fix concurrency bug in results view
In the results view, `setState` was used to set some state, and then
`loadResults` was called to set some other state. However, `setState`
is asynchronous, so the `this.state` in `loadResults` was not the state
that was set before the call.

This commit fixes it by combining the two `setState` calls into one. The
logic was hard to follow, so I'm not sure if this is the correct fix.
The `shouldKeepOldResultsWhileRendering` state seems to be unnecessary
now since everything is being done in `setState` call, but I'm not sure
about that.
2023-03-14 10:27:04 +01:00
Koen Vlaswinkel
605315c70d Mock CSS.supports in view tests 2023-03-14 10:27:04 +01:00
Koen Vlaswinkel
4a295098e5 Upgrade @primer packages
The version of `@primer/react` we were using didn't have the correct
types for the `ThemeProvider`. By upgrading these packages to their
latest versions, all types are correct.
2023-03-14 10:02:22 +01:00
Koen Vlaswinkel
3d354e1fb4 Merge pull request #2164 from github/koesie10/unify-command-runners
Unify `commandRunner` implementations
2023-03-14 09:54:16 +01:00
Koen Vlaswinkel
d92708e4a4 Merge pull request #2166 from github/koesie10/remove-babel-loader
Remove direct dependency on babel-loader
2023-03-14 09:54:06 +01:00
Dave Bartolomeo
6c3698bfb3 Merge pull request #2169 from github/dbartol/tee-logger
Use `TeeLogger` instead of `additionalLogLocation:` option
2023-03-13 17:49:13 -04:00
Dave Bartolomeo
a1d8aac391 Better handling of I/O errors when writing to side log 2023-03-13 17:34:53 -04:00
Dave Bartolomeo
56095d365c Fix test code 2023-03-13 17:28:53 -04:00
Dave Bartolomeo
fc8b13b8be Use TeeLogger instead of additionalLogLocation: option 2023-03-13 15:10:30 -04:00
Koen Vlaswinkel
9b1dee6314 Enable React strict mode
This enables React strict mode which will print extra warnings to the
console when we use certain constructs incorrectly. This does not affect
production builds.

See https://beta.reactjs.org/reference/react/StrictMode
2023-03-13 16:41:26 +01:00
Koen Vlaswinkel
e949b96057 Upgrade to React 18 2023-03-13 16:38:58 +01:00
Koen Vlaswinkel
3aa24ebb2c Remove direct dependency on babel-loader
The extension Webpack config does not use `babel-loader`, so we can
remove it as a direct dependency. `babel-loader` is still included in
our `node_modules` because Storybook depends on it, but the version is
now completely managed by Storybook rather than us.
2023-03-13 16:17:23 +01:00
Andrew Eisenberg
205327d8aa Merge pull request #2162 from github/aeisenberg/variant-analysis-tests 2023-03-13 07:37:26 -07:00
Koen Vlaswinkel
4969a08531 Make progress options optional
This will make the progress options passed to `withProgress` optional by
moving it to be the second argument and setting a default value for the
`location`. This will make it much easier to use from a variety of
commands.
2023-03-13 15:13:55 +01:00
Koen Vlaswinkel
2646716261 Remove args from ProgressTask
This removes the `args` from the `ProgressTask` passed to
`withProgress`. The `args` is only used by the
`commandRunnerWithProgress` and can easily be replaced by an anonymous
function that passes the `args` instead. This will simplify the
`ProgressTask` interface and make it easier to use.
2023-03-13 14:51:32 +01:00
Anders Starcke Henriksen
79d15cc602 Add comments. 2023-03-13 14:36:28 +01:00
Koen Vlaswinkel
a7bb74190f Unify commandRunner implementations
The `commandRunnerWithProgress` implementation isn't actually any
different from `commandRunner`, except for the call to `withProgress`
and support for an `outputLogger` argument. Therefore, this will simply
make `commandRunnerWithProgress` a wrapper around `commandRunner`,
removing quite some duplication in the process.
2023-03-13 14:10:00 +01:00
Anders Starcke Henriksen
d990f316d1 Fix tests. 2023-03-13 12:16:38 +01:00
Andrew Eisenberg
fe123b3187 Inject extension pack dependencies into MRVA packs
If the user requests that extension packs be included in their MRVA run,
then do the following:

1. Search the workspace for all extension packs
2. Add each extension pack as an explicit and direct dependency on
   the generated pack.

It is ok to use `*` as a dependency since we are guaranteed that
exactly one version of each injected extension pack dependency is
available when the pack is being compiled.

If we find multiple paths to an extension pack of the same name, this
is an error since it is ambiguous which path to use.
2023-03-10 11:15:36 -08:00
Andrew Eisenberg
5d85da5526 Refactor generateQueryPack
Creates a handful of new functions and adds documentation. This commit
has no behavioural changes.
2023-03-10 11:15:36 -08:00
Andrew Eisenberg
b3e642a2b4 Remove any references 2023-03-10 11:11:25 -08:00
Andrew Eisenberg
0d8df9ad88 Merge pull request #2065 from github/aeisenberg/run-with-all-data-extensions
Add ability to run query with data extensions
2023-03-10 08:09:19 -08:00
Koen Vlaswinkel
2457d4bd9d Remove command manager argument to variant analysis view 2023-03-10 16:56:06 +01:00
Koen Vlaswinkel
df86adbbfa Split variant analysis and extension commands 2023-03-10 16:49:30 +01:00
Koen Vlaswinkel
e97ffd2f27 Use command manager executeCommand 2023-03-10 16:37:20 +01:00
Koen Vlaswinkel
088e9aa958 Add command manager to app 2023-03-10 16:35:22 +01:00
Robert
e3d8dbc484 Merge pull request #2147 from github/robertbrignull/release-indenting
Fix indenting for sub-lists
2023-03-10 11:41:54 +00:00
Robert
6daa780fbe Merge branch 'main' into robertbrignull/release-indenting 2023-03-10 10:48:11 +00:00
Robert
c0f3adc5ff Merge pull request #2156 from github/robertbrignull/remoteResultsItemWithoutLogs
Introduce cancelledRemoteResultsItemWithoutLogs context value
2023-03-10 10:39:26 +00:00
Robert
0ab482a389 Merge branch 'main' into robertbrignull/remoteResultsItemWithoutLogs 2023-03-10 10:29:47 +00:00
Koen Vlaswinkel
103017d717 Merge pull request #2150 from github/koesie10/no-node-modules-copy
Do not copy `node_modules` when packaging
2023-03-10 10:34:00 +01:00
Koen Vlaswinkel
9048dfd251 Merge pull request #2151 from github/koesie10/packaging-error-message
Add check for error message for packaging.test.ts
2023-03-10 10:33:51 +01:00
Koen Vlaswinkel
807069e0c1 Merge pull request #2148 from github/koesie10/commands-package
Add commands package inside src directory
2023-03-10 10:32:32 +01:00
Nora
1fa976757c Merge pull request #2153 from github/nora/remove-unnecessary-activation-events
Remove unnecessary commands from `activationEvents`
2023-03-10 10:23:10 +01:00
Nora
694dcea49a Merge pull request #2154 from github/nora/split-commands-b
Extension Telemetry: Split `viewCfg`,`quickEval`, `openReferencedFile` command
2023-03-10 10:22:33 +01:00
Nora
83d14501fd Merge pull request #2142 from github/nora/split-commands-a
Extension Telemetry: Split `runVariantAnalysis` and `viewAst` command
2023-03-10 10:22:22 +01:00
Koen Vlaswinkel
555d99ca33 Merge branch 'main' into koesie10/commands-package 2023-03-10 10:19:58 +01:00
Koen Vlaswinkel
9dc3df74bb Merge branch 'main' into koesie10/no-node-modules-copy 2023-03-10 10:19:57 +01:00
Koen Vlaswinkel
877d11dbe6 Merge branch 'main' into koesie10/packaging-error-message 2023-03-10 10:19:41 +01:00
Nora
c0c7574891 Split openReferencedFile command 2023-03-10 08:55:55 +00:00
Nora
4fda4f71dd Split quickEval command 2023-03-10 08:55:54 +00:00
Nora
6356149e54 Split viewCfg command 2023-03-10 08:55:54 +00:00
Nora
7f32439786 split viewAst command 2023-03-10 08:55:33 +00:00
Nora
27434862c3 split runVariantAnalysis command 2023-03-10 08:55:33 +00:00
Nora
275c16d5b0 Remove codeQLDatabases.chooseDatabase command 2023-03-10 08:54:36 +00:00
Nora
5586a02b44 Remove not necessary commands from activation event 2023-03-10 08:54:36 +00:00
Andrew Eisenberg
baba68d0df Add back variant analysis tests
This commit adds back the variant analysis tests that were inadvertently
deleted after this commit

82ada54103/extensions/ql-vscode/src/vscode-tests/cli-integration/remote-queries/run-remote-query.test.ts (L67)

They are not identical to the removed tests. I refactored them so that
there is a single test function invoked three times with different
parameters.
2023-03-09 15:53:13 -08:00
Andrew Eisenberg
790a152f42 Merge branch 'main' into aeisenberg/run-with-all-data-extensions 2023-03-09 09:42:30 -08:00
Andrew Eisenberg
1db2bc048a Merge pull request #2159 from github/github-action/bump-cli
Bump CLI Version to v2.12.4 for integration tests
2023-03-09 08:17:19 -08:00
Charis Kyriakou
d9917cbe8b Fix date of last release on changelog (#2158) 2023-03-09 15:58:24 +00:00
Andrew Eisenberg
2bd9c8a732 Merge pull request #2149 from github/aeisenberg-patch-1
Add security experimental queries
2023-03-09 07:49:27 -08:00
github-actions[bot]
c8ec661dce Bump CLI version from v2.12.3 to v2.12.4 for integration tests 2023-03-09 15:47:48 +00:00
Charis Kyriakou
1158dfdb89 Merge pull request #2155 from github/version/bump-to-v1.8.1
Bump version to v1.8.1
2023-03-09 15:27:30 +00:00
Anders Starcke Henriksen
61974a7664 Register concrete command from extension. 2023-03-09 16:25:11 +01:00
Robert
155b83b540 Introduce remoteResultsItemWithoutLogs context value 2023-03-09 14:35:10 +00:00
github-actions[bot]
bc8d07bc33 Bump version to v1.8.1 2023-03-09 14:22:57 +00:00
Anders Starcke Henriksen
d87911a803 Basic implementation of command manager. 2023-03-09 14:15:27 +01:00
Koen Vlaswinkel
2d5c339e0e Add check for error message for packaging.test.ts
This will add a check to ensure that `showAndLogExceptionWithTelemetry`
is not called when downloading packs. This expectation is placed before
the check for `showAndLogInformationMessage` so that when the test
fails, the error message will be shown.
2023-03-09 11:16:04 +01:00
Koen Vlaswinkel
d151b2f5f9 Do not copy node_modules when packaging
We are no longer including our dependencies in the VSIX package, so we
can tell VSCE that we don't want it to look at dependencies using
`--no-dependencies`. If we do this, VSCE doesn't require the
`node_modules` directory anymore and we can skip that step, which will
make building significantly faster.

I've confirmed that there are no changes between the two options by
building the extension both without and with the change. This is the
diff of the two outputs (using `diff -r`):

```diff
diff --color -r vscode-codeql-1.8.0-dev.2023.3.8.15.10.13/extension/package.json vscode-codeql-old/extension/package.json
7c7
<   "version": "1.8.0-dev.2023.3.8.15.10.13",
---
>   "version": "1.8.0-dev.2023.3.8.15.6.51",
diff --color -r vscode-codeql-1.8.0-dev.2023.3.8.15.10.13/extension.vsixmanifest vscode-codeql-old/extension.vsixmanifest
4c4
< 			<Identity Language="en-US" Id="vscode-codeql" Version="1.8.0-dev.2023.3.8.15.10.13" Publisher="GitHub" />
---
> 			<Identity Language="en-US" Id="vscode-codeql" Version="1.8.0-dev.2023.3.8.15.6.51" Publisher="GitHub" />
```

The only difference is the version number, which is expected.
2023-03-08 16:18:55 +01:00
Andrew Eisenberg
7bc6276115 Update .github/codeql/codeql-config.yml
Co-authored-by: Charis Kyriakou <charisk@users.noreply.github.com>
2023-03-08 07:10:53 -08:00
Andrew Eisenberg
a5021dc4c9 Add security experimental queries 2023-03-08 07:08:30 -08:00
Koen Vlaswinkel
77dd9bff94 Add commands package inside src directory 2023-03-08 15:35:14 +01:00
Charis Kyriakou
56111b39fc Merge pull request #2146 from github/v1.8.0
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
v1.8.0
2023-03-08 13:48:14 +00:00
Robert
0b6d828fa0 Fix indenting for sub-lists 2023-03-08 13:25:38 +00:00
Charis Kyriakou
d22be729be v1.8.0 2023-03-08 13:22:40 +00:00
Charis Kyriakou
9490642522 Merge pull request #2144 from github/charisk/mrva-public-beta
Prepare for MRVA public beta
2023-03-08 12:21:40 +00:00
Charis Kyriakou
643c106fbd Add controller repo 'learn more' link 2023-03-07 16:41:04 +00:00
Charis Kyriakou
9a308f6602 Update CHANGELOG to include MRVA 2023-03-07 16:41:04 +00:00
Charis Kyriakou
582c917541 Update README to include MRVA 2023-03-07 16:41:04 +00:00
Charis Kyriakou
e3625c982f MRVA execution not behind canary 2023-03-07 16:41:04 +00:00
Charis Kyriakou
6f37f176e4 MRVA repositories panel not behind canary 2023-03-07 16:41:04 +00:00
Charis Kyriakou
90b0911ed3 Update release process to lock/unlock the main branch (#2143) 2023-03-07 15:06:43 +00:00
Charis Kyriakou
84506d7340 Merge pull request #2141 from github/charisk/docs-tidy
Tidy up docs
2023-03-07 15:06:03 +00:00
Robert
d8c2562bb1 Move listener registration to webview.tsx 2023-03-07 15:05:49 +00:00
Charis Kyriakou
d480056c68 Move test plan near other docs 2023-03-07 11:40:12 +00:00
Charis Kyriakou
c3d28e395c Move testing docs to separate file 2023-03-07 11:37:00 +00:00
Charis Kyriakou
840cfbf3f6 Move releasing docs to separate doc file 2023-03-07 11:33:46 +00:00
Koen Vlaswinkel
d3466c3a72 Merge pull request #2136 from github/koesie10/upgrade-to-husky-8
Upgrade to Husky 8
2023-03-07 10:16:36 +01:00
Andrew Eisenberg
0ecde78d6e Fix test comments 2023-03-06 18:05:38 -08:00
Andrew Eisenberg
e07208b089 Merge remote-tracking branch 'upstream/main' into aeisenberg/run-with-all-data-extensions 2023-03-06 15:10:19 -08:00
Robert
7176f690f3 Add listeners for unhandled errors to web views 2023-03-06 17:22:06 +00:00
Charis Kyriakou
22aa77ff4c Fix VS Marketplace badge (#2138) 2023-03-06 16:00:49 +00:00
Koen Vlaswinkel
a6f189b144 Upgrade to Husky 8 2023-03-06 11:21:19 +01:00
Alexander Eyers-Taylor
2217d3f21f Give the LanguageClient an easier id to use. (#2135) 2023-03-03 17:26:08 +00:00
Koen Vlaswinkel
9703d10b32 Merge pull request #2122 from github/koesie10/remove-as-unknown-as-quickpickitem
Remove `as unknown as QuickPickItem`
2023-03-03 16:40:21 +01:00
Robert
53492b5202 Merge pull request #2115 from github/robertbrignull/cleanup_new_telemetry
Cleanup config to enabling new telemetry
2023-03-03 14:13:47 +00:00
Robert
082a00e81b Cleanup config to enabling new telemetry 2023-03-03 11:55:12 +00:00
Robert
e9bbf112f3 Merge pull request #2125 from github/robertbrignull/error_listener
Report unhandled errors, but only those that are from our extension
2023-03-03 11:34:31 +00:00
Robert
9386817727 Report unhandled errors from our extension 2023-03-02 17:19:40 +00:00
dependabot[bot]
68ce7c3b53 Bump actions/upload-artifact from 2 to 3 (#2133)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-02 15:03:58 +00:00
Koen Vlaswinkel
a0ba1126cb Merge pull request #2131 from github/koesie10/fix-delete-local-query
Fix error while deleting query history item
2023-03-02 14:08:26 +01:00
Koen Vlaswinkel
d574f3d94c Fix error while deleting query history item
When deleting a query history item and the "next" query is still
running, the `completedQuery` is `undefined`. This commit fixes it by
using optional chaining to ensure that the `completedQuery` is defined
before accessing its `successful` property.
2023-03-02 12:32:45 +01:00
Koen Vlaswinkel
b0cc4c28ed Merge remote-tracking branch 'origin/main' into koesie10/remove-as-unknown-as-quickpickitem 2023-03-02 12:27:31 +01:00
Koen Vlaswinkel
11b63f39b4 Merge pull request #2123 from github/koesie10/remove-unknown-database-item
Remove additional `as unknown as` for database items
2023-03-02 12:23:03 +01:00
Koen Vlaswinkel
216413e5d7 Merge pull request #2124 from github/koesie10/move-tests
Move variant analysis tests out from the CLI integration test suite
2023-03-02 12:22:39 +01:00
Charis Kyriakou
5555fcaded Merge pull request #2118 from github/charisk/variant-analysis-scrubbing
Clean up variant analyses from query history
2023-03-02 09:26:49 +00:00
Koen Vlaswinkel
68fb744eab Merge pull request #2085 from github/koesie10/fix-graphviz-wasm
Fix Graphviz WASM module not loading for graph viewer
2023-03-02 10:00:18 +01:00
Andrew Eisenberg
3de6a110ce Merge pull request #2130 from github/version/bump-to-v1.7.12
Bump version to v1.7.12
2023-03-01 13:06:10 -08:00
github-actions[bot]
dd19ebdfdb Bump version to v1.7.12 2023-03-01 19:07:38 +00:00
Andrew Eisenberg
6bbb14edd4 Merge pull request #2129 from github/v1.7.11
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
v1.7.11
2023-03-01 10:57:50 -08:00
Andrew Eisenberg
fb5675a7c5 Update extensions/ql-vscode/CHANGELOG.md
Co-authored-by: Aditya Sharad <6874315+adityasharad@users.noreply.github.com>
2023-03-01 10:42:26 -08:00
Andrew Eisenberg
82a2db9fec v1.7.11
Release prep and fix markdown linting warnings in test plan.
2023-03-01 18:33:51 +00:00
Andrew Eisenberg
25d85c3e61 Merge pull request #2128 from github/revert-2120-charisk/learn-more-controller-repo
Revert "Add controller repo 'learn more' link"
2023-03-01 09:43:20 -08:00
Andrew Eisenberg
81e6d8583a Merge pull request #2127 from github/revert-2121-charisk/mrva-public-beta
Revert "Move MRVA out of canary"
2023-03-01 09:35:42 -08:00
Andrew Eisenberg
ea9dede453 Merge pull request #2126 from github/charisk/cli-v2.12.3-hack
Hack to avoid CodeQL CLI v2.12.3
2023-03-01 09:33:21 -08:00
Charis Kyriakou
e9062551ee Revert "Add controller repo 'learn more' link (#2120)"
This reverts commit fd6cd1f2d2.
2023-03-01 17:03:24 +00:00
Charis Kyriakou
dd2e79477f Revert "Move MRVA out of canary " 2023-03-01 17:02:11 +00:00
Charis Kyriakou
e9787c2702 Hack to avoid CodeQL CLI v2.12.3 2023-03-01 16:26:49 +00:00
Koen Vlaswinkel
304330074d Add some additional safety to allowWasmEval 2023-03-01 17:17:27 +01:00
Koen Vlaswinkel
074229e2a0 Clarify some comments 2023-03-01 17:17:06 +01:00
Koen Vlaswinkel
b679c18b0b Move variant analysis results zip to be next to tests 2023-03-01 14:09:09 +01:00
Koen Vlaswinkel
c3799bdb5a Move variant analysis results manager tests to activated extension suite 2023-03-01 14:07:49 +01:00
Koen Vlaswinkel
daaeb5be3f Move some variant analysis manager test to activated extension suite 2023-03-01 14:03:00 +01:00
Koen Vlaswinkel
2b346b6873 Move variant analysis monitor tests to activated extension suite 2023-03-01 13:54:54 +01:00
Koen Vlaswinkel
1c6ecf4a5c Remove as unknown as FullDatabaseOptions 2023-03-01 13:11:32 +01:00
Koen Vlaswinkel
59cc93f94f Remove as unknown as DatabaseItem 2023-03-01 13:11:32 +01:00
Koen Vlaswinkel
db0fea3af5 Remove as unknown as QuickPickItem
This is definitely not a perfect solution since we're essentially just
moving the place where we're casting. However, because we have manually
made the types similar, this provides some type assurances where there
were none before. This also has the cast in only one place, which makes
it easier to find and fix in the future.
2023-03-01 12:21:14 +01:00
Charis Kyriakou
56d283f6d5 Merge pull request #2121 from github/charisk/mrva-public-beta
Move MRVA out of canary
2023-03-01 09:55:28 +00:00
Charis Kyriakou
fd6cd1f2d2 Add controller repo 'learn more' link (#2120) 2023-03-01 09:40:11 +00:00
Koen Vlaswinkel
b3d9804842 Only enable graph viewer in canary mode 2023-03-01 09:52:56 +01:00
Andrew Eisenberg
5843c40a37 Remove mention of search path in coment
Co-authored-by: Robert <robertbrignull@github.com>
2023-02-28 08:29:00 -08:00
Shati Patel
57a4a2f717 Merge pull request #2112 from github/github-action/bump-cli
Bump CLI Version to v2.12.3 for integration tests
2023-02-28 16:25:28 +00:00
Charis Kyriakou
ff0425d889 Update CHANGELOG to include MRVA 2023-02-28 15:02:37 +00:00
Elena Tanasoiu
5fd902257e Merge pull request #2111 from github/elena/update-tutorial-database-path
Update path to codespace tutorial database
2023-02-28 14:51:14 +00:00
Koen Vlaswinkel
d3e64539d0 Only allow WASM execution in results view 2023-02-28 15:22:23 +01:00
Charis Kyriakou
55761aa4ee Update README to include MRVA 2023-02-28 14:06:26 +00:00
Charis Kyriakou
1bf7fc148a MRVA execution not behind canary 2023-02-28 14:04:30 +00:00
Charis Kyriakou
590b839166 MRVA repositories panel not behind canary 2023-02-28 14:04:30 +00:00
Charis Kyriakou
06463a25e6 Clean up variant analyses directory 2023-02-28 13:02:37 +00:00
Charis Kyriakou
7b2ef6bf76 Pass both local queries and variant analyses dirs in query history scrubber 2023-02-28 13:02:01 +00:00
Koen Vlaswinkel
fd57133a41 Merge pull request #2103 from github/koesie10/mock-more-objects
Remove more instances of `as unknown as`
2023-02-28 13:44:41 +01:00
Nora
f39bbd325c Merge pull request #2119 from github/nora/cleanup-split-runquery
Remove new commands from command palette
2023-02-28 13:28:16 +01:00
Nora
9a53b637e8 Remove new commands from comman palette 2023-02-28 11:42:08 +00:00
Nora
eb25f31b9f Merge pull request #2117 from github/nora/split-run-query
Split usage of runQuery and runQueryOnMultipleDatabases
2023-02-28 12:26:39 +01:00
Nora
7188d8df41 reorder command 2023-02-28 11:01:44 +00:00
Robert
badbee1bfb Merge pull request #2101 from github/robertbrignull/unique-command-use-query
Add unique-command-use.ql
2023-02-28 09:15:18 +00:00
Elena Tanasoiu
2f92ea396a Merge pull request #2090 from github/elena/install-csv-depenedencies
Install dependencies for tutorial query in codespace
2023-02-27 20:24:04 +00:00
Elena Tanasoiu
1f4790bbb7 Use join as it's meant to be used
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2023-02-27 20:09:05 +00:00
Elena Tanasoiu
28abc1e3a6 Don't reparse Uri path
I was initially trying to understand why this method was failing due
to an unrelated error [1] so I ended up over-engineering the path
parsing.

We can use the path from the first workspace folder, like we do in
other places in the extension.

[1]: https://github.com/github/vscode-codeql/pull/2104
2023-02-27 20:09:05 +00:00
Elena Tanasoiu
9b7c3bc2bf Install dependencies for tutorial query in codespace
When a user goes through the Code Tour, we select a dummy `csv` database
for them to get them up and running.

Once they complete the code tour and would like to continue writing
queries, they will need to add their own database.

After they do that, we check the language of their new database and
generate a skeleton QL pack for them so that they don't need to create
these files by hand. See [1] for details.

This skeleton pack folder will be called
`codeql-custom-queries-<language>` and it comes with its own example
query: `example.ql`.

When we try to run this example query, the query gets confused about
which `dbscheme` to pick, as it sees a `qlpack.yml` file in the new
skeleton pack folder, as well as one in the existing `tutorial-lib`
folder.

So we'll need to get rid of the `tutorial-lib` folder in order to make room
for new queries to be run once the tour is complete.

This commit introduces a `handleTourDependencies` step which will
trigger a `codeql pack install` command in order to install real library
dependencies for `tutorial-queries`, since we no longer have the dummy
library in `tutorial-lib`.
2023-02-27 20:09:04 +00:00
Robert
4d73e1a068 Remove getLocationOrdinal 2023-02-27 17:46:49 +00:00
Robert
6f5ac5df4f Introduce getAUse 2023-02-27 17:45:24 +00:00
Robert
4c880dfb19 Fix typos 2023-02-27 17:42:43 +00:00
Robert
56e8d8aac7 Merge pull request #2114 from github/robertbrignull/enable_telemetry
Enable new telemetry by default
2023-02-27 16:46:41 +00:00
Robert
ced9f60949 Add documentation 2023-02-27 16:06:38 +00:00
Charis Kyriakou
4fa530d69d Check controller repo before we set it (#2116) 2023-02-27 16:01:39 +00:00
Robert
c0a65c994a Convert to alert only first usage, instead of all other usages 2023-02-27 15:54:38 +00:00
Nora
921d9d22e4 split usage of runQuery and runQueryOnMultipleDatabases 2023-02-27 15:53:00 +00:00
Robert
ead1869a7e Use PackageJson class 2023-02-27 15:30:45 +00:00
Robert
b1ddf89fe3 Update CHANGELOG.md 2023-02-27 15:23:36 +00:00
Robert
c37096bf2c Update changelog 2023-02-27 13:12:28 +00:00
Robert
4127be2905 Enable new telemetry by default 2023-02-27 13:07:10 +00:00
Charis Kyriakou
ce29768796 Minor changes to the test plan (#2113) 2023-02-27 12:59:06 +00:00
Charis Kyriakou
571d9d1424 Merge pull request #2109 from github/version/bump-to-v1.7.11
Bump version to v1.7.11
2023-02-27 11:54:51 +00:00
Koen Vlaswinkel
65e652b5e4 Fix mockResolvedValue not working with mocked objects 2023-02-27 11:59:11 +01:00
Koen Vlaswinkel
fd2b91d4d4 Remove casting to QueryHistoryConfig 2023-02-27 11:59:11 +01:00
Koen Vlaswinkel
dd4df012e9 Remove as unknown as ExtensionContext 2023-02-27 11:59:11 +01:00
Koen Vlaswinkel
af167c6d6e Remove as unknown as DatabaseManager
Unfortunately `Object.defineProperty` doesn't work on proxies, so I've
added an options object to `mockedObject` which allows passing in
methods that will return a value for a specific property.
2023-02-27 11:59:11 +01:00
Koen Vlaswinkel
551ed95fc8 Remove as unknown as QueryHistoryManager 2023-02-27 11:59:11 +01:00
Koen Vlaswinkel
9b1ca5136e Remove as unknown as WorkspaceFolder 2023-02-27 11:59:10 +01:00
Koen Vlaswinkel
fa5bad6946 Remove as unknown as TextEditor/TextDocument 2023-02-27 11:59:10 +01:00
github-actions[bot]
6229de8634 Bump CLI version from v2.12.2 to v2.12.3 for integration tests 2023-02-24 19:18:50 +00:00
Koen Vlaswinkel
4c14db951b Merge pull request #2102 from github/koesie10/mock-objects
Add new `mockedObject` function
2023-02-24 15:43:19 +01:00
Koen Vlaswinkel
bed4e8a060 Rename methods parameter to props 2023-02-24 15:28:01 +01:00
Elena Tanasoiu
2c6dc24525 Update path to codespace tutorial database
In https://github.com/github/codespaces-codeql/pull/12 we moved
the source for our tutorial database into `.tours` in order to
avoid confusing the user when we load the database into the
workspace, since they'd see two databases.

Since this is just the source, we'd like to hide it.
2023-02-23 17:08:20 +00:00
Charis Kyriakou
8d5a00dcc7 Remove obsolete config setting (#2110) 2023-02-23 16:47:30 +00:00
github-actions[bot]
3ea3cd8e9b Bump version to v1.7.11 2023-02-23 08:58:41 +00:00
Charis Kyriakou
a32b0736db Merge pull request #2108 from github/v1.7.10
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
v1.7.10
2023-02-23 08:54:39 +00:00
Charis Kyriakou
50b0926390 v1.7.10 2023-02-23 08:38:10 +00:00
Elena Tanasoiu
4be573c805 Merge pull request #2106 from github/elena/change-query
Update skeleton query
2023-02-22 12:14:23 +00:00
Elena Tanasoiu
8bf8adfc74 Fix default query for skeleton pack
We mark this query as `@kind problem`.

We'll need to change the query a bit to make it fit this type of ...
erm... kind.

This means the results view will be formatted to display the file name
next to each of the results.

We're also getting rid of any mentions of an empty block query since
that's no longer what it checks.
2023-02-22 11:57:01 +00:00
Robert
14f58df2fc Merge pull request #2107 from github/revert-2076-robertbrignull/unhandled_rejection
Revert "Add unhandled rejection listener"
2023-02-22 10:53:00 +00:00
Robert
c712b069b1 Revert "Add unhandled rejection listener" 2023-02-22 10:06:37 +00:00
Anders Starcke Henriksen
7b4b491a9d Merge pull request #2099 from github/starcke/qlpack-gen-rename
Starcke/qlpack gen rename
2023-02-21 16:34:47 +01:00
Koen Vlaswinkel
2a43ffb49a Add new mockedObject function
This will remove some instances where we're using `as unknown as T` and
replace them by a call to `mockedObject<T>()`. The `mockedObject`
function is a bit more explicit about what it does and has types which
ensure that the methods that are set on the object actually exist.

Unfortunately, we can't fully get rid of `as unknown as T` in the
`mockedObject` function. However, this construct is more localized and
does not need to be used in as many places. If we do enable an ESLint
rule to prevent the use of `as unknown as T`, I would feel comfortable
with disabling the rule for the `mockedObject` function.
2023-02-21 13:01:28 +01:00
Koen Vlaswinkel
5e51bb57f5 Merge pull request #2098 from github/koesie10/refactor-cli-arguments
Use options objects instead of multiple optional arguments in CLI methods
2023-02-21 12:55:35 +01:00
Robert
70ae7284f3 Add unique-command-use.ql 2023-02-21 11:09:15 +00:00
Charis Kyriakou
396fdb8c5b Update README files for database dirs (#2100) 2023-02-21 09:39:02 +00:00
Charis Kyriakou
51570c3ba3 Remove obsolete config settings (#2097) 2023-02-21 09:09:54 +00:00
Charis Kyriakou
403e893f93 Remove isVariantAnalysisReposPanelEnabled feature flag and old flows (#2096) 2023-02-21 08:52:50 +00:00
Anders Starcke Henriksen
ffd27d4207 Update text to reflect multiple pack names. 2023-02-21 09:41:34 +01:00
Anders Starcke Henriksen
94b81bae71 Rename qlpack.yml -> codeql-pack.yml in generator. 2023-02-21 09:40:49 +01:00
Elena Tanasoiu
61f4ce27da Merge pull request #2074 from github/elena/refactor-query-language
Consolidate the way we define query languages
2023-02-20 18:10:50 +00:00
Elena Tanasoiu
c2f7d38018 Fix spelling 2023-02-20 17:54:20 +00:00
Elena Tanasoiu
b635d914d0 Move types/query-language to common/query-language
And fix imports
2023-02-20 17:54:20 +00:00
Elena Tanasoiu
8b8912bc40 Import QueryLanguage from new file 2023-02-20 15:53:39 +00:00
Elena Tanasoiu
7a5bbb228a Move dbSchemeToLanguage into QueryLanguage file 2023-02-20 15:53:39 +00:00
Elena Tanasoiu
269af3ed23 Move constant in QueryLanguage type file 2023-02-20 15:53:39 +00:00
Elena Tanasoiu
50f50f59b4 Use new type in tests 2023-02-20 15:53:39 +00:00
Elena Tanasoiu
abbc13033d Use new type in dbSchemeToLanguage 2023-02-20 15:53:39 +00:00
Elena Tanasoiu
9508b629f5 Organise required packs by query language 2023-02-20 15:53:39 +00:00
Elena Tanasoiu
aabeba067a Replace VariantAnalysisQueryLanguage -> QueryLanguage 2023-02-20 15:53:37 +00:00
Elena Tanasoiu
73838ffc6c Introduce types folder 2023-02-20 15:48:59 +00:00
Charis Kyriakou
1ab34967a0 Merge pull request #2095 from github/version/bump-to-v1.7.10
Bump version to v1.7.10
2023-02-20 15:46:52 +00:00
Koen Vlaswinkel
0f90319691 Use an options object for runAsyncCodeQlCliCommand
This also removes the type for the `runTests` `options` argument since
it's only used in this definition and don't actually use the type
anywhere else.
2023-02-20 16:40:18 +01:00
Koen Vlaswinkel
8afdabdd53 Use an options object for runJsonCodeQlCliCommand 2023-02-20 16:37:48 +01:00
github-actions[bot]
624e24579e Bump version to v1.7.10 2023-02-20 12:27:39 +00:00
Charis Kyriakou
c6481ca6ff Merge pull request #2094 from github/v1.7.9
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
v1.7.9
2023-02-20 12:22:15 +00:00
Charis Kyriakou
3fbfa840ac v1.7.9 2023-02-20 11:58:32 +00:00
Charis Kyriakou
90ba3d4f29 Rename some files around local databases (#2093) 2023-02-20 09:46:10 +00:00
Charis Kyriakou
146f23f929 Cache schema validator for db config (#2092) 2023-02-17 15:32:00 +00:00
Koen Vlaswinkel
207c37c8de Merge pull request #2091 from github/koesie10/rename-remote-queries
Rename `remote-queries` directories to `variant-analysis`
2023-02-17 16:01:27 +01:00
Koen Vlaswinkel
9aff6ee5a9 Remove remaining references to remote-queries 2023-02-17 11:39:22 +01:00
Koen Vlaswinkel
39d91788dc Rename remote-queries directories to variant-analysis 2023-02-17 11:38:24 +01:00
Charis Kyriakou
c309bdc1b7 Unveil new variant analysis repositories panel (#2082) 2023-02-16 17:14:38 +00:00
Charis Kyriakou
f9851a3dbf Pre-select top-10 list in variant analysis repos panel (#2088) 2023-02-16 13:01:34 +00:00
Koen Vlaswinkel
1fad9f6b5e Merge pull request #2083 from github/koesie10/variant-analysis-history-item-label-tests
Add tests for variant analysis history item label
2023-02-16 11:17:57 +01:00
Elena Tanasoiu
d618a4e026 Merge pull request #2080 from github/shati-elena/fix-database-prompt
Don't offer to create skeleton pack for default database in CodeTour
2023-02-16 09:30:03 +00:00
Koen Vlaswinkel
feac82f52e Merge pull request #2084 from github/koesie10/remove-remote-queries
Remove remaining remote queries code
2023-02-16 09:57:09 +01:00
Charis Kyriakou
2c81d3cbb7 Correctly initialize App and DbManager in variant analysis tests (#2086) 2023-02-15 16:36:14 +00:00
Robert
64f1c8e0aa Merge pull request #2076 from github/robertbrignull/unhandled_rejection
Add unhandled rejection listener
2023-02-15 16:09:16 +00:00
Koen Vlaswinkel
bc51e7462b Fix Graphviz WASM module not loading for graph viewer
It seems that when we added the CSP policy to the webview, we did not
take into account that `d3-graphviz` uses `@hpcc-js/wasm` to load
Graphviz as a WASM module. This commit adds `'wasm-unsafe-eval'` to the
CSP policy to allow this.
2023-02-15 15:41:36 +01:00
Robert
2ebfea1292 Add unhandled rejection listener 2023-02-15 14:28:35 +00:00
Koen Vlaswinkel
defc3816e7 Fix test depending on user-specified label 2023-02-15 13:56:53 +01:00
Koen Vlaswinkel
6ff8aad2e9 Simplify query history type checks 2023-02-15 13:53:19 +01:00
Koen Vlaswinkel
4d1e61a94d Remove remote query text provider 2023-02-15 13:53:19 +01:00
Koen Vlaswinkel
8f9e420402 Remove remote queries types 2023-02-15 13:53:19 +01:00
Koen Vlaswinkel
6856d1b6a5 Rename exportSelectedRemoteQueryResults 2023-02-15 13:39:32 +01:00
Koen Vlaswinkel
ebe2f89ca6 Add tests for variant analysis history item label 2023-02-15 13:29:54 +01:00
Elena Tanasoiu
397be15b89 Don't offer to create skeleton pack for default database in CodeTour
This is step 3 in the Code Tour. At this point we don't need to create
the skeleton pack so let's disable that functionality.

Co-authored-by: Shati Patel <shati-patel@github.com>
2023-02-15 12:22:46 +00:00
Elena Tanasoiu
5933f097e7 Merge pull request #2078 from github/shati-elena/update-launch-json
Add an extra line for testing the codespace-codeql tour
2023-02-15 12:20:30 +00:00
Koen Vlaswinkel
0ec30ee854 Merge pull request #2079 from github/koesie10/markdown-generation-tests
Add tests for Markdown generation
2023-02-15 13:17:40 +01:00
Elena Tanasoiu
1b81e8662e Merge pull request #2081 from github/shati-elena/do-not-send-format-option-for-packadd
Don't send `--format` option for `codeql pack add` command
2023-02-15 12:00:00 +00:00
Elena Tanasoiu
993bebe213 Add an extra line for testing the codespace-codeql tour
If you uncomment this, you'll be able to test the codespace locally.

Co-authored-by: Shati Patel <shati-patel@github.com>
2023-02-15 11:35:21 +00:00
Elena Tanasoiu
ef8aa14307 Don't send --format option for codeql pack add command
By default, this is added when we call `runJsonCodeQlCliCommandWithAuthentication`.

However, `codeql pack add` doesn't support this option so we need to turn it off.

Co-authored-by: Shati Patel <shati-patel@github.com>
2023-02-15 11:34:47 +00:00
Robert
c6ee20b7fb Merge pull request #2075 from github/robertbrignull/enable-await-thenable
Enable eslint rule to disallow awaiting a non-thenable type
2023-02-15 11:26:26 +00:00
Koen Vlaswinkel
38eb9bbd89 Add tests for markdown generation 2023-02-15 11:46:09 +01:00
Robert
5f20ef3df1 Fix extra alert from merging in main 2023-02-15 10:30:21 +00:00
Robert
fc7d48bf3a Merge branch 'main' into robertbrignull/enable-await-thenable 2023-02-15 10:28:43 +00:00
Robert
f69a6c523b More unnecessary awaits 2023-02-15 10:24:02 +00:00
Elena Tanasoiu
95f46b3b3a Merge pull request #2055 from github/elena/download-ql-packs
Generate QL pack for CodeTour
2023-02-15 10:19:08 +00:00
Koen Vlaswinkel
47c7e9e101 Move text-utils to pure 2023-02-15 11:18:47 +01:00
Koen Vlaswinkel
c0dc710b30 Rename markdown-generation file 2023-02-15 11:17:09 +01:00
Koen Vlaswinkel
a96265643c Merge pull request #2073 from github/koesie10/remove-remote-queries-react
Remove remote queries React components
2023-02-15 11:15:31 +01:00
Elena Tanasoiu
ab29fb759f Copy changes and remove extra line 2023-02-15 09:59:15 +00:00
Koen Vlaswinkel
754f6b2d49 Merge pull request #2059 from github/koesie10/retry-tests
Retry VSCode integration tests
2023-02-15 10:44:03 +01:00
Koen Vlaswinkel
3a188faf40 Merge branch 'main' into koesie10/retry-tests 2023-02-15 10:17:23 +01:00
Koen Vlaswinkel
b20aeb3e2c Merge pull request #2058 from github/koesie10/improve-test-setup
Improve test setup
2023-02-15 10:15:45 +01:00
Andrew Eisenberg
256b806cd4 Remove skipIfTrue
Also, add a comment to the vscode settings file and describe how to use
it.
2023-02-14 14:47:39 -08:00
Elena Tanasoiu
086df15357 Use file system path
On windows, the `Uri.path` will return an extra folder, as we can see in the tests:

```
ENOENT: no such file or directory, open 'D:\C:\Users\RUNNER~1\AppData\Local\Temp\tmp-4784XPDQPb5jM6IW\test-ql-pack-ruby\qlpack.yml'
```

Let's use `Uri.fsPath` instead.
2023-02-14 19:09:22 +00:00
Andrew Eisenberg
c0c30b48af Merge remote-tracking branch 'upstream/main' into aeisenberg/run-with-all-data-extensions 2023-02-14 18:39:35 +00:00
Elena Tanasoiu
3e87a2d53c Remove directory from workspace by index
We were initially always removing the last folder in the workspace as
we assumed that would be the directory we use.

Now that we've switched to using a temporary directory, this is no longer
the case so we need to find the index of the directory in the list of
workspace folders and then use that index to remove the directory.
2023-02-14 18:05:01 +00:00
Elena Tanasoiu
f1227dd2eb Build directory URI using Uri.file instead of Uri.parse
`Uri.parse` will not work with Windows paths as it will consider `C:\path`
to indicate a file scheme (the "C:" part) and will complain about it.

With `Uri.file` we can build the URI without hitting this complication.
2023-02-14 18:01:05 +00:00
Elena Tanasoiu
a59a008d8e Use temporary directory for generator tests
This will hopefully work with Windows tests as well.
2023-02-14 17:12:31 +00:00
Robert
950a218c29 Enable eslint rule to disallow awaiting a non-thenable type 2023-02-14 17:10:16 +00:00
Elena Tanasoiu
1ae52ef1cc Mock storageUri for workspace in tests
So that we can provide this to the generator.
2023-02-14 15:13:51 +00:00
Andrew Eisenberg
851a42f5e3 Merge pull request #2066 from github/aeisenberg/update-settingsjson
Add some better sample env vars in settings.json
2023-02-14 06:53:36 -08:00
Elena Tanasoiu
d6ccc11135 Update tests to check we call the generator
We don't need to repeat the tests for the generator functionality
here. All we want to check is that the generator is triggered correctly.
2023-02-14 13:02:29 +00:00
Elena Tanasoiu
24eb8fd307 Store QL pack in workspace instead of VSCode storage
We're checking that the skeleton QL pack doesn't exist as a workspace
folder, so we should be creating this folder in the workspace as well.

Initially this was being created in VSCode's local storage.
2023-02-14 13:02:29 +00:00
Elena Tanasoiu
ce3e19a2d7 Mention that the query file is automatically generated 2023-02-14 13:02:29 +00:00
Elena Tanasoiu
c4bed4e8aa Simplify example query to make it work with all languages 2023-02-14 13:02:29 +00:00
Elena Tanasoiu
3464cd0cda Reword dialog box prompt
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2023-02-14 13:02:29 +00:00
Elena Tanasoiu
b04b3bf33e Reword packAdd output
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2023-02-14 13:02:28 +00:00
Elena Tanasoiu
a8f36ee9e8 Generate a QL pack when you add a new database, if one is missing 2023-02-14 13:02:28 +00:00
Elena Tanasoiu
6cda6534d1 Introduce a QlPackGenerator class
This will receive a folder name and language.

It will generate:
- a `codeql-pack.yml` file
- an `example.ql` file
- a `codeql-pack.lock.yml` file

It will also install dependencies listed in `codeql-pack.lock.yml`
file.

We were initially planning to call the `packInstall` command once
we generate `codeql-pack.yml` in order to install dependencies.

However, the `packAdd` command does this for us, as well as
generating a lock file.

Rather than trying to craft the lock file by hand, we're opting
to use the cli command.

NB: We're introducing a new `QueryLanguage` type which is identical
to the `VariantAnalysisQueryLanguage`. In a subsequent PR we'll
unify these two types.
2023-02-14 13:02:28 +00:00
Elena Tanasoiu
5a9d12ea60 Introduce wrapper for codeql pack add CLI command
Similar to what we do with `codeql pack install`.

Tnis will simulate us running `codeql pack add codeql/<language>-all`.

We're going to need in order to:
- generate a lock file (codeql-pack.lock.yaml)
- install the correct packages for our skeleton QL pack based on the
lock file.
2023-02-14 13:02:28 +00:00
Koen Vlaswinkel
f9ef9567cf Merge pull request #2071 from github/koesie10/remove-remote-queries-history-item
Remove remote queries history item
2023-02-14 13:11:04 +01:00
Koen Vlaswinkel
547e18bab9 Merge remote-tracking branch 'origin/main' into koesie10/remove-remote-queries-react 2023-02-14 12:16:41 +01:00
Koen Vlaswinkel
7d7a7060fa Merge pull request #2070 from github/koesie10/remove-remote-query-manager
Remove remote queries manager
2023-02-14 12:16:02 +01:00
Koen Vlaswinkel
16464d5e3a Merge pull request #2069 from github/koesie10/remove-remote-query-commands
Remove remote queries commands
2023-02-14 11:21:12 +01:00
Koen Vlaswinkel
c0ffd795e0 Remove remote queries React components 2023-02-14 10:28:51 +01:00
Koen Vlaswinkel
7508ef2e26 Move components used by MRVA out of remote-queries 2023-02-14 10:27:52 +01:00
Koen Vlaswinkel
fb4d6db03d Remove remote queries history item
This removes the remote queries history item as a supported history
item. This allows us to delete almost all code related to remote
queries except for the React view code which will be removed separately.

In the query serialization code, we now ignore remote queries.
2023-02-14 10:20:04 +01:00
Andrew Eisenberg
39e6b27676 Make linter happy 2023-02-13 21:11:14 -08:00
Andrew Eisenberg
d8435d113a Fix skipIfTrue
Also, update jsdoc for `resolveQlpacks`.
2023-02-13 14:30:29 -08:00
Andrew Eisenberg
d386d42f34 Add back comment 2023-02-13 09:55:25 -08:00
Koen Vlaswinkel
89860d4f84 Remove remote queries view 2023-02-13 16:01:39 +01:00
Koen Vlaswinkel
53ffdc30ce Remove remote queries manager 2023-02-13 15:57:10 +01:00
Koen Vlaswinkel
e5a48fb46f Merge pull request #2068 from github/koesie10/remove-run-remote-query
Remove code to start a remote query run
2023-02-13 15:46:10 +01:00
Koen Vlaswinkel
f6d7ddf5b3 Remove tests for remote query history 2023-02-13 15:44:58 +01:00
Koen Vlaswinkel
dbe9807ccc Remove codeQL.exportRemoteQueryResults command 2023-02-13 14:40:54 +01:00
Koen Vlaswinkel
b2ea12023c Remove codeQL.autoDownloadRemoteQueryResults command 2023-02-13 14:32:50 +01:00
Koen Vlaswinkel
255f1b6a5d Remove codeQL.copyRepoList command 2023-02-13 14:31:50 +01:00
Koen Vlaswinkel
dcdb303da7 Remove codeQL.monitorRemoteQuery command 2023-02-13 14:12:44 +01:00
Koen Vlaswinkel
096e8f6196 Remove code to start a remote query run
This removes the `runRemoteQuery` method on the remote queries manager,
all code that calls it and code which is now dead.
2023-02-13 14:00:35 +01:00
Charis Kyriakou
f7826c3254 Remove some as umknown as X usages (#2067) 2023-02-13 12:47:37 +00:00
Charis Kyriakou
ad03dfa0a9 Optimistically update the UI when user selects db/list (#2063) 2023-02-13 12:29:14 +00:00
Koen Vlaswinkel
930def851d Disable parallelization of tests
This would run the unit, view, integration and CLI integration tests in
parallel, which would cause problems with multiple VSCode instances and
use a lot of memory.
2023-02-13 12:02:21 +01:00
Koen Vlaswinkel
46670cc7d6 Clarify CLI integration test CI runs 2023-02-13 11:39:38 +01:00
Koen Vlaswinkel
b412896d54 Make purpose of no-workspace tests clearer 2023-02-13 11:39:07 +01:00
Koen Vlaswinkel
14eb6b4f89 Only download test DB for CLI integration tests
The test database is not required for activated extension tests, so we
only need to download the test database for CLI integration tests.
2023-02-13 11:37:11 +01:00
Charis Kyriakou
682a1e12bc Update copy for local db select button (#2062) 2023-02-13 09:53:48 +00:00
Charis Kyriakou
366965adbf Remove random capital letters (#2064) 2023-02-13 09:02:45 +00:00
Koen Vlaswinkel
3917b14a58 Merge remote-tracking branch 'origin/main' into koesie10/improve-test-setup 2023-02-13 09:21:39 +01:00
Andrew Eisenberg
722f5c5035 Add some better sample env vars in settings.json 2023-02-10 15:55:16 -08:00
Andrew Eisenberg
6f435300e8 Add ability to run query with data extensions
- Add a new config that toggles between using all data extensions or
  none.
- If using all data extensions, then before a query evaluation, run a
  `codeql resolve qlpacks` command with the new `--kind` option. This
  will return a list of extension packs in the workspace.
- Pass these packs to the cli before evaluation/
- This will only work with CLI v2.12.3 (not yet released) or later.
- Also include some CLI tests to ensure this works.
2023-02-10 15:51:07 -08:00
Charis Kyriakou
57f9ff68f8 Remove remote queries integration tests (#2060) 2023-02-10 14:56:12 +00:00
Charis Kyriakou
b599885b1c Update edit db config icon (#2061) 2023-02-10 14:40:43 +00:00
Charis Kyriakou
514dd7afe3 New db item/list selection UX for variant analysis repo panel (#2053) 2023-02-10 14:38:08 +00:00
Koen Vlaswinkel
ce56e6f038 Retry VSCode integration tests
This will call `jest.retryTimes` to retry the VSCode integration tests
up to 3 times. This should help with the flaky tests.
2023-02-10 10:43:48 +00:00
Koen Vlaswinkel
0138df5da8 Merge pull request #2051 from github/koesie10/filter-vscode-output
Hide VSCode console output
2023-02-09 15:36:59 +01:00
Koen Vlaswinkel
212273791b Merge pull request #2054 from github/koesie10/codeql-pack-yml
Handle `codeql-pack.yml` files everywhere
2023-02-09 15:36:00 +01:00
Koen Vlaswinkel
6ed5c2a583 Merge remote-tracking branch 'origin/main' into koesie10/filter-vscode-output 2023-02-09 09:48:24 +00:00
Koen Vlaswinkel
752b6a7f8a Add tests for getQlPackPath 2023-02-08 17:17:10 +00:00
Koen Vlaswinkel
34bdbd158d Move qlpack functions/constants to pure 2023-02-08 17:12:22 +00:00
Koen Vlaswinkel
c71238c6d2 Merge pull request #2052 from github/koesie10/source-map-script-from-release-asset
Download sourcemaps from release asset if available
2023-02-08 14:49:28 +01:00
Koen Vlaswinkel
202c93b580 Merge pull request #2049 from github/koesie10/upload-sourcemaps-release
Upload sourcemaps as release asset
2023-02-08 14:46:39 +01:00
Koen Vlaswinkel
b03efa4f24 Merge remote-tracking branch 'origin/main' into koesie10/source-map-script-from-release-asset 2023-02-08 13:31:28 +00:00
Koen Vlaswinkel
1198a05776 Merge remote-tracking branch 'origin/main' into koesie10/upload-sourcemaps-release 2023-02-08 13:31:13 +00:00
Koen Vlaswinkel
642b8e5960 Add documentation for new test suite and scripts 2023-02-08 13:28:18 +00:00
Andrew Eisenberg
2b816f9f0f Merge pull request #2056 from github/github-action/bump-cli
Bump CLI Version to v2.12.2 for integration tests
2023-02-08 05:26:49 -08:00
Koen Vlaswinkel
708af3cbb9 Merge pull request #2057 from github/koesie10/version-number-advice
Add recommendation for version number bumps
2023-02-08 14:16:29 +01:00
Koen Vlaswinkel
6b8467fc4e Update test script names 2023-02-08 13:14:00 +00:00
Koen Vlaswinkel
a9c36ea699 Create new activated-extension test suite 2023-02-08 11:52:55 +00:00
Koen Vlaswinkel
ef1fe756cb Add recommendation for version number bumps 2023-02-08 11:21:33 +00:00
github-actions[bot]
977e3c099d Bump CLI version from v2.12.1 to v2.12.2 for integration tests 2023-02-07 21:39:28 +00:00
Koen Vlaswinkel
7d6461a10a Handle codeql-pack.yml files everywhere
This will add support for the `codeql-pack.yml` filename in all places
where we currently support `qlpack.yml`. It centralizes the list of the
supported filenames in a single place and a method that can figure out
the correct filename to use.
2023-02-07 17:55:50 +00:00
Koen Vlaswinkel
f3f8de0e60 Merge remote-tracking branch 'origin/main' into koesie10/source-map-script-from-release-asset 2023-02-07 17:29:07 +00:00
Koen Vlaswinkel
81502fefec Merge pull request #2039 from github/koesie10/source-map-script-stacktrace
Add source map support for full stacktraces
2023-02-07 18:04:14 +01:00
Koen Vlaswinkel
ac127b3a3d Merge remote-tracking branch 'origin/main' into koesie10/source-map-script-from-release-asset 2023-02-07 17:00:48 +00:00
Koen Vlaswinkel
465da69ecf Merge remote-tracking branch 'origin/main' into koesie10/source-map-script-stacktrace 2023-02-07 16:38:44 +00:00
Koen Vlaswinkel
648e6745a8 Merge pull request #2037 from github/koesie10/source-map-script
Add script for retrieving original source location
2023-02-07 17:37:19 +01:00
Koen Vlaswinkel
5b9c09c958 Download sourcemaps from release asset if available
This download download the sourcemaps from the release asset if it is
available. Unfortunately, I'm not able to test this yet because we don't
yet have any releases with sourcemaps attached. As a fallback, it will
still try to download from the workflow run.
2023-02-07 15:16:10 +00:00
Koen Vlaswinkel
943229f065 Merge pull request #2033 from github/koesie10/mocked-config
Mock config instead of writing settings files
2023-02-07 15:50:32 +01:00
Koen Vlaswinkel
c42cd9059d Hide information about VSCode exit code and download 2023-02-07 14:45:50 +00:00
Koen Vlaswinkel
f7fb6a4920 Merge remote-tracking branch 'origin/main' into koesie10/mocked-config 2023-02-07 14:33:53 +00:00
Koen Vlaswinkel
5e8c2fa6db Hide VSCode console output
Most of the warnings that are currently being shown in CI are coming
from VSCode. We can hide the VSCode output to make the CI logs more
readable. This should not influence the tests; the output of tests
(in particular using `console.log`/`console.error` etc.) will still be
shown.

See: 0c98dc12ad/packages/jest-runner-vscode/src/public-types.ts (L58-L68)
2023-02-07 14:30:07 +00:00
Elena Tanasoiu
f7ab8b7ba0 Merge pull request #2042 from github/elena/add-more-test-coverage
Add test coverage for `openDatabase`
2023-02-07 14:03:09 +00:00
Elena Tanasoiu
b2fa85f5c5 Merge pull request #2036 from github/shati-elena/create-skeleton
Introduce command for creating skeleton QL packs
2023-02-07 12:49:13 +00:00
Elena Tanasoiu
72f3847a3e Add tests for openDatabase function 2023-02-07 11:45:01 +00:00
Elena Tanasoiu
f8d0f689a6 Move functions into class so they can be mocked
We'd like to add test coverage for the openDatabase function (which is
public).

At the moment, this relies on `resolveDatabaseContents` which is just
a standalone function.

This means we're unable to mock it using Jest.

So let's move it into its own class.

This method in turn depends on a `resolveDatabase` function, which we've
also moved into the new class.

The only usages I could find for there functions were from within
the `databases.ts` file.
2023-02-07 11:26:33 +00:00
Elena Tanasoiu
235fb83e8c Don't check for specific number of calls on callback
This is unrelated to the changes in this PR but it's causing CI to fail.

```
config listeners › CliConfigListener › should listen for changes to 'codeQL.runningTests.numberOfThreads'

    expect(jest.fn()).toHaveBeenCalledTimes(expected)

    Expected number of calls: 1
    Received number of calls: 2

      109 |           const newValue = listener[setting.property as keyof typeof listener];
      110 |           expect(newValue).toEqual(setting.values[1]);
    > 111 |           expect(onDidChangeConfiguration).toHaveBeenCalledTimes(1);
          |                                            ^
      112 |         });
      113 |       });
      114 |     });
```

We don't need to check that the callback is triggered a certain number of times, just that it works
so we can change this test to be more permissive.
2023-02-07 11:25:11 +00:00
Elena Tanasoiu
5c89952999 "select" -> "add" 2023-02-07 11:23:40 +00:00
Elena Tanasoiu
397aa2befe Mention language in pop-up message 2023-02-07 11:23:40 +00:00
Elena Tanasoiu
63add84bf3 Use triple equals 2023-02-07 11:23:40 +00:00
Elena Tanasoiu
037596cfb4 Create skeleton QL pack if in CodeTour
We'd like to make it easier for a user going through the CodeQL Tour to
write their queries.

To help them along, we can generate skeleton QL packs once we know which
database they're using, instead of expecting them to know how to create
this themselves.

We're then able to download the necessary dependencies for their CodeQL
queries.

This checks that we're running the CodeTour by looking for the
`codeQL.codespacesTemplate` setting.
2023-02-07 11:23:39 +00:00
Elena Tanasoiu
a85281e365 Be able to pass custom db options to mock
We will use this to set/unset the language on a database item.

This will then be used to determine whether we need to create a QL pack.
2023-02-07 11:23:39 +00:00
Elena Tanasoiu
99f3d28640 Introduce helper method to detect folder in workspace 2023-02-07 11:23:39 +00:00
Elena Tanasoiu
41256ec9fd Make it a little clearer which function the tests are checking 2023-02-07 11:23:39 +00:00
Koen Vlaswinkel
74581fb8e3 Merge pull request #2046 from github/koesie10/rename-last-commit-to-last-updated
Rename "Last commit" to "Last updated"
2023-02-07 12:15:04 +01:00
Koen Vlaswinkel
483d674da1 Upload sourcemaps as release asset
This will upload the sourcemaps produced as part of the release as a
release asset. This allows the sourcemaps to be downloaded and used
for decoding stack traces beyond the 90 day artifact limit of GitHub
Actions.
2023-02-07 11:06:03 +00:00
Koen Vlaswinkel
cff3d9508e Merge remote-tracking branch 'origin/main' into koesie10/rename-last-commit-to-last-updated 2023-02-07 11:00:31 +00:00
Robert
24e4708477 Merge pull request #2017 from github/robertbrignull/logged_error_telemetry
Introduce showAndLogExceptionWithTelemetry
2023-02-07 10:00:14 +00:00
Koen Vlaswinkel
4f0032d77b Merge pull request #2045 from github/koesie10/link-to-actions-workflow
Add link to Actions workflow when running MRVA
2023-02-07 10:48:22 +01:00
Robert
420fd8d48a Merge branch 'main' into robertbrignull/logged_error_telemetry 2023-02-07 09:42:54 +00:00
Charis Kyriakou
a901369c5e Enable eqeqeq ESLint rule and fix violations (#2043) 2023-02-07 09:36:18 +00:00
Elena Tanasoiu
b05697c327 Merge pull request #2044 from github/elena/remove-lint
Don't lint on `git push`
2023-02-07 09:23:11 +00:00
Koen Vlaswinkel
0cbc9916fc Rename "Last commit" to "Last updated"
Last commit is confusing because it's actually the `updated_at` of the
repository. By renaming it, this will be clearer to users.
2023-02-06 17:54:31 +00:00
Koen Vlaswinkel
f57b811585 Add link to Actions workflow when running MRVA 2023-02-06 17:46:35 +00:00
Elena Tanasoiu
0b9dcb44d9 Don't lint on git push
We run `npm run lint` every time we do a `git push`.

This takes quite a long time, and the lint command has already been run
when we created the commit in the first place.

Could we instead skip this and rely on CI to tell us if we've failed
to address a linting issue?
2023-02-06 17:36:24 +00:00
Koen Vlaswinkel
a5b95944fc Add radix to parseInt 2023-02-06 17:13:23 +00:00
Koen Vlaswinkel
6d1c66b121 Add example to source map script 2023-02-06 17:09:56 +00:00
Koen Vlaswinkel
740cbc8dee Make onDidChangeConfiguration less strict
It seems like the `onDidChangeConfiguration` is being called multiple
times. It doesn't actually matter that it's being called twice, so we
just need to ensure it's called at least once.
2023-02-06 17:02:18 +00:00
Koen Vlaswinkel
c9f0d1b525 Merge remote-tracking branch 'origin/main' into koesie10/mocked-config 2023-02-06 16:21:09 +00:00
shati-patel
66fd8ad6cc Rename const to refer to the codespaces template in general 2023-02-06 11:13:10 +00:00
shati-patel
d0d48dfd08 Add feature flag for codespaces-codeql template workspace
We'll use this flag for commands that are specific to the tutorial code tour and "quick setup" in https://github.com/github/codespaces-codeql
2023-02-06 11:13:10 +00:00
Andrew Eisenberg
0dd741fa9b Merge pull request #2035 from github/version/bump-to-v1.7.9
Bump version to v1.7.9
2023-02-03 08:43:32 -08:00
Elena Tanasoiu
9c2aa8c7fa Merge pull request #2032 from github/shati-elena/check-for-ql-pack
Small tidy-up: Rename test file for databaseFetcher tests
2023-02-03 16:40:51 +00:00
github-actions[bot]
09e7a84597 Bump version to v1.7.9 2023-02-03 16:26:19 +00:00
Elena Tanasoiu
6e53ed020c Rename tests for databaseFetcher
These are not testing anything in the databases.ts file as we're
invoking functions from the DatabaseFetcher.

Let's name the file accordingly
2023-02-03 16:20:07 +00:00
Elena Tanasoiu
0eff27731e Merge pull request #2041 from github/elena/skip-failing-tests
Skip failing tests
2023-02-03 16:17:50 +00:00
Elena Tanasoiu
f276a3414a Skip failing tests
This is blocking us from merging new PRs so while we figure out
how to fix them, let's skip the tests that are failing on our
`main` branch.

For full context: the tests started failing when a new version of
VSCode was released (1.75.0).
2023-02-03 15:54:36 +00:00
Koen Vlaswinkel
0ed03c14bf Add source map support for full stacktraces
This adds support for mapping full stacktraces in the source map
script. This allows you to pass a full stacktrace to the script and get
back a stacktrace with all original positions.
2023-02-03 15:21:57 +01:00
Koen Vlaswinkel
92e2975c24 Add script for retrieving original source location
This adds a script that can be used for retrieving the original source
location when given a location in the released extension. It will
download the source map from the Actions workflow run of the release and
use the `source-map` library to extract the original location.
2023-02-03 12:15:57 +01:00
Koen Vlaswinkel
bc181c6c9b Only set CLI path in workspace configuration 2023-02-03 11:36:40 +01:00
Koen Vlaswinkel
beb0058365 Mock env.openExternal instead of overriding it 2023-02-03 11:29:29 +01:00
Robert
7a9b8bbdde Merge pull request #2034 from github/v1.7.8
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
v1.7.8
2023-02-02 16:59:00 +00:00
Robert
d2c795bec0 Update extensions/ql-vscode/CHANGELOG.md
Co-authored-by: Shati Patel <42641846+shati-patel@users.noreply.github.com>
2023-02-02 16:38:03 +00:00
Robert
d144874e77 v1.7.8 2023-02-02 16:30:46 +00:00
Koen Vlaswinkel
cac0add788 Mock config instead of writing settings files
In our tests, we were writing settings files to disk because we were
using the VSCode configuration API which writes settings to files. This
results in flaky tests because concurrency can cause the VSCode API to
misbehave.

This will switch the tests to use a mocked API by default. For some
tests the real implementation is used, but the large majority of tests
is now using a mocked version which only keeps track of the
configuration in memory. This makes it easier to reset the state between
tests since we can just empty out the in-memory configuration.
2023-02-02 16:51:02 +01:00
Elena Tanasoiu
c493425046 Merge pull request #2027 from github/elena/select-db-in-codespace
Introduce command to set default Code Tour database
2023-02-02 12:05:27 +00:00
Charis Kyriakou
302091f2c5 Added version to db config (#2029) 2023-02-02 11:50:16 +00:00
Robert
05d9f9b3a6 Add test that error messages are redacted 2023-02-02 11:11:52 +00:00
Robert
69b7e04ec0 Put error logging behind new secret flag 2023-02-02 11:11:49 +00:00
Robert
9184bde8a6 Merge branch 'main' into robertbrignull/logged_error_telemetry 2023-02-02 10:46:41 +00:00
Elena Tanasoiu
99d794c2a8 Update error message
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2023-02-02 10:30:01 +00:00
Elena Tanasoiu
b6aa41d19b Replace undefined check with length check 2023-02-02 10:27:22 +00:00
Elena Tanasoiu
6257608433 Add comment to indicate which folder we're pointing to 2023-02-02 10:27:22 +00:00
Elena Tanasoiu
6ebeb2b201 Introduce command to set default Code Tour database
We have a codespace template which houses our CodeQL tour:
https://github.com/github/codespaces-codeql

This contains a repo with a default databases already loaded
for the user so that they can start writing queries more quickly.

At the moment we're asking the user to manually right click on
the database folder ('codeql-tutorial-database') and set it as
the current database.

We can take this one step further by defining a command that gets
triggered when we arrive at the step for setting up the database.

The command ("codeQL.setDefaultTourDatabase") will build the URI
pointing to our preloaded database and set it as the current one.

We initially considered whether we can re-use the setCurrentDatabase
command and pass the URI of the database from the codespace itself,
but the URI would be hardcoded as:

```
file://0-62/workspaces/codespaces-codeql/codeql-tutorial-database
```

as we can only pass the codeTour extension a command and string
parameters.

This would have been brittle as the filepath for a codespace might
change in the future.

Instead we can define a custom tour command ("setDefaultTourDatabase")
to look at the current workspace folder and build the path to the
database in the CodeQL extension.

Co-authored-by: Shati Patel <shati-patel@github.com>
2023-02-02 10:27:22 +00:00
Nora
9f240c8500 Merge pull request #2028 from github/nora/polish-url-helper
DP Panel: Drop protocol check when creating a new item
2023-02-01 20:17:18 +01:00
Koen Vlaswinkel
d4b061115b Merge pull request #2031 from github/koesie10/gh-pr-create
Use first-party action for creating release PR
2023-02-01 15:41:52 +01:00
Koen Vlaswinkel
15382a02bc Use first-party action for creating release PR
Instead of using the third party `peter-evans/create-pull-request`
action for creating a PR for releases, we can use the already present
`./.github/actions/create-pr` action which is also used for the PR for
bumping CLI versions.
2023-02-01 14:39:00 +01:00
Robert
c3050fc324 Merge pull request #2030 from github/robertbrignull/disable-new-telemetry
Don't send new telemetry data unless opted-in
2023-02-01 12:21:12 +00:00
Nora
4c54778515 Allow usage of www.github.com 2023-02-01 11:34:49 +00:00
Nora
72412c92c8 Allow usage of github.com 2023-02-01 11:32:57 +00:00
Robert
d780c24994 Don't send new telemetry data unless opted-in 2023-02-01 11:19:11 +00:00
Koen Vlaswinkel
fa8def3c8c Merge pull request #2025 from github/koesie10/mrva-view-title
Update variant analysis view title
2023-02-01 09:37:55 +01:00
Koen Vlaswinkel
ad38d6d1ce Merge pull request #2023 from github/koesie10/db-panel-controller-repo-welcome
Show welcome view when controller repo is not setup
2023-01-31 17:01:00 +01:00
Charis Kyriakou
23a8468a26 Update the copy for the codeQLVariantAnalysisRepositories.removeItemContextMenu command (#2026) 2023-01-31 15:36:21 +00:00
Nora
9e54e5eced Drop protocol check 2023-01-31 14:18:12 +00:00
Koen Vlaswinkel
dbca4456a8 Change variant analysis view title 2023-01-31 11:55:04 +01:00
Koen Vlaswinkel
ecc5fa1e4e Extract MRVA view title generation to method
We had duplicated logic for generating the variant analysis view title.
This extracts it to a single method so the title are always in sync.
2023-01-31 11:53:22 +01:00
Koen Vlaswinkel
7ec4b4bc96 Merge pull request #2024 from github/koesie10/eslint-config
Unify ESLint configuration
2023-01-31 11:50:07 +01:00
Koen Vlaswinkel
ba11781165 Move welcome view test to rendering test 2023-01-31 11:43:55 +01:00
Nora
3fa7bec323 Merge pull request #2021 from github/nora/fix-placeholder
Fix placeholder copy
2023-01-31 09:52:21 +01:00
Robert
1120f2fca8 Fix tests 2023-01-30 16:58:11 +00:00
Robert
2f573aba0c Remove accidental spaces from error message string 2023-01-30 16:23:35 +00:00
Koen Vlaswinkel
a3c6b362f8 Remove unnecessary disabled rules
These rules are already disabled in the base config, so they don't need
to be disabled individually anymore.
2023-01-30 16:55:05 +01:00
Koen Vlaswinkel
5f382a5677 Combine ESLint configurations
Instead of having different ESLint configuration files in each
directory which don't seem to inherit the configuration correctly, this
will add `overrides` in the root file.
2023-01-30 16:43:19 +01:00
Koen Vlaswinkel
6114b591c5 Fix tests when no controller repo is set
This also extracts the helper to do so into a separate function to avoid
duplicating this logic.
2023-01-30 15:52:19 +01:00
Nora
87465a65ae Merge pull request #2022 from github/nora/remove-history-item-hover
Query History Item: remove on hover
2023-01-30 14:44:39 +01:00
Koen Vlaswinkel
b3c4979358 Show welcome view when controller repo is not setup
This will add a welcome view to the database panel which is shown when
the controller repository is not setup. This welcome view will show a
button which can be used to set up the controller repository.
2023-01-30 14:28:22 +01:00
Nora
3ba13a32e3 Remove query item on hover 2023-01-30 13:07:47 +00:00
Nora
3dc2cec5b6 Update copy 2023-01-30 10:39:42 +00:00
Robert
72c8e0bcb6 Convert RedactableError to an Error class of its own 2023-01-27 17:36:56 +00:00
Koen Vlaswinkel
160a6cca76 Use redactable error message for telemetry events 2023-01-27 11:50:40 +01:00
Koen Vlaswinkel
4edb83163d Create tagged template for error messages 2023-01-27 11:50:12 +01:00
Robert
fbe0df59be Fix typos 2023-01-27 10:32:03 +00:00
Koen Vlaswinkel
ddddd2f0b9 Merge pull request #2018 from github/koesie10/download-progress-indicator
Add download progress indicator for MRVA downloads
2023-01-27 10:14:32 +01:00
Koen Vlaswinkel
5098382afb Merge pull request #2014 from github/koesie10/download-progress
Report download progress when downloading variant analysis results
2023-01-27 10:14:08 +01:00
Koen Vlaswinkel
7dd5b0a826 Decrease download update delay
3 seconds is a really long time to wait for downloads since a
significant percentage of downloads will complete within 3 seconds. This
changes the update delay to 500ms which should still give us good
performance, but also make the download feel more responsive.
2023-01-26 17:11:42 +01:00
Koen Vlaswinkel
94968f41e7 Fix response size calculation
The `response.size` is almost always set to `0`. However, the
`Content-Length` header is returned by Azure and contains the size of
the file.
2023-01-26 17:11:40 +01:00
Nora
5ca409797d Merge pull request #2013 from github/nora/extract-scrubber-tests
Extract query history scrubber tests
2023-01-26 17:00:26 +01:00
Koen Vlaswinkel
c7bd9f9394 Add determinate progress ring 2023-01-26 16:47:37 +01:00
Robert
db0d41a305 Introduce showAndLogExceptionWithTelemetry 2023-01-26 15:38:03 +00:00
Nora
2264b6b983 Merge pull request #2016 from github/nora/query-history-context-menu
Query History: context menu copy and groups
2023-01-26 16:33:29 +01:00
Nora
012157a57a Remove unused code 2023-01-26 13:48:56 +00:00
Nora
940169e2a0 Extract query history scrubber tests 2023-01-26 13:48:56 +00:00
Nora
6ebb4affec Use groups and new copy 2023-01-26 13:41:09 +00:00
Koen Vlaswinkel
0efbbbfef1 Add test for download progress reporting 2023-01-26 13:36:04 +01:00
Koen Vlaswinkel
610a623bc5 Fix download tests 2023-01-26 13:36:04 +01:00
Koen Vlaswinkel
37c9414dad Use async appendFile 2023-01-26 13:36:04 +01:00
Robert
6cf351f332 Output percentage during results download 2023-01-26 13:36:04 +01:00
Robert
07f5d2b20d Merge pull request #2010 from github/robertbrignull/logging_types
Introduce ShowAndLogOptions
2023-01-26 11:21:28 +00:00
Robert
51a72227e9 Merge pull request #2011 from github/robertbrignull/catch_unknown
Enforce that promise rejection values must have unknown type
2023-01-26 10:39:55 +00:00
Robert
e9345dc588 Move documentation to type instead of methods 2023-01-26 10:37:23 +00:00
Nora
2acaf31287 Merge pull request #2007 from github/nora/query-history-sort-button
Query History: sorting
2023-01-26 10:43:20 +01:00
Nora
9a572a3c71 Merge pull request #2008 from github/nora/split-query-history-file
Query History: split file
2023-01-26 10:38:20 +01:00
Nora
1f52642308 Fix rebase problems 2023-01-26 09:21:04 +00:00
Nora
af7ec57b72 Fix rename in comments 2023-01-26 10:07:31 +01:00
Nora
c993d30b34 Split query history file 2023-01-26 10:07:31 +01:00
Robert
13dd5298bf Enforce that promise rejection values must have unknown type 2023-01-25 16:34:47 +00:00
Robert
de640e347d Introduce ShowAndLogOptions 2023-01-25 16:29:30 +00:00
Nora
ca1d63a3fc Merge pull request #2006 from github/nora/update-old-panel-icons
Update icons of old DB panel
2023-01-25 16:58:09 +01:00
Robert
5c5c2e485d Show download percentage in UI 2023-01-25 16:35:08 +01:00
Robert
2dc45ae5f6 Add downloadPercentage to VariantAnalysisScannedRepositoryState 2023-01-25 16:35:08 +01:00
Robert
ad6cbe60fd Merge pull request #1989 from github/robertbrignull/credentials_in_app
Add credentials to App
2023-01-25 15:15:30 +00:00
Nora
c1392e5c68 Update copy 2023-01-25 13:58:45 +00:00
Nora
dcfa990adb Use vscode icon for edit 2023-01-25 13:54:48 +00:00
Nora
89483a7b43 Use vscode icon for preview 2023-01-25 13:52:40 +00:00
Nora
bc6b829d17 Use vscode icon for trash 2023-01-25 13:50:13 +00:00
Nora
2c701e0663 Inline shorting in menu 2023-01-25 13:49:56 +00:00
Nora
0771e93c1e Use vscode icons 2023-01-25 11:34:42 +00:00
Nora
64e73c6426 Merge pull request #2005 from github/nora/update-panel-remote-icon
DB panel: use cloud icon for variant analysis repositories
2023-01-25 11:52:09 +01:00
Nora
cf2dec9577 Merge pull request #2004 from github/nora/update-query-history-icons
Query history polish: new icons
2023-01-25 11:51:55 +01:00
Robert
9e25d19924 Fix merge conflict 2023-01-25 10:41:40 +00:00
Nora
5342b5b83a Fix tests for error color 2023-01-25 10:19:49 +00:00
Robert
c5494b6fd2 Merge branch 'main' into robertbrignull/credentials_in_app 2023-01-25 10:15:29 +00:00
Nora
1ec39053cb Replace remote icon with cloud 2023-01-25 09:55:53 +00:00
Nora
0936185d2f Replace remote database icon 2023-01-25 09:47:07 +00:00
Nora
ec9b5fe1d3 Replace local database icon 2023-01-25 09:47:06 +00:00
Nora
3c56c549bc Replace error icon 2023-01-25 09:47:06 +00:00
Nora
407aa14d4d Merge pull request #2002 from github/elena-nora/move-query-history-files
Move query history files to new folders
2023-01-25 10:36:25 +01:00
Nora
76a35deb66 Move query history files to new folders 2023-01-24 17:04:25 +00:00
Nora
d6ab2292e0 Merge pull request #2001 from github/nora/query-history-empty-state
Query history polish: update empty state
2023-01-24 18:01:05 +01:00
Robert
8e80106b4f Add documentation 2023-01-24 15:40:38 +00:00
Robert
697a004005 Combine test credentials methods into testCredentialsWithRealOctokit 2023-01-24 15:40:21 +00:00
Nora
4f2b1af811 Update copy 2023-01-24 15:13:57 +00:00
github-actions[bot]
8ed826c78c Bump CLI Version to v2.12.1 for integration tests (#1999) 2023-01-24 10:36:15 +00:00
Koen Vlaswinkel
f7a9830455 Merge pull request #1788 from github/koesie10/remove-unsupported-version-constraints
Remove unsupported version constraints
2023-01-24 10:49:51 +01:00
Robert
1381cb67d6 Merge pull request #1997 from github/robertbrignull/use_as_error
Make use of asError instead of reimplementing
2023-01-23 17:15:59 +00:00
Robert
cc76ca80da Don't change compileAndRunQuery 2023-01-23 16:05:18 +00:00
Robert
3316d1712d Make use of asError instead of reimplementing 2023-01-23 15:49:31 +00:00
Koen Vlaswinkel
140d369098 Remove unsupported version constraints
This removes all CodeQL CLI version constraints for unsupported CLI
versions (< 2.7.6). The oldest supported CLI version is 2.7.6 since GHES
3.3 recommends using CodeQL CLI 2.7.6.
2023-01-23 14:13:05 +01:00
Shati Patel
2c19b32cb3 Minor polish to the "bump CLI" automation (#1996) 2023-01-20 18:42:20 +00:00
github-actions[bot]
3ce6735475 Bump CLI Version to v2.12.0 for integration tests (#1995) 2023-01-20 17:54:30 +00:00
Taj
c7f72c5aa9 Ensure cli using latest version from the supported_cli_versions.json (#1992) 2023-01-20 17:13:14 +00:00
Elena Tanasoiu
a17e41cbf1 Merge pull request #1993 from github/elena/extend-tests
Add remote queries and variant analyses to our serialization tests
2023-01-20 15:14:48 +00:00
Charis Kyriakou
3b5b85caed Disable select item button in new db panel (#1994) 2023-01-20 13:45:15 +00:00
Nora
708e55244e Merge pull request #1991 from github/nora/order-context-menu-actions
Sort and group context menu actions
2023-01-20 13:42:54 +01:00
Elena Tanasoiu
b58d82e53a Fix typo 2023-01-20 12:15:35 +00:00
Elena Tanasoiu
a2df1eaee4 Add remote queries and variant analyses to our serialization tests
This was just testing local queries.
2023-01-20 12:11:06 +00:00
Charis Kyriakou
d7fae741ae Merge pull request #1990 from github/charisk/disable-local-dbs
Turn off support for local dbs and remote root 'remote' node from new db panel
2023-01-20 11:29:08 +00:00
Nora
dadd3499ac Sort and group context menu actions 2023-01-20 11:02:03 +00:00
Charis Kyriakou
526c4f3ab7 Remove root 'remote' node 2023-01-20 09:53:23 +00:00
Charis Kyriakou
65623c07a2 Turn off support for local dbs in new panel 2023-01-20 09:53:23 +00:00
Charis Kyriakou
8a6b361e84 Fix rename that went too far (#1988) 2023-01-19 09:09:58 +00:00
Andrew Eisenberg
bd74b410f6 Merge pull request #1973 from github/tjgurwara99/bump-cli-extension
Modifying the `bump-cli` workflow to append/replace version from `supported_cli_versions.json`
2023-01-18 09:54:47 -08:00
Robert
03993f376f Add credentials to App 2023-01-18 17:36:38 +00:00
Elena Tanasoiu
4dc1b12785 Merge pull request #1984 from github/elena/move-tests
Move tests for serialization/deserialization in their own file
2023-01-18 17:29:27 +00:00
Charis Kyriakou
c2dcfe92bc Update db panel rendering tests to not rely on order of root nodes (#1987) 2023-01-18 17:47:35 +01:00
Charis Kyriakou
1bd749dee0 Convert integration tests to unit tests (#1986) 2023-01-18 16:42:38 +00:00
Elena Tanasoiu
e97a7c4993 Move tests for serialization/deserialization in their own file
We didn't have a query-serialization.test.ts file. Now we do.

We can build on these tests when we begin to save other types of data.
2023-01-18 12:21:39 +00:00
Nora
13389fd35f Merge pull request #1983 from github/nora/db-panel-add-item
Extract db panel add items tests to new file
2023-01-18 13:17:23 +01:00
Nora
9c011c5fd1 Create testfile in no workspaces and copy paste 2023-01-18 12:36:45 +01:00
Nora
f97dbb136d Merge pull request #1981 from github/nora/db-panel-selection
Extract db panel selection tests to new file
2023-01-18 12:35:59 +01:00
Taj
f154b59b14 description for version 2023-01-18 11:10:44 +00:00
Charis Kyriakou
ec1cf015bf Removed unnecessary awaits (#1982) 2023-01-18 10:58:37 +00:00
Nora
79289802c0 Create new selection test file and copy paste tests 2023-01-18 10:42:57 +00:00
Nora
e1bc8ae95a Merge pull request #1980 from github/nora/db-panel-rendering
Extract db panel render tests to new file
2023-01-18 11:41:39 +01:00
Robert
0bd6ba7898 Merge pull request #1978 from github/robertbrignull/compare_view_telemetry
Telemetry for compare view
2023-01-18 10:13:57 +00:00
Robert
84c6c1ef6b Merge pull request #1976 from github/robertbrignull/local_results_telemetry
Emit telemetry for user interactions in the local results view
2023-01-18 10:13:20 +00:00
Nora
5b6587cc18 Create new file and copy paste tests 2023-01-18 10:07:52 +00:00
Shati Patel
e230bf47d0 When adding repo, check whether name exists in specified parent list (#1977) 2023-01-18 10:01:47 +00:00
Nora
6c523db0ad Merge pull request #1975 from github/nora/review-user-messages
Polish user facing messages
2023-01-18 10:05:19 +01:00
Robert
37e3e041e8 Piggyback on changeSort message 2023-01-17 16:46:02 +00:00
Robert
3a4ce9abb1 Telemetry for compare view 2023-01-17 16:34:30 +00:00
Koen Vlaswinkel
b0168aa04a Merge pull request #1964 from github/koesie10/packages-auth
Use stdin for supplying auth to CodeQL
2023-01-17 17:30:25 +01:00
Robert
4009f03dd2 Send telementry on other links and UI elements 2023-01-17 15:49:50 +00:00
Taj
160ee22d1b combined version change and bump-cli workflow 2023-01-17 14:32:19 +00:00
Nora
fe17f61b5e Rename remote to variant analysis 2023-01-17 14:18:24 +00:00
Nora
c5722d7aa2 Merge pull request #1972 from github/nora/expanded-tests
Add test for behaviour around expanded state
2023-01-17 14:23:15 +01:00
Robert
f1dbc22a9a output telemtry from local results view on state changes 2023-01-17 12:58:11 +00:00
Robert
10776759c7 Support telemetry from local results view 2023-01-17 12:55:50 +00:00
Nora
e6c6e8a2be Merge comments 2023-01-17 12:30:11 +00:00
Nora
07868d90e9 Remove unneeded expectations and adjust test 2023-01-17 10:14:08 +00:00
Nora
40f08393b2 Add test for expanded state cleanup 2023-01-17 10:14:08 +00:00
Nora
c6c7b71b8a Add test for renaming expanded items 2023-01-17 10:14:08 +00:00
Nora
0bccdbb8d6 Add tests for adding and removing item to expanded state 2023-01-17 10:14:08 +00:00
Robert
611f6e39e0 Merge pull request #1953 from github/robertbrignull/telemetry_ui
Report telemetry on actions taken in the UI
2023-01-17 09:36:06 +00:00
Elena Tanasoiu
a1f5e5b277 Merge pull request #1944 from github/elena/fix-removal
Display modal when removing an item from query history
2023-01-17 08:57:03 +00:00
Koen Vlaswinkel
7b5e5a6407 Merge pull request #1963 from github/koesie10/webpack-production-build
Use Webpack in production mode for releases
2023-01-17 09:49:59 +01:00
Koen Vlaswinkel
2957979b15 Update comment for CodeQL CLI authentication 2023-01-17 09:35:48 +01:00
Koen Vlaswinkel
e8799ad275 Handle race condition when authenticating to the CLI 2023-01-17 09:31:58 +01:00
Taj
bfa6780529 first pass at automating appending/prepending/removing version from supported cli versions 2023-01-16 22:06:15 +00:00
Elena Tanasoiu
80f588c5c8 Merge pull request #1971 from github/elena/rename-splat-slurp
Rename `splat/slurp` to `serialize/deserialize`
2023-01-16 17:41:34 +00:00
Elena Tanasoiu
57b6c9bb2c Don't mention splat/slurp in comments or descriptions 2023-01-16 17:20:22 +00:00
Elena Tanasoiu
80dfe4ba69 Rename slurpQueryHistory -> deserializeQueryHistory 2023-01-16 17:20:22 +00:00
Elena Tanasoiu
06bc4c8fe3 Rename splatQueryHistory -> serializeQueryHistory 2023-01-16 17:20:22 +00:00
Elena Tanasoiu
c62f381a2f Remove extra log message 2023-01-16 17:19:26 +00:00
Elena Tanasoiu
3547fdfd54 Add tests for modal behaviour
Tests whether we choose "Yes" / "No" in the new modal window.

"Yes" -> remove the item and show you a toast notification
"No" -> don't remove item

This only shows up for in progress items.
2023-01-16 17:19:25 +00:00
Elena Tanasoiu
ab0e67c251 Split removal tests based on state of query
We now have special behaviour for removing an "in progress" query so the
tests will be different.

Let's have a separate section for "in progress" queries. We'll add extra
behaviour testing in the next commit.
2023-01-16 17:19:25 +00:00
Elena Tanasoiu
fa1f355b93 Show dialog with "Are you sure?" for in-progress queries
When you attempt to delete a query that's still in progress from your
query history, you get a prompt asking if you're sure.

If you pick "Yes", the item is removed and you see a toast notification
with a link towards the GitHub Action.
2023-01-16 17:19:25 +00:00
Robert
3777eb382f Make isCanary a string 2023-01-16 16:56:30 +00:00
Nora
4cb3c4cb50 Merge pull request #1968 from github/nora/rename-db-config-file
Rename DbConfigFile and Schema
2023-01-16 17:46:54 +01:00
Robert
44a0cad146 Make useTelemetryOnChange signature simpler 2023-01-16 16:44:32 +00:00
Robert
293ec1f204 Add debounce to variant-analysis-selected-repository-ids 2023-01-16 16:36:00 +00:00
Robert
38cbb95ecc Avoid === true on a boolean 2023-01-16 16:34:13 +00:00
Robert
18ddb3a297 Use isCanary() method 2023-01-16 16:12:20 +00:00
Robert
2453038387 Merge branch 'main' into robertbrignull/telemetry_ui 2023-01-16 16:10:18 +00:00
Charis Kyriakou
856e516b20 Renamed Run Query command (#1962) 2023-01-16 15:48:06 +00:00
Nora
6f78fffd10 Merge comments 2023-01-16 15:23:48 +00:00
Charis Kyriakou
957f6a023c Mark App interface properties as read-only (#1969) 2023-01-16 15:20:28 +00:00
Nora
afcb84fcd8 Rename db config file 2023-01-16 10:58:28 +00:00
Nora
c19f58b0e3 Rename schema file 2023-01-16 10:22:55 +00:00
Nora
7f1bcedf9b Extract config file to constant 2023-01-16 10:11:00 +00:00
Shati Patel
817db85c36 Add "describe" blocks around db-panel tests (#1965) 2023-01-16 10:07:35 +00:00
Koen Vlaswinkel
b4bb1b6ad7 Upload sourcemaps for release builds
To allow us to reconstruct a stack trace, this will upload the
sourcemaps for all release builds.
2023-01-16 10:58:00 +01:00
Andrew Eisenberg
ecbb0fb232 Merge pull request #1871 from tjgurwara99/main
Workflow to automatically bump cli version if different from the current version
2023-01-13 13:14:14 -08:00
Taj
365519af63 fix: src dir to test dir 2023-01-13 19:11:53 +00:00
Taj
ef1444617d Merge branch 'main' of github.com:tjgurwara99/vscode-codeql 2023-01-13 16:00:22 +00:00
Taj
c72734e49a fix: replaced with newer version since the PR was open 2023-01-13 15:59:39 +00:00
Taj
7f05af942b Merge branch 'github:main' into main 2023-01-13 14:00:41 +00:00
Koen Vlaswinkel
20a06238a2 Use stdin for supplying auth to CodeQL
This will supply the GitHub access token to certain CodeQL CLI commands
such that private packages can be resolved. It will only do so if the
user has an existing auth session. If they don't, they will now get a
prompt to login. However, this will only happen for commands which
actually use authentication, which is limited to packaging commands.
2023-01-13 15:02:51 +02:00
Taj
91dc39b465 added the bump-cli.yml file to trigger the workflow when changed 2023-01-13 12:58:28 +00:00
Koen Vlaswinkel
f6f8b68ce9 Use Webpack in production mode for releases
This will set the `mode` of Webpack to `production` for release builds.
It will also stop inlining the sourcemap and instead produce a separate
file which is excluded by `.vscodeignore`.

In terms of the bundled extension, this will add 1 file
(`out/webview.js.LICENSE.txt`). It decreases the size of the VSIX file
from 4.28MB to 1.77MB.
2023-01-13 14:23:51 +02:00
Robert
47f63f6df6 Implement debounce for telemetry events 2023-01-13 12:17:15 +00:00
Robert
98a29d2459 Convert useStateWithTelemetry to useTelemetryOnChange 2023-01-13 12:17:13 +00:00
Koen Vlaswinkel
f82fde35ee Merge pull request #1799 from github/koesie10/bundle-extension
Bundle extension files using ESBuild
2023-01-13 14:13:35 +02:00
Robert
e9830ee854 Add telemetry message to remote queries view 2023-01-13 11:21:10 +00:00
Shati Patel
277da3c971 Rename feature flag (#1961) 2023-01-13 11:07:26 +00:00
Charis Kyriakou
78e01e6f92 Rename db config terms to use 'variant analysis' instead of remote (#1960) 2023-01-13 09:30:45 +00:00
Nora
4ae77351c8 Merge pull request #1949 from github/nora/rename-expanded-methods
Minor refactoring for expanded things
2023-01-12 17:00:11 +01:00
Nora
5c40293c06 Revert "Rename arguments"
This reverts commit 85b7e0eabad1092792ff336b8ccff4fdef04e034.
2023-01-12 15:15:57 +00:00
Nora
ba830dd2e5 Fix expanded bug when renaming lists 2023-01-12 15:15:57 +00:00
Nora
c36da4ba7e Rename arguments 2023-01-12 15:15:57 +00:00
Nora
b9740fe582 Use individual functions for add and remove from expanded state 2023-01-12 15:15:56 +00:00
Charis Kyriakou
09c60ecfc8 Improve docs around different test suites (#1959) 2023-01-12 15:15:24 +00:00
Nora
8b661c7a6d Merge pull request #1947 from github/nora/db-config-store-tests
Improve tests coverage in db-config-store
2023-01-12 14:25:54 +01:00
Nora
94823a6c75 Disable filewatcher for tests 2023-01-12 12:53:12 +00:00
Nora
010e85c28b Merge comments 2023-01-12 13:44:34 +01:00
Nora
ed11b20cb7 Add tests for does exist methods 2023-01-12 12:43:30 +00:00
Nora
8cb0cd23dd Add test for set selected item 2023-01-12 12:43:30 +00:00
Nora
9f5e9653da Add tests for add 2023-01-12 12:43:30 +00:00
Shati Patel
2b7d2d0610 Increase timeout for "variant analysis submission" test (#1958) 2023-01-12 12:04:26 +00:00
Shati Patel
e322bf829a Add db manager tests for "removeDbItem" functionality (#1948) 2023-01-12 11:59:25 +00:00
Robert
25a3ba76ed Extract on-click handlers to consts 2023-01-12 11:01:10 +00:00
Robert
0aa2cd6e90 Make Telemetry.ts lowercase 2023-01-12 10:58:01 +00:00
Charis Kyriakou
67fa920d4d Merge pull request #1957 from github/charisk/rename-new-db-panel
Rename new db panel to 'Variant Analysis Repositories'
2023-01-12 10:55:08 +00:00
Shati Patel
b54dfe9b58 Fix flaky test: avoid file watcher in db manager tests (#1951) 2023-01-12 10:51:46 +00:00
Charis Kyriakou
4f588d9def Remove obsolete test file (#1955) 2023-01-12 10:38:57 +00:00
Charis Kyriakou
1c3a6154c9 Rename the id for the new db panel to 'codeQLVariantAnalysisRepositories' 2023-01-12 09:20:35 +00:00
Charis Kyriakou
a21382b053 Rename the user-visible name for the new db panel to 'Variant Analysis Repositories' 2023-01-12 08:49:24 +00:00
Andrew Eisenberg
6f168459a2 Merge pull request #1933 from github/aeisenberg/codeql-pack-yml
Ensure remote queries can handle codeql-pack.yml files
2023-01-11 15:55:15 -08:00
Andrew Eisenberg
77c6706320 Ensure remote queries can handle codeql-pack.yml files
This updates one of our integration tests so that it uses
`codeql-pack.yml` instead of `qlpack.yml`.
2023-01-11 14:36:43 -08:00
Shati Patel
3fe3117c39 Temporarily skip flaky test (#1954)
We're working on a fix, but this will unblock CI in the meantime
2023-01-11 16:24:35 +00:00
Robert
e163e0625d Merge pull request #1952 from github/robertbrignull/open_logs_command
Convert opening variant analysis logs to a command
2023-01-11 15:37:28 +00:00
Robert
f1a8564db4 Output telemetry when clicking links 2023-01-11 14:50:25 +00:00
Robert
34e98c4cc5 Convert useStateWithTelemetry to use useMemo 2023-01-11 14:50:25 +00:00
Robert
f325eeb5ab Output telemetry on react state changes in MRVA results view 2023-01-11 14:50:24 +00:00
Robert
bdfb2f29da Add method to loging telemetry of a UI interaction 2023-01-11 14:48:14 +00:00
Robert
9d457304b1 Convert opening variant analysis logs to a command 2023-01-11 14:35:40 +00:00
Koen Vlaswinkel
bb63dc52c9 Fix debugging not working
VSCode was not able to find the original source of the bundled
extension because it was looking for the source in the `out` directory.
By setting the `sourceRoot` to the `extensions/ql-vscode` directory
which is located at `..` from the `out` directory, VSCode is able to
find the original source and breakpoints are hit.
2023-01-11 12:13:55 +02:00
Koen Vlaswinkel
033d653d44 Fix types in CodeFlowsDropdown 2023-01-11 11:56:50 +02:00
Koen Vlaswinkel
6bf19eb52f Use case-insensitive path comparison on Windows 2023-01-11 11:29:23 +02:00
Koen Vlaswinkel
477b32662f Copy WASM file from source-map
This will copy the WASM file from source-map to the output directory.
This makes the source-map package work. See the comment in the code for
more details.
2023-01-11 10:43:45 +02:00
Koen Vlaswinkel
65696997de Add correct binding of sourcemap instance 2023-01-11 10:43:45 +02:00
Koen Vlaswinkel
d79b105751 Remove fs mocking from cli-integration tests 2023-01-11 10:43:44 +02:00
Koen Vlaswinkel
1f9e28e09d Remove fs mocking from minimal-workspace tests 2023-01-11 10:43:43 +02:00
Koen Vlaswinkel
0d8c90a7b5 Remove fs mocking from no-workspace tests 2023-01-11 10:43:24 +02:00
Koen Vlaswinkel
f13f0b3bc3 Bundle extension files using ESBuild
This bundles the extension files using esbuild, as recommended by
VSCode. This reduces the size of the extension from 34MB to less than
5MB.

Gulp will still run TypeScript to check types, but will not use the
TypeScript compiler output in the bundle.

Tests are now run separately, outside of Gulp, so their data doesn't
need to be copied anymore.

See: https://code.visualstudio.com/api/working-with-extensions/bundling-extension
2023-01-11 10:42:24 +02:00
Charis Kyriakou
0b6f2c248b Refactor logic to remove db or list from config (#1946) 2023-01-11 08:41:58 +00:00
Shati Patel
9cf508837e Add db manager tests for "rename" functions (#1939)
Co-authored-by: Charis Kyriakou <charisk@users.noreply.github.com>
2023-01-10 14:00:47 +00:00
Nora
ed2bdd8a43 Merge pull request #1925 from github/nora/add-remove-context-action
Add remove context menu action
2023-01-10 09:09:51 +01:00
Robert
82ce7bc874 Merge pull request #1943 from github/robertbrignull/telemetry_race_condition
Avoid race condition requesting telemetry permissions
2023-01-09 17:38:00 +00:00
Robert
7bbbf8b986 Merge pull request #1942 from github/robertbrignull/telemetryListener_undefined
Acknowledge that telemetryListener may be undefined
2023-01-09 17:09:32 +00:00
Robert
aa950eed6a Avoid race condition requesting telemetry permissions 2023-01-09 16:54:32 +00:00
Robert
f9777016a7 Acknowledge that telemetryListener may be undefined 2023-01-09 16:19:09 +00:00
Nora
c4df8bf7b2 Handle expanded state 2023-01-09 15:01:57 +00:00
Nora
29c29f0b77 Remove db in list from selected 2023-01-09 07:54:33 +00:00
Nora
b5f865432e Add action 2023-01-09 08:26:21 +01:00
Aditya Sharad
8346eda8b8 Integration tests: Accept github/codeql checkouts named ql (#1940)
Some checkouts of the github/codeql repo, such as the
internal submodule, may be named `ql` rather than
`codeql`. Allow this folder name when running tests.
2023-01-06 15:16:36 -08:00
Charis Kyriakou
2a6d581de4 Added logic to clean expanded state when it's updated (#1938) 2023-01-06 16:09:43 +00:00
Shati Patel
b3fcd47930 Add integration test for database selection command (#1937) 2023-01-06 14:38:28 +00:00
Charis Kyriakou
8c558f04f4 Merge pull request #1936 from github/charisk/expansion-tidy
Some minor tidy up around db item expansion
2023-01-06 14:14:56 +00:00
Charis Kyriakou
51d1d3226c Remove unnecessary type casting 2023-01-06 12:57:23 +00:00
Charis Kyriakou
d69a048a38 Handle all db item kinds when checking for equality with expanded items 2023-01-06 12:57:19 +00:00
Charis Kyriakou
971fb6edee Rename updateItemInExpandedState -> updateExpandedItem and replaceItemInExpandedState -> replaceExpandedItem 2023-01-06 12:57:12 +00:00
Elena Tanasoiu
13db377334 Merge pull request #1931 from github/elena/ignore-prettier-commits
Move list of ignored commits to root
2023-01-06 09:37:28 +00:00
Andrew Eisenberg
61c3bef8ff Merge pull request #1932 from github/aeisenberg/fix-vscode-integration-tests
Remove assertion in tests
2023-01-05 16:41:49 -08:00
Andrew Eisenberg
0959cb8bbd Remove assertion in tests
I am removing these assertions so that our internal integration tests
can pass. They are currently failing because the number of dependencies
of the `codeql/javascript-all` pack has changed. It no longer makes
sense to test this value as newer versions of this pack will have more
dependencies and we expect this value will continue to go up.
2023-01-05 16:13:13 -08:00
Elena Tanasoiu
d385a9e7a4 Move list of ignored commits to root
This was initially added [here][1] but wasn't quite in the right place
to have the intended effect.

Let's move it up to the root of the project.

[1]: f515663640
2023-01-05 17:37:41 +00:00
Charis Kyriakou
1c705da444 Add 'rename' context menu action for dbs/lists (#1928) 2023-01-05 13:29:10 +00:00
Shati Patel
4dba169412 Support new DB config format in "copy repo list" function (#1927) 2023-01-05 10:56:55 +00:00
Charis Kyriakou
afc6ce5211 Merge pull request #1926 from github/charisk/db-config-store-rename
Add db and list rename functionality to db config store
2023-01-04 17:38:44 +00:00
Charis Kyriakou
db9bc5bf5c Add db and list rename functionality to db config store 2023-01-04 15:59:14 +00:00
Charis Kyriakou
3227935078 Minor refactoring of the db config store and tests (#1924)
* Remove unnecessary type castings
* Extract validation to separate functions
* Nest tests inside a 'describe' block
2023-01-04 13:11:26 +00:00
Shati Patel
0902e187c8 Add context menu command to open repo/owner on GitHub (#1921) 2023-01-04 10:44:48 +00:00
Charis Kyriakou
35a49b018f Merge pull request #1923 from github/charisk/db-item-expansion-tidy
Some small refactorings around db item expansion
2023-01-04 10:02:33 +00:00
Charis Kyriakou
a82f40fb1e Remove unnecessary config check.
This used to be valid when expanded state lived in the db config, but it's now stored in workspace storage.
2023-01-04 09:28:16 +00:00
Charis Kyriakou
4db3cd6b1b Extract setExpandedItems function so that it can be re-used 2023-01-04 09:10:04 +00:00
Charis Kyriakou
abe5b3c0fc Rename getCurrentExpandedItems -> getExpandedItems 2023-01-04 09:08:21 +00:00
Charis Kyriakou
7738041ee7 Nest tests inside a 'describe' block 2023-01-04 09:07:42 +00:00
Charis Kyriakou
f3d0773085 Rename calculateNewExpandedState -> updateItemInExpandedState 2023-01-04 09:06:31 +00:00
Charis Kyriakou
1a08ae4df2 Move db item expansion models to db-item-expansion 2023-01-04 09:05:12 +00:00
dependabot[bot]
5e864ae8e0 Bump json5 from 1.0.1 to 1.0.2 in /extensions/ql-vscode (#1919)
Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v1.0.1...v1.0.2)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-03 10:10:38 -08:00
dependabot[bot]
f716032235 Bump d3-color and d3-graphviz in /extensions/ql-vscode (#1915)
Bumps [d3-color](https://github.com/d3/d3-color) to 3.1.0 and updates ancestor dependency [d3-graphviz](https://github.com/magjac/d3-graphviz). These dependencies need to be updated together.


Updates `d3-color` from 1.4.1 to 3.1.0
- [Release notes](https://github.com/d3/d3-color/releases)
- [Commits](https://github.com/d3/d3-color/compare/v1.4.1...v3.1.0)

Updates `d3-graphviz` from 2.6.1 to 5.0.2
- [Release notes](https://github.com/magjac/d3-graphviz/releases)
- [Changelog](https://github.com/magjac/d3-graphviz/blob/master/CHANGELOG.md)
- [Commits](https://github.com/magjac/d3-graphviz/compare/v2.6.1...v5.0.2)

---
updated-dependencies:
- dependency-name: d3-color
  dependency-type: indirect
- dependency-name: d3-graphviz
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-03 10:09:58 -08:00
Charis Kyriakou
8e848e3403 Set db tree item context value to drive actions (#1920) 2023-01-03 16:17:51 +00:00
Nora
ae3ed9402d Merge pull request #1918 from github/nora/add-select-context-menu
Add select context menu
2023-01-03 16:40:44 +01:00
Nora
306529b4a9 Add command to activationEvents 2023-01-03 15:10:02 +00:00
Nora
48a51fe10b Add select context menu 2023-01-03 13:34:50 +00:00
Charis Kyriakou
bbbbb3a1ee Renamed selectable context value (#1917) 2023-01-03 12:34:24 +00:00
Charis Kyriakou
bbdbe01e03 Add test tsconfigs in eslint projects (#1916) 2023-01-03 12:17:17 +00:00
Charis Kyriakou
35d1d8ba6e Move VS Code integration tests to /test directory (#1912) 2023-01-03 10:31:38 +00:00
Charis Kyriakou
a7be6cf31a Fix broken unit test that relies on date (#1914) 2023-01-03 09:26:13 +00:00
Charis Kyriakou
40a7dd04fb Tidy up unit test suite file structure (#1910) 2022-12-23 14:23:55 +00:00
Charis Kyriakou
24a7348fc2 Add support for adding local lists (#1907) 2022-12-23 11:11:48 +00:00
Charis Kyriakou
31b80efc56 Use constant for selected db item resource uri (#1908) 2022-12-23 08:34:16 +00:00
Charis Kyriakou
3234f0afe1 Move db item expanded state to workspace storage (#1904) 2022-12-22 15:44:00 +00:00
Elena Tanasoiu
ae0dfd8089 Merge pull request #1901 from github/elena/move-test-scenarios-into-markdown
Move test plan into markdown file
2022-12-22 14:32:08 +00:00
Elena Tanasoiu
1a6f532c8b Change results view title 2022-12-22 14:15:21 +00:00
Elena Tanasoiu
beb5e37f3a American spelling 2022-12-22 14:14:59 +00:00
Elena Tanasoiu
9fe4c8cfa9 Remove copy section 2022-12-22 14:14:35 +00:00
Shati Patel
9e1da8f142 Check for duplicate repo within parent list (#1905) 2022-12-22 14:01:11 +00:00
Elena Tanasoiu
f1b17d1c46 Fix wonky indentation 2022-12-22 12:54:24 +00:00
Elena Tanasoiu
097c048edd Expand results view tests 2022-12-22 12:49:14 +00:00
Elena Tanasoiu
531f32c1f6 Expand query results scenarios based on variant analysis state 2022-12-22 12:49:10 +00:00
Nora
46a54a623a Merge pull request #1900 from github/nora/add-repo-to-list
Add new repositories to a highlighted user defined list
2022-12-22 13:41:27 +01:00
Elena Tanasoiu
1b76159c06 Fix quotes 2022-12-22 11:35:22 +00:00
Elena Tanasoiu
30e614e26d Remove duplicate test case 2022-12-22 11:31:21 +00:00
Elena Tanasoiu
8ca9391115 Mention what "it" means 2022-12-22 11:28:55 +00:00
Elena Tanasoiu
ec8066a11c Clarify these are mostly aimed at MRVA 2022-12-22 11:28:01 +00:00
Elena Tanasoiu
ac27a80769 Drop numbering 2022-12-22 11:27:06 +00:00
Elena Tanasoiu
c9087ffaf0 Update screenshot 2022-12-22 11:26:18 +00:00
Robert
25dd679b7d Merge pull request #1892 from github/robertbrignull/undefined_credentials
Simplify the credentials class, and clear up impossible error cases
2022-12-22 11:20:09 +00:00
Elena Tanasoiu
16c688f9c8 Change to american spelling 2022-12-22 11:15:49 +00:00
Elena Tanasoiu
0f3936900c Remove pre-live-results sections 2022-12-22 11:15:15 +00:00
Elena Tanasoiu
3c9c6dc324 Rephrase ... erm ... phrases
And fix a typo
2022-12-22 11:14:10 +00:00
Elena Tanasoiu
f11cd17f83 Check these when query starts instead of completes 2022-12-22 11:10:05 +00:00
Nora
824f56d614 use find and remove unneccessary checks 2022-12-22 10:53:54 +00:00
Elena Tanasoiu
eddc228a00 Remove bullet points and mention results view 2022-12-22 10:48:36 +00:00
Elena Tanasoiu
812205cecf Clarify that test cases are for MRVA 2022-12-22 10:45:59 +00:00
Elena Tanasoiu
a839206846 Mention canary flag as pre-requisite for MRVA 2022-12-22 10:45:22 +00:00
Elena Tanasoiu
2f07f417fa Move last step to first step in release requirements 2022-12-22 10:43:31 +00:00
Elena Tanasoiu
dc6bd07518 Add more info to release steps 2022-12-22 10:43:08 +00:00
Elena Tanasoiu
e890e6cc1f Remove "Areas to consider" section 2022-12-22 10:32:26 +00:00
Robert
6285ba7632 fix typos 2022-12-22 10:25:34 +00:00
Koen Vlaswinkel
be79d68271 Merge pull request #1891 from github/koesie10/sort-gist-files
Sort Gist files by user-defined sort order
2022-12-22 09:17:07 +01:00
Charis Kyriakou
19a9ad38d5 Add workspace state to app container (#1902) 2022-12-21 17:58:34 +00:00
Elena Tanasoiu
1e84bc9116 Move test plan into VSCode markdown file
This moves our existing test plan under a "Required testing" section.

We're also adding the scenarios used for testing live results under an "Optional testing" section.
2022-12-21 16:55:33 +00:00
Nora
28abd40963 Add repo to list when child is highlighted 2022-12-21 15:45:19 +00:00
Robert
abc025cb39 Inline the createOctokit method
It's now only used from one place and inlining it doesn't make
getOctokit too long to be unclear.
2022-12-21 15:01:47 +00:00
Robert
551f76cc4e Create a new octokit instance every time
I believe this doesn't change the user-visible behaviour at all. The user
won't be prompted to log in any more or less often than they would have
done before.

One benefit of this is that we can remove the registerListeners method
because we no longer need to know if the cached octokit is still valid.
Instead we just call vscode.authentication.getSession every time and it
will return the current session, which might be different from the last
time we called it. This might prompt the user to log in, but that would
have happened anyway because when the session changed we would have
overwritten our cached octokit instance.

Another benefit is that we no longer need the extension context and this
removed a surprisingly large amount of code where we are passing this
parameter around because we need it for the credentials.

The only downside I can see is that we call getSession more often and
create more javascript objects in general. I believe the performance
impact of this will be negligible and not worth worrying about.
2022-12-21 15:01:42 +00:00
Robert
8f34f6af2e Remove the createIfNone parameter from createOctokit
At this point we are only ever passing true, so we may as well remove
the parameter and simplify the code.
2022-12-21 14:52:25 +00:00
Robert
8c05b3a508 Don't try to pre-populate an octokit
I argue that calling createOctokit(false) adds no benefit. If an
authenticated session already exists then this silently create an
octokit, which makes getOctokit() a no-op just returning the field.
However if there is already an authenticated session then getOctokit()
would already be able to create an octokit without prompting the user.

On the other hand if there isn't an authenticated session then we
won't be able to pre-populate an octokit, so getOctokit() will have
to prompt the user anyway.

Not calling createOctokit(false) in registerListeners also doesn't
change behaviour. If the user is authenticated in the new session then
we would be able to create an octokit instance wihtout prompting in
getOctokit anyway. If the user is not authenticated in the new session
then we won't be able to create an instance without prompting either way.

The only benefit I can think of is that it moves a tiny amount of
computation earlier in the pipeline, but the amount of computation is
tiny and it isn't any more async than it would be if it happened in
getOctokit(). I don't think this is worth making the code more complex.
2022-12-21 14:51:13 +00:00
dependabot[bot]
7004e94b32 Bump actions/dependency-review-action from 1 to 3 (#1897) 2022-12-21 14:32:38 +00:00
Robert
74f10a306e Remove the overrideToken parameter from createOctokit
This was only used from initializeWithToken and only added a completely
separate case to the start of the method, effectively turning it into
two separate implementations. Therefore we can make things simpler by
inlining this case in the one place it is used.
2022-12-21 14:27:50 +00:00
Robert
7e8ce35485 Remove the requiresAuthentication parameter
It is true by default and no place in the codebase sets it to false. We can
simplify the code by removing this case we aren't using. If we want this
behaviour in the future we can always implement it again, but I think it's
likely to be unnecessary and if you don't want authenticated requests then
you likely won't be initializing a Credentials object.
2022-12-21 14:24:13 +00:00
Nora
758c182a33 Add repo to highlighted list 2022-12-21 15:23:09 +01:00
Robert
0c483d1e29 Remove places where we are checking if credentials are undefined
This cannot happen already, even before the other changes in this PR.
The Credentials.initialize method can never return undefined, so these
checks would never return true. The real place that checks that we are
authenticated is in the vscode.authentication.getSession method, and
it will reject the promise if the user declines to authenticate or
anything else means we can't get an authenticated session.

I feel justified in removing the tests for these cases because the
code was never actually called in production, and we are covered by the
vscode authentication library rejecting the promise. Any exception
thrown from Credentials.initialize would behave the same as the one I'm
deleting.
2022-12-21 14:23:08 +00:00
dependabot[bot]
4bb3be9fd1 Bump peter-evans/create-pull-request from 3.4.1 to 4.2.3 (#1898) 2022-12-21 14:10:45 +00:00
Shati Patel
f99e5587d0 Update dependencies in workflow files (#1896) 2022-12-21 13:54:49 +00:00
Charis Kyriakou
2493b0fd3c Handle db validation errors gracefully (#1895) 2022-12-21 12:53:47 +00:00
Charis Kyriakou
dbdb4ba57a Stop user from adding a db or owner with the same name (#1893) 2022-12-21 10:51:24 +00:00
Charis Kyriakou
55869e8033 Merge pull request #1894 from github/charisk/add-db-integration-test
Add basic integration test for 'add db' functionality
2022-12-21 10:06:52 +00:00
Charis Kyriakou
47ac9c631e Add basic integration test for 'add db' functionality 2022-12-20 20:42:14 +00:00
Charis Kyriakou
decbd52d1b Rename 'addNewRemoteList' to 'addNewList' 2022-12-20 20:40:58 +00:00
Nora
952faf5efc Merge pull request #1889 from github/shati-nora/add-remote-repositories
Create "Add database" button in DB panel
2022-12-20 17:31:12 +01:00
shati-patel
eb3ba1e229 Merge branch 'main' into shati-nora/add-remote-repositories 2022-12-20 16:13:00 +00:00
Shati Patel
5a3248647b Get highlighted item in DB panel (#1887) 2022-12-20 16:00:45 +00:00
Charis Kyriakou
4b43b9a140 Use ✓ for db item selection (#1890) 2022-12-20 15:00:03 +00:00
Nora
467d43c68c Implement refactor merge comments 2022-12-20 12:58:50 +00:00
Koen Vlaswinkel
fe7d14b136 Sort Gist files by user-defined sort order
This will sort the files in an exported Gist by the user-defined sort
order. It does so by prefixing the files with `result-{index}-` where
the `index` is the 1-based index of the repository in the sort order.
It will automatically pad the index with leading zeros to ensure that
the files are sorted in the correct order.

Unfortunately, we can't just use `{index}-` because numbers sort before
the `_` character, which is used in the summary filename to place it
first.

There are also some changes in how we determine which repositories to
export since we need to know in advance how many zeroes we need to pad
the index with. There should be no functional changes in which
repositories are actually exported.
2022-12-20 13:51:22 +01:00
Nora
f332e6145a Implement addNewDatabase 2022-12-20 11:01:48 +00:00
Nora
6350ac7f66 Merge pull request #1888 from github/nora/refactor-githubnwoowner-helper
Extract github url identifier helper
2022-12-20 12:01:13 +01:00
Nora
7241e317af Move helper to new file and minor refactor 2022-12-20 10:19:42 +00:00
Charis Kyriakou
22ec4b0b6a Don't allow empty list names (#1886) 2022-12-19 11:59:53 +00:00
Taj
5a42b8b890 using secrets instead of actions context 2022-12-16 20:30:14 +00:00
Taj
f2076df73d Merge branch 'main' of github.com:tjgurwara99/vscode-codeql 2022-12-16 20:28:51 +00:00
Taj
c89d267d55 change the order of supported versions 2022-12-16 20:28:29 +00:00
Taj
09d744a98e Merge branch 'github:main' into main 2022-12-16 18:36:37 +00:00
Andrew Eisenberg
2493ddd39a Merge pull request #1885 from github/aeisenberg/lgtm-remove
Remove LGTM references and commands
2022-12-16 10:17:15 -08:00
Andrew Eisenberg
0bf1fae2fe Remove LGTM references and commands
LGTM has been decommissioned. All code and tests for downloading
LGTM databases should be removed.
2022-12-16 09:58:24 -08:00
Taj
f7d48916d9 Merge branch 'github:main' into main 2022-12-16 17:21:43 +00:00
Taj
ec9078d616 permission conf and removed deprecated use of set-output 2022-12-16 17:09:39 +00:00
Charis Kyriakou
8971bee31d Add basic integration test for 'add db list' functionality (#1881) 2022-12-16 14:44:53 +00:00
Taj
2723816a5a namespacing actions branch 2022-12-16 13:40:38 +00:00
Koen Vlaswinkel
281fe56d2b Merge pull request #1883 from github/koesie10/result-performance
Add Storybook story for many results performance
2022-12-16 14:20:06 +01:00
Taj
54204167b6 separation of concern of creating a PR vs code to change the version 2022-12-16 13:12:19 +00:00
Koen Vlaswinkel
c6c6d55bed Add Storybook story for many results performance 2022-12-16 13:28:59 +01:00
Nora
2b1a2cddb1 Merge pull request #1880 from github/nora/move-db-config-factories
Move DbConfig Factories to src directory
2022-12-16 10:05:01 +01:00
Nora
0c2e15a176 Use factory in db tree creator 2022-12-15 14:56:26 +00:00
Nora
1aebd895b1 Use factory in db panel test 2022-12-15 14:53:36 +00:00
Nora
8665a81ec1 Move factory to src 2022-12-15 14:52:51 +00:00
Shati Patel
fecefe4468 Add unit tests to check codeQLDatabasesExperimental.configError value (#1876) 2022-12-15 13:07:17 +00:00
Charis Kyriakou
727da3d78c Add logging around db config loading (#1875) 2022-12-15 12:21:20 +00:00
Charis Kyriakou
468c4a2539 Add logger to the app container (#1874) 2022-12-15 11:28:38 +00:00
Shati Patel
18423ca518 Hide DB panel UI actions when config is broken/undefined (#1866) 2022-12-15 10:50:13 +00:00
Charis Kyriakou
091d793f13 Stop user from adding a db list with the same name (#1873) 2022-12-15 09:21:54 +00:00
Charis Kyriakou
b1bf82d432 Enable awaitWriteFinish for the db config file watcher (#1872) 2022-12-14 15:25:34 +00:00
Charis Kyriakou
602289eb6d Add validation for duplicate names in the db config (#1867) 2022-12-14 12:51:46 +00:00
Taj
3f39af2840 workflow to automatically bump cli version if different from the current version 2022-12-14 00:01:36 +00:00
Shati Patel
bce5d420d6 Bump CLI version to 2.11.6 for integration tests (#1869) 2022-12-13 18:15:49 +00:00
Charis Kyriakou
dc2e17d2f9 Add min length constraints to various properties in the db config schema (#1868) 2022-12-13 17:29:02 +00:00
Nora
b2285499a3 Merge pull request #1860 from github/nora/show-error-empty-list
Show error message when running query on empty list
2022-12-13 17:48:18 +01:00
Shati Patel
5ba2a5af1d Merge pull request #1865 from github/shati-patel/gh-nwo
Extract github nwo helper functions
2022-12-13 15:35:56 +00:00
Nora
0f1881d2bc Merge comments 2022-12-13 15:12:57 +00:00
Charis Kyriakou
e18a33074c Update ValueResult to have generic error type (#1861) 2022-12-13 14:15:52 +00:00
Robert
3b197a21e7 Merge pull request #1864 from github/version/bump-to-v1.7.8
Bump version to v1.7.8
2022-12-13 14:13:12 +00:00
Charis Kyriakou
e987a3535d Fix executeCommand to pass arguments correctly (#1863) 2022-12-13 13:12:10 +00:00
robertbrignull
060b7c6099 Bump version to v1.7.8 2022-12-13 13:10:27 +00:00
shati-patel
674a126078 Extract github nwo helper functions 2022-12-13 12:58:46 +00:00
Robert
2a60faa451 Merge pull request #1862 from github/v1.7.7
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
v1.7.7 release
2022-12-13 12:44:40 +00:00
Robert
578ffe0e2f v1.7.7 2022-12-13 11:55:42 +00:00
Robert
e805ef37eb Merge pull request #1769 from github/robertbrignull/liveResults_true
Make live results enabled for everyone
2022-12-13 11:46:18 +00:00
Robert
1e76e583c7 Make live results enabled for everyone 2022-12-13 11:08:39 +00:00
Nora
ed9592c2d7 Update extensions/ql-vscode/src/vscode-tests/no-workspace/remote-queries/repository-selection.test.ts
Co-authored-by: Robert <robertbrignull@github.com>
2022-12-13 11:37:12 +01:00
Shati Patel
25b9aeba8e DB panel: "Add list" command (#1851) 2022-12-13 09:54:00 +00:00
Nora
35ce928068 Show error message when running query on empty list 2022-12-13 09:53:07 +00:00
Charis Kyriakou
e521112f3e Add db config factory function and use it in tests (#1859) 2022-12-13 08:36:37 +00:00
Charis Kyriakou
216faee279 Db module init tidy up (#1858) 2022-12-12 11:59:57 +00:00
Koen Vlaswinkel
891ce74a80 Merge pull request #1847 from github/koesie10/typecheck-everything
Run type checking on all directories in CI
2022-12-12 11:36:09 +01:00
Koen Vlaswinkel
e2e4879548 Merge remote-tracking branch 'origin/main' into koesie10/typecheck-everything 2022-12-12 10:14:50 +01:00
Koen Vlaswinkel
cac7c3ae4e Simplify gulpfile.ts/tsconfig.json
The `tsconfig.json` inside `gulpfile.ts` needs to match the root
`tsconfig.json`, so by making it extend the root `tsconfig.json` and
changing just the options which decide which files are included, we can
remove a lot of duplication.
2022-12-12 10:13:58 +01:00
Charis Kyriakou
7dedfca369 Properly track collapsed/expanded events (#1856) 2022-12-12 09:00:19 +00:00
Charis Kyriakou
1a0d88135d Add executeCommand to app container (#1857) 2022-12-09 17:12:25 +00:00
Nora
ed76b46fa5 Merge pull request #1853 from github/nora/test-factories-dbitem
Create and use more factories for DbItem creation
2022-12-09 14:27:29 +01:00
Nora
1dc69a125b Merge pull request #1848 from github/nora/db-module-initialization
Initialize DbManager when newQueryRun is enabled
2022-12-09 14:21:50 +01:00
Nora
35f582b731 Implement merge comments 2022-12-09 12:53:40 +00:00
Koen Vlaswinkel
794e874206 Merge pull request #1854 from github/koesie10/upgrade-vsce
Replace vsce by @vscode/vsce
2022-12-09 12:34:18 +01:00
Nora
e7bab9207d Remove unused checks 2022-12-09 09:59:59 +00:00
Koen Vlaswinkel
3bd61ae1a6 Merge remote-tracking branch 'origin/main' into koesie10/upgrade-vsce 2022-12-09 10:36:02 +01:00
Angela P Wen
698b6ad0e4 Bump CLI version to 2.11.5 for integration tests (#1855) 2022-12-09 09:33:29 +00:00
Koen Vlaswinkel
abbebd3d42 Merge pull request #1845 from github/koesie10/variant-analysis-remove-item-tests
Add tests for removing remote queries and variant analyses
2022-12-09 10:30:23 +01:00
Nora
33ef89a28c Use new factories 2022-12-09 10:16:49 +01:00
Nora
a9b2aec353 Create missing factories and test adjustment 2022-12-09 10:16:49 +01:00
Koen Vlaswinkel
1cb0b0b6cb Replace vsce by @vscode/vsce
The `vsce` package has been replaced by `@vscode/vsce`, as announced
in the VSCode 1.74.0 release notes. There should be no functional
changes between 2.7.0 and 2.15.0 for our use case.

See: https://code.visualstudio.com/updates/v1_74#_renaming-of-vsce-to-vscodevsce
2022-12-09 09:48:27 +01:00
Koen Vlaswinkel
3346bd48cb Merge remote-tracking branch 'origin/main' into koesie10/variant-analysis-remove-item-tests 2022-12-09 09:47:46 +01:00
Andrew Eisenberg
5138831cd3 Merge pull request #1852 from github/koesie10/fix-vscode-1.74.0
Fix failing tests on VSCode 1.74.0
2022-12-08 10:20:29 -08:00
Koen Vlaswinkel
484c7db8c5 Use Proxy for _VSCODE_NODE_MODULES
Instead of deleting the complete `_VSCODE_NODE_MODULES` object, we now
use a `Proxy` to intercept the `_isMockFunction` property. This is safer
and will not delete a global variable that VSCode expects to exist.
2022-12-08 18:47:03 +01:00
Koen Vlaswinkel
691121d7c7 Restructure handleRemoveHistoryItem tests
This will restructure the `handleRemoveHistoryItem` tests to be more
structured and easier to read.
2022-12-08 14:01:33 +01:00
Koen Vlaswinkel
1ea3cfddb0 Fix failing tests on VSCode 1.74.0
This fixes the tests on VSCode 1.74.0. The issue is as follows:

1. Jest wil try reset all mocks after each test, as it should.
2. When Jest does this, it will loop over all global variables and check
if they are mocks.
3. One of the global variables it checks is _VSCODE_NODE_MODULES, which
is a proxy object.
4. When Jest checks whether it is a proxy by getting _isMockFunction on
it, the `get` function on the proxy object will be called.
5. This will in turn call require, which will try to load
the non-existing `_isMockFunction` module. This throws the error we are
seeing.

By removing the `_VSCODE_NODE_MODULES` property from the global object
in the Jest environment, Jest will not try to reset it, and the tests
should work again.

See: 41bf230089/packages/jest-runtime/src/index.ts (L1173-L1186)
See: ed442a9e99/src/bootstrap-amd.js (L15)
2022-12-08 11:52:45 +01:00
Koen Vlaswinkel
993b8c94d6 Merge pull request #1832 from github/koesie10/restructure-varianta-analysis-manager-tests
Restructure variant analysis manager tests
2022-12-08 10:04:19 +01:00
Koen Vlaswinkel
79f427c05d Merge pull request #1850 from github/koesie10/upgrade-actions-upload-artifact
Upgrade actions/upload-artifact to v3
2022-12-07 18:55:02 +01:00
Koen Vlaswinkel
d66e7c6198 Merge pull request #1837 from github/koesie10/fix-no-error-empty-repositories
Fix missing error message on repository selection
2022-12-07 17:57:54 +01:00
Koen Vlaswinkel
8205b19125 Upgrade actions/upload-artifact to v3
This upgrades the action to remove a deprecation warning about Node 12.
2022-12-07 17:44:44 +01:00
Koen Vlaswinkel
597c9c48ff Merge pull request #1849 from github/koesie10/date-environment-variables
Add environment variables for date test
2022-12-07 17:36:29 +01:00
Koen Vlaswinkel
7fd45efed8 Merge remote-tracking branch 'origin/main' into koesie10/fix-no-error-empty-repositories 2022-12-07 17:29:44 +01:00
Koen Vlaswinkel
2e7557ba09 Run type checking on all directories in CI
This commit adds a new step to the CI workflow that runs type checking
on all directories containing `tsconfig.json` files, using `find` and
`xargs`. Unfortunately, this does not work on Windows, so on Windows
it's not possible to run all of these type checks locally.
2022-12-07 16:50:19 +01:00
Koen Vlaswinkel
0f5117ecec Merge pull request #1828 from github/koesie10/results-loading
Add spinner when loading results
2022-12-07 16:46:20 +01:00
Koen Vlaswinkel
0ae7bb821d Extract mocking of repo states into method 2022-12-07 16:44:34 +01:00
Koen Vlaswinkel
ba419dd561 Remove duplicate describe 2022-12-07 16:40:15 +01:00
Koen Vlaswinkel
3dd0ef50e0 Merge pull request #1846 from github/koesie10/monitor-multiple-responses-test
Add integration test for variant analysis monitor
2022-12-07 16:38:47 +01:00
Nora
1c1117f7a3 Suggestion: initialize DbManager when newQueryRun is enabled 2022-12-07 16:35:51 +01:00
Koen Vlaswinkel
4e66b62534 Add environment variables for date test
This adds the environment variables necessary for running the date test
in all of these cases:
- When running the npm script outside of VSCode (using `cross-env`)
- When using the Jest Runner "Run" option (`terminal.integrated.env.*`)
- When using the Jest Runner "Debug" option
2022-12-07 16:35:48 +01:00
Nora
572ba290b4 Merge pull request #1838 from github/charis-nora/run-mrva-against-selected-db
Use currently selected remote DB when Variant Analysis is run
2022-12-07 15:05:35 +01:00
Koen Vlaswinkel
63c2932cd9 Add integration test for variant analysis monitor
This integration test will check that the monitor will actually make
multiple requests to the API and that it will trigger a download
extension command for each repo that has finished scanning.
2022-12-07 14:49:32 +01:00
Charis Kyriakou
d97eb2e76b Track expanded state of db items (#1844) 2022-12-07 12:39:18 +00:00
Nora
323862a828 Merge comments 2022-12-07 12:57:10 +01:00
Koen Vlaswinkel
502d4236ad Add tests for removing remote queries and variant analyses
Unfortunately, one of the tests we have for local queries doesn't seem
to be working for variant analyses. I'm not sure why it isn't
working, but I think it's better to get the rest of the integration
tests in and then figure out what's going on with that one.
2022-12-07 12:30:56 +01:00
dependabot[bot]
28652a2088 Bump decode-uri-component from 0.2.0 to 0.2.2 in /extensions/ql-vscode (#1842)
Bumps [decode-uri-component](https://github.com/SamVerschueren/decode-uri-component) from 0.2.0 to 0.2.2.
- [Release notes](https://github.com/SamVerschueren/decode-uri-component/releases)
- [Commits](https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.0...v0.2.2)

---
updated-dependencies:
- dependency-name: decode-uri-component
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-06 17:39:18 +01:00
dependabot[bot]
04b4d15099 Bump @xmldom/xmldom from 0.8.3 to 0.8.6 in /extensions/ql-vscode (#1843)
Bumps [@xmldom/xmldom](https://github.com/xmldom/xmldom) from 0.8.3 to 0.8.6.
- [Release notes](https://github.com/xmldom/xmldom/releases)
- [Changelog](https://github.com/xmldom/xmldom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/xmldom/xmldom/compare/0.8.3...0.8.6)

---
updated-dependencies:
- dependency-name: "@xmldom/xmldom"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-06 17:20:19 +01:00
Shati Patel
7ef75f5971 New DB panel: Add UI command to select database item (#1840) 2022-12-06 16:00:08 +00:00
Koen Vlaswinkel
4bfefb8ebb Merge pull request #1841 from github/koesie10/fix-monitor-await
Fix incorrect await for monitor
2022-12-06 16:30:15 +01:00
Charis Kyriakou
a5fcfe7f40 Add functionality to set the selected db item (#1839) 2022-12-06 15:20:07 +00:00
Nora
7a3d5c1925 Add unit tests 2022-12-06 15:28:14 +01:00
Nora
18c3ce237e Reorder existing tests in new describe blog 2022-12-06 15:25:33 +01:00
Koen Vlaswinkel
6f52469d64 Fix incorrect await for monitor
When rehydrating remote queries, we were awaiting the monitoring
command. Since this command may take minutes to hours to complete, it
seems like this would block the extension from loading. This is the same
issue as in https://github.com/github/vscode-codeql/pull/1698, but for
remote queries instead of variant analyses.
2022-12-06 14:36:00 +01:00
Nora
728f80189b Refactor selection method to allow all types of DbItem lists 2022-12-06 09:41:36 +01:00
Nora
dbba6972e1 Run MRVA against remote DB 2022-12-06 09:41:36 +01:00
Nora
c436688eb2 Merge pull request #1830 from github/nora/selected-db-item
Create method that returns selected DbItem
2022-12-06 09:33:21 +01:00
darkred
127baea584 Update README.md to clarify that vscode-codeql also installs 'Test Adapter Converter' and 'Test Explorer UI' (#1831)
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2022-12-05 09:10:20 -08:00
Nora
425befa959 Add tests 2022-12-05 17:38:40 +01:00
Nora
1050968db1 Update extensions/ql-vscode/test/pure-tests/databases/db-item-selection.test.ts
Co-authored-by: Charis Kyriakou <charisk@users.noreply.github.com>
2022-12-05 16:57:30 +01:00
Nora
7a2f976199 Refactor selection method to allow all types of DbItem lists 2022-12-05 16:21:35 +01:00
Nora
9362881e22 Rename method on db Manager 2022-12-05 16:21:03 +01:00
Nora
60b1f141a1 Rename and reduce test lines 2022-12-05 16:20:49 +01:00
Koen Vlaswinkel
02c8df003a Fix missing error message on repository selection
The repository selection was structured such that you would get in the
`else` case if there was nothing selected, but this case would also be
used if for some other reason the selected item was not valid.

This restructures the conditions to first check whether the user
cancelled out of the operation and will silently return in that case. In
other cases where it cannot determine the repositories, it will now show
a user-visible error.
2022-12-05 15:17:31 +01:00
Koen Vlaswinkel
b91e31cb2c Merge pull request #1835 from github/koesie10/hide-analyzed-when-failed
Hide analyzed panel when it's empty
2022-12-05 14:51:11 +01:00
Koen Vlaswinkel
272aed7d31 Merge pull request #1836 from github/koesie10/fix-view-jest-config
Fix Jest config for view tests
2022-12-05 14:40:17 +01:00
Koen Vlaswinkel
96850e442f Hide analyzed panel when it's empty
This will hide the "Analyzed" panel when there are no scanned repos and
it's completely empty.

When all three panels are empty, this will also hide the search bar and
filters, and will skip rendering anything for the panels.
2022-12-05 14:06:07 +01:00
Koen Vlaswinkel
a19a3297c5 Fix Jest config for view tests
This will allow running the view tests in `src/view`, rather than
only allowing these tests to be run from the root directory.
2022-12-05 13:59:09 +01:00
Shati Patel
795a0bc46d Minor: make changelog entry more consistent (#1834) 2022-12-05 11:19:08 +00:00
Charis Kyriakou
2967777db1 Track parent list name for db items (#1833) 2022-12-05 10:48:33 +00:00
Koen Vlaswinkel
7bb0d0fda9 Restructure variant analysis manager tests
This restructures the variant analysis manager tests to follow this
pattern:
- Class
  - Method
    - Context
      - Context
        - ...
          - Test

Before, we were only using this pattern for some of the tests and this
made it confusing were which method was being tested.

By splitting this off, it will also be easier to move some of these
tests out of the cli-integration tests and into the no-workspace or
minimal-workspace tests.
2022-12-05 11:16:27 +01:00
Koen Vlaswinkel
0e744fdb5a Merge pull request #1822 from github/koesie10/consistent-query-text-file-commands
Make query text and file commands consistent
2022-12-05 10:46:29 +01:00
Koen Vlaswinkel
39a0ef00c4 Merge pull request #1825 from github/koesie10/add-swift-support
Add basic Swift support
2022-12-05 10:23:33 +01:00
Nora
9110af80d8 Add test 2022-12-05 10:08:04 +01:00
Nora
ee056ce2b3 Create method to expose selected DbItem 2022-12-05 10:08:04 +01:00
Nora
2db4a951c2 Merge pull request #1829 from github/nora/fix-vscode-test-setup
Fix problem running integration tests from VsCode test and debug panel
2022-12-05 09:58:03 +01:00
Koen Vlaswinkel
994ebaacd0 Merge pull request #1827 from github/koesie10/filter-sarif-snippets
Limit SARIF code snippet size
2022-12-02 18:46:19 +01:00
Nora
d00dde06ca Adjust launch.json 2022-12-02 16:36:43 +01:00
Koen Vlaswinkel
402b33830d Add tests for excluded snippets 2022-12-02 16:32:29 +01:00
Koen Vlaswinkel
735372ee72 Implement PR feedback 2022-12-02 16:26:24 +01:00
Koen Vlaswinkel
51d3a018de Add spinner when loading results
This will add a spinner to each repo row when the results for a
particular repo are loading. It will also disable the row to make clear
that it is loading and not clickable.
2022-12-02 16:19:56 +01:00
Koen Vlaswinkel
c0187a5650 Limit SARIF code snippet size
This adds a new filtering on SARIF code snippets for very large code
snippets (defined as 8MB or more). If less than 1% of such a snippet
is highlighted, it will not include the code snippet in the analysed
results, and it will thus not be shown in the UI.

This is to avoid very large SARIF files that can cause the extension
host to crash when the analysis results are send to the UI. I don't
think any of these snippets would ever be useful to show, so it should
be fine to just not include them.
2022-12-02 15:33:44 +01:00
Robert
008d7b363f Merge pull request #1826 from github/robertbrignull/check_status
Check variant analysis status in isVariantAnalysisComplete
2022-12-02 14:23:36 +00:00
Koen Vlaswinkel
c9d6bfd32e Merge pull request #1820 from github/koesie10/export-progress
Add progress notification to exporting results
2022-12-02 14:55:28 +01:00
Koen Vlaswinkel
dc2bb3a6e0 Merge remote-tracking branch 'origin/main' into koesie10/export-progress 2022-12-02 14:25:05 +01:00
Robert
1d4cbde48e Check variant analysis status in isVariantAnalysisComplete 2022-12-02 12:45:52 +00:00
Shati Patel
8b354357c1 Show selected item in new DB panel (#1824) 2022-12-02 12:44:51 +00:00
Koen Vlaswinkel
109ee0498e Merge pull request #1816 from github/koesie10/export-cancelled-results
Add exporting of in-progress/cancelled results
2022-12-02 13:03:37 +01:00
Koen Vlaswinkel
944a9115e9 Add basic Swift support
The extension doesn't actually use anything regarding the language of
variant analyses, so this just updates some types.

The actual Swift support is done in the CLI, which is also used for
determining which languages are actually supported. So, the environment
variable is already used by the CLI for showing supported languages.
2022-12-02 11:23:26 +01:00
Koen Vlaswinkel
9c51974cb0 Merge pull request #1821 from github/koesie10/monitor-error-handling
Handle errors when retrieving variant analyses in the monitor
2022-12-02 11:12:29 +01:00
Charis Kyriakou
6d1b5ab1e1 Update the format of selected state and propagate it to the treeview (#1817) 2022-12-01 16:27:21 +00:00
Koen Vlaswinkel
5bee07c712 Merge pull request #1819 from github/koesie10/fix-export-title
Fix Gist title in result export
2022-12-01 14:19:00 +01:00
Koen Vlaswinkel
32f3d32989 Add tests for opening query text/file 2022-12-01 14:03:07 +01:00
Koen Vlaswinkel
dd5da2bbc0 Make query text and file commands consistent
We were using two different implementations for opening the query file
and query text between the query history and the results view. This
moves the better implementation in the view to a command and uses these
commands for opening the query text/file in the query history and view.
This results in consistent error messages and behaviour between the two
different views.
2022-12-01 13:39:35 +01:00
Koen Vlaswinkel
3d81e1b31e Handle errors when retrieving variant analyses in the monitor
This will add error handling to the retrieval of variant analyses in the
monitor by catching the error. It will show a warning to the user and
log it. Then, it will simply sleep for 5 seconds and try again.

I'm not sure if we want to show all of these errors to the user since
this can result in many warnings popping up if many variant analyses are
being monitored, but this is probably that the user should be made aware
of.
2022-12-01 13:22:57 +01:00
Koen Vlaswinkel
bf84dbea69 Merge pull request #1818 from github/koesie10/fix-duplicate-webviews-error
Close serialized webview when another view already exists
2022-12-01 12:55:47 +01:00
Koen Vlaswinkel
7414a77b8a Add progress notification to exporting results
This will add a progress notification to exporting results to give users
feedback about what's happening.

Unfortunately, we need to change some things in how we handle the
actions on completion notifications since we want the progress
notification to disappear when that notification shows. This results in
us having to remove the `await` on the
`showInformationMessageWithAction` calls.
2022-12-01 12:53:10 +01:00
Nora
fb154ab423 Merge pull request #1814 from github/nora/adjust-errormessage-api-response
Adjust for new GitHub Api response
2022-12-01 12:24:28 +01:00
Koen Vlaswinkel
6a431b0719 Fix Gist title in result export
The Gist title in the result export didn't take into account the actual
number of exported repositories, it only used the scanned, unfiltered,
repositories in the variant analysis. This switches it to use the actual
exported repositories for determining the result and repository counts.

This is somewhat more complicated than we'd expect it to be since the
results are being read in async, so we need to switch the order of
operations and store some additional information for being able to
compute this information. However, this also makes the code somewhat
easier to understand since the summary file is now being created in only
1 location, rather than being split between a method and a for-loop.
2022-12-01 12:14:35 +01:00
Koen Vlaswinkel
f6bb233a15 Close serialized webview when another view already exists
When deserializing a webview, it could happen that a view was already
manually opened by the user before the webview was deserialized. This
would result in duplicate webview tabs, which is not supported by the
manager.

This will close the webview that is being deserialized and focus on the
existing view. This should ensure that we never have duplicate loaded
webview tabs. There could still be duplicate webview tabs if there are
non-deserialized tabs, but once it is opened it should be closed
automatically.
2022-12-01 11:43:37 +01:00
Elena Tanasoiu
386e9bb865 Merge pull request #1791 from github/elena/eslint-github
Install `eslint-plugin-github` and apply autofixes where possible
2022-12-01 10:30:04 +00:00
Koen Vlaswinkel
0f7cf2d935 Take into account filters for action buttons
This will disable the export and copy buttons when no results would be
exported by executing the command. In contrast to the "normal" filtering
in the view, this will also take into account the checkboxes since those
are also used in the extension host.
2022-12-01 11:21:28 +01:00
Koen Vlaswinkel
72f253e39f Add exporting of in-progress/cancelled results
This will allow exporting results for a variant analysis which is
cancelled or in-progress. Repositories for which the results are not yet
available or which have not yet been downloaded will not be exported.

The header of the summary file is incorrect, but this will be fixed in
a follow-up PR.
2022-12-01 11:21:26 +01:00
Elena Tanasoiu
168ce8fd28 Add new lint fix 2022-12-01 09:40:33 +00:00
Elena Tanasoiu
0a633a29fe Remove duplicate identifier
This was also caught while running gulp-typescript.
2022-12-01 09:10:47 +00:00
Elena Tanasoiu
d8bbd3de9f Fix faulty import
During the build process, we now get errors pointing out that we import two different
items and call them `QueryServerClient`. One is actually the legacy one and has been
superseded by the new one so far.

Let's fix this and appease the linter.

Full errors:

```

[gulp-typescript]
/home/runner/work/vscode-codeql/vscode-codeql/extensions/ql-vscode/src/extension.ts(88,9):
error TS2300: Duplicate identifier 'QueryServerClient'.

[gulp-typescript]
/home/runner/work/vscode-codeql/vscode-codeql/extensions/ql-vscode/src/extension.ts(89,9):
error TS2300: Duplicate identifier 'QueryServerClient'.

[gulp-typescript]
/home/runner/work/vscode-codeql/vscode-codeql/extensions/ql-vscode/src/extension.ts(1596,30):
error TS2345: Argument of type
'import("/home/runner/work/vscode-codeql/vscode-codeql/extensions/ql-vscode/src/legacy-query-server/queryserver-client").QueryServerClient'
is not assignable to parameter of type
'import("/home/runner/work/vscode-codeql/vscode-codeql/extensions/ql-vscode/src/query-server/queryserver-client").QueryServerClient'.

```
2022-12-01 09:10:47 +00:00
Elena Tanasoiu
99bb04b458 Enable eslint-plugin-github for vscode-tests folder 2022-12-01 09:10:47 +00:00
Elena Tanasoiu
8fcbee6ad4 Enable eslint-github-plugin for view folder 2022-12-01 09:10:47 +00:00
Elena Tanasoiu
195ef45600 Enable eslint-plugin-github for storybook
This also adds the recommended rules for React.
2022-12-01 09:10:46 +00:00
Elena Tanasoiu
56660b1720 Enable eslint-plugin-github in test folder 2022-12-01 09:10:46 +00:00
Elena Tanasoiu
b45c67f24f Autofix prefer-template 2022-12-01 09:10:46 +00:00
Elena Tanasoiu
30cf72b6c8 Autofix object-shorthand 2022-12-01 09:10:46 +00:00
Elena Tanasoiu
670c863f3f Autofix import/no-namespace
I'm leaving the rule turned off as it still has 100+ offenses that aren't
autofixable.
2022-12-01 09:10:44 +00:00
Elena Tanasoiu
754fa67231 Autofix import/no-duplicates 2022-12-01 09:08:33 +00:00
Elena Tanasoiu
706f2e3ca1 Autofix eslint-comments/no-unused-disable 2022-12-01 09:08:33 +00:00
Elena Tanasoiu
dc5d8daa84 Autofix @typescript-eslint/array-type 2022-12-01 09:08:33 +00:00
Elena Tanasoiu
0b9ba3cb94 Start by turning off all rules that have found offences
In the next commits we'll turn these rules on, one-by-one, and then
autofix the offenses.

At the end we'll be left with the rules that require manual attention.
2022-12-01 09:08:33 +00:00
Elena Tanasoiu
f539ba3b85 Enable eslint-plugin-github in main extension folder
There are 5 eslint config files. We're going to enable this plugin one file at a time
and then deal with the fixes.
2022-12-01 09:08:32 +00:00
Elena Tanasoiu
bccc573c6a Install eslint-plugin-github 2022-12-01 09:08:32 +00:00
Koen Vlaswinkel
b273db13d0 Merge pull request #1812 from github/koesie10/load-results-tests
Add tests for loading results
2022-12-01 09:55:25 +01:00
Koen Vlaswinkel
a704a2bf46 Merge pull request #1804 from github/koesie10/stop-monitor-after-remove
Stop variant analysis monitor after removing the variant analysis from the query history
2022-12-01 09:38:23 +01:00
Koen Vlaswinkel
bf328d56d7 Merge remote-tracking branch 'origin/main' into koesie10/stop-monitor-after-remove 2022-11-30 18:29:54 +01:00
Robert
10fe55cff5 Merge pull request #1815 from github/robertbrignull/view_paths
Add theme provider when rendering code flows
2022-11-30 17:26:52 +00:00
Koen Vlaswinkel
b3003fc0ba Merge remote-tracking branch 'origin/main' into koesie10/load-results-tests 2022-11-30 18:23:41 +01:00
Robert
125867d68c Merge pull request #1809 from github/robertbrignull/failed_analysis_spinner
Don't show spinner for a failed analysis
2022-11-30 17:19:33 +00:00
Charis Kyriakou
27b4203d8b Merge pull request #1813 from github/charisk/logging-tidy
Some further tidying up around logging
2022-11-30 16:59:10 +00:00
Robert
f9803fc760 Use toBeInTheDocument 2022-11-30 16:45:36 +00:00
Robert
c958fd2052 Remove unused mock 2022-11-30 16:40:46 +00:00
Robert
adea0b4d77 Add theme provider when rendering code flows 2022-11-30 16:34:50 +00:00
Nora
3dd6effce5 Adjust api response 2022-11-30 17:16:25 +01:00
Koen Vlaswinkel
f3e4766287 Merge pull request #1789 from github/koesie10/remove-variant-analysis-monitor-return-value
Remove variant analysis monitor return value
2022-11-30 16:47:23 +01:00
Robert
3751f3ec6c Add tests 2022-11-30 15:28:21 +00:00
Koen Vlaswinkel
2b9bff14f3 Switch to async methods for fs operations
Hopefully this fixes some issues on Windows.
2022-11-30 16:27:08 +01:00
Robert
45a87192de Merge pull request #1808 from github/robertbrignull/failed_analysis_pending
Don't show pending state when analysis has failed
2022-11-30 15:18:11 +00:00
Charis Kyriakou
c889c09584 Rename logger to extLogger 2022-11-30 13:53:17 +00:00
Charis Kyriakou
45ffd8a45c Tidy up logging docs 2022-11-30 13:28:29 +00:00
Koen Vlaswinkel
6c3731fe98 Add tests for loading results
This adds tests for the `loadResults` method of the variant analysis
results manager. It tests that SARIF results can be successfully
loaded and that the `onResultLoaded` event is fired.
2022-11-30 13:52:33 +01:00
Charis Kyriakou
74e047cbd8 Move logging code to /common/logging and split into multiple files (#1800) 2022-11-30 09:45:29 +00:00
Koen Vlaswinkel
a9a5d098c7 Merge pull request #1811 from github/koesie10/fix-stat-item-header-color
Fix header color of stat item
2022-11-30 09:59:31 +01:00
Koen Vlaswinkel
8f0e6154ad Remove variant analysis monitor return value
The monitor return value was only used in tests, but we can also assert
the correct behavior using the calls it makes, rather than using the
result of the monitor.
2022-11-30 09:55:16 +01:00
Koen Vlaswinkel
2895e84586 Merge pull request #1798 from github/jest-migration/integration-tests
Migrate integration tests to Jest
2022-11-30 09:54:35 +01:00
Koen Vlaswinkel
56585b43e6 Merge remote-tracking branch 'origin/main' into jest-migration/integration-tests 2022-11-30 09:06:07 +01:00
Koen Vlaswinkel
6dc1f9f601 Merge pull request #1801 from github/jest-migration/retry-tests
Add retries of CLI integration tests
2022-11-30 08:49:49 +01:00
Andrew Eisenberg
91edad8df2 Merge pull request #1662 from github/alexet/update-lsp
Update languageserver-client
2022-11-29 10:37:19 -08:00
Alexander Eyers-Taylor
2637d6d00c Added changelog entry for updated vscode version. 2022-11-29 17:24:54 +00:00
Robert
4771d9b834 Add tests of a pending and failed variant analysis 2022-11-29 16:33:03 +00:00
Koen Vlaswinkel
e6fb4803d1 Merge pull request #1810 from github/koesie10/storybook-themes
Add additional Storybook VSCode themes
2022-11-29 17:21:36 +01:00
Koen Vlaswinkel
c7dbaebcec Fix header color of stat item
The header color of a stat item was using the badge foreground color,
but badges can have a different background color than the editor. For
some themes, this would result in unreadable text. By using the editor
foreground color, the header should be readable in many more themes.
2022-11-29 17:19:14 +01:00
Koen Vlaswinkel
3fdc328767 Add additional Storybook VSCode themes
This adds four new VSCode themes to Storybook which will allow us to
more easily test these themes in Storybook. These themes were chosen
because they are either used for accessibility (the high contrast
themes) or are currently not compatible with the variant analysis UI
(there are items that are not visible).
2022-11-29 16:49:04 +01:00
Koen Vlaswinkel
ec9d6b1907 Merge pull request #1806 from github/koesie10/fix-loading-results
Fix loading results in second opened view
2022-11-29 16:30:25 +01:00
Robert
2cdd6de38e Don't show spinner for a failed analysis 2022-11-29 15:00:41 +00:00
Robert
339819c82b Don't show pending state when analysis has failed 2022-11-29 14:56:09 +00:00
Shati Patel
75b684b00f MRVA: Fix typo in repo cancellation message (#1807) 2022-11-29 14:37:19 +00:00
Koen Vlaswinkel
bc65d8f311 Fix loading results in second opened view
When results were already cached in memory and the view requested the
result, it would not be loaded because the event would not be fired.
This fires the event when the result is loaded from cache as well, to
ensure that the view always receives the result.
2022-11-29 14:26:36 +01:00
Koen Vlaswinkel
0047186c83 Fix rehydration in variant analysis removal test 2022-11-29 11:41:57 +01:00
Koen Vlaswinkel
ff3b6091c6 Stop variant analysis monitor after removing it
This will stop the variant analysis monitor from monitoring when a
variant analysis is removed from the query history. Since the variant
analysis monitor cannot depend on the variant analysis manager (this
would create a circular dependency), a function is passed into the
variant analysis monitor for checking whether the variant analysis
should be cancelled.

This commit will also ensure that even if a variant analysis comes in
through the `onVariantAnalysisChange` callback, it won't be added to
the variant analysis map of the manager.
2022-11-29 11:12:46 +01:00
Koen Vlaswinkel
a1b81d9b6f Merge pull request #1802 from github/koesie10/path-basename
Show correct query filename on Windows
2022-11-29 09:03:11 +01:00
Koen Vlaswinkel
4bc97b850c Show correct query filename on Windows
On Windows, we were showing the full path to the query, rather than just
the filename. This is because the `path` package being imported was
actually `path-browserify` which only claims support for POSIX. Since
Windows uses backslashes rather than forward slashes for paths, this
resulted in the full path being shown.

This creates a new `basename` function that works on both POSIX and
Windows by detecting whether a POSIX or Windows path is given. This
ensures that the correct path is shown on Windows, and will also ensure
that we show the correct path on Linux if the user has opened a variant
analysis that was originally created on Windows.
2022-11-28 15:47:54 +01:00
Koen Vlaswinkel
7ba90275a8 Increase scenarios in which retries will be used
This will update the `jest-runner-vscode` patch to retry tests that fail
due to no test result being returned from the test runner.

This will also add some retries to the `minimal-workspace` and
`no-workspace` tests to help with flakiness.
2022-11-28 13:05:14 +01:00
Koen Vlaswinkel
9a9a8c5ac4 Fix multiple VSCode instances launching
Multiple VSCode instances were being launched when a second instance of
VSCode was being spawned with the same user data directory. This is
probably because VSCode restores the windows from the previous session,
even when `-n`/`--new-window` is passed.

This fixes it by patching `jest-runner-vscode` to always create a new
temporary user data directory, rather than re-using the same one for
all test suites.
2022-11-28 11:51:23 +01:00
Koen Vlaswinkel
644bea27ad Add retries of CLI integration tests
This will patch `jest-runner-vscode` to retry tests. This is a temporary
test to see if this will help with the flakiness of the CLI integration
tests.

The biggest problem with this is that it will launch multiple VSCode
instances on every retry:
- First try (not a retry): 1 instance
- Second try: 2 instances
- Third try: 3 instances
- etc.

I'm not sure why this is happening and can't really narrow it down to a
specific cause. Even if I change the `runVSCode` call for the retry by
a simple `cp.spawn` call, it still launches multiple instances.
2022-11-28 11:32:17 +01:00
Koen Vlaswinkel
68de9f09e4 Disable fail-fast for CLI integration tests 2022-11-25 18:37:15 +01:00
Alexander Eyers-Taylor
a16366caae More changes to make lint happy 2022-11-25 17:17:16 +00:00
Alexander Eyers-Taylor
ccf4fad912 Hopefully make lint happy 2022-11-25 16:57:50 +00:00
Alexander Eyers-Taylor
5754d19327 Merge remote-tracking branch 'origin/main' into alexet/update-lsp 2022-11-25 16:53:43 +00:00
Koen Vlaswinkel
595b14cf30 Merge pull request #1797 from github/jest-migration/docs
Add documentation for running a single test
2022-11-25 14:33:15 +01:00
Koen Vlaswinkel
858a3268df Merge remote-tracking branch 'origin/main' into jest-migration/integration-tests 2022-11-25 13:42:02 +01:00
Koen Vlaswinkel
55408a7e0b Merge pull request #1792 from github/jest-migration/windows
Use `patch-package` to add Windows support
2022-11-25 13:40:29 +01:00
Koen Vlaswinkel
24a61d387d Add documentation for running a single test 2022-11-25 13:36:07 +01:00
Koen Vlaswinkel
927817f99d Add debugging support to jest-runner
This adds debugging support to jest-runner for the integration tests
when they are run from the `out` directory. Unfortunately, this removes
the ability to debug the non-integration tests, such as the pure tests.
2022-11-25 13:36:07 +01:00
Koen Vlaswinkel
e60ed32731 Merge pull request #1795 from github/jest-migration/ts-jest
Use ts-jest for running integration tests
2022-11-25 13:35:28 +01:00
Charis Kyriakou
003b9dcf2c Add launch configuration to run single unit test (#1796) 2022-11-25 12:24:40 +00:00
Koen Vlaswinkel
a23a8f78dd Use ts-jest for running integration tests
Instead of running the integration tests from the `out` directory, this
will run the integration tests from the `src` directory using `ts-jest`.

Unfortunately, we are not able to use TypeScript files for the
`jest-runner-vscode` configuration since `cosmiconfig` (the package that
handles the configuration loading for `jest-runner-vscode`) doesn't
support loading TypeScript files by default.
2022-11-25 13:06:03 +01:00
Shati Patel
f6613867d3 Bump CLI version to 2.11.4 for integration tests (#1794) 2022-11-25 11:40:28 +00:00
Koen Vlaswinkel
51425915d9 Use fs-extras and async methods for file manipulation 2022-11-25 11:40:56 +01:00
Koen Vlaswinkel
754cad3815 Merge pull request #1793 from github/jest-migration/debug
Add debugging support for Jest integration tests
2022-11-25 11:20:19 +01:00
Koen Vlaswinkel
430bcd0aa2 Increase timeout for legacy query server tests 2022-11-25 10:59:50 +01:00
Koen Vlaswinkel
4be69e858c Add debugging support for Jest integration tests
Since we are launching a completely different process for the extension
tests than the process that is launched by VSCode, we need to add some
special handling for the debugging.

This will let the extension host/VSCode expose a debugging port, which
VSCode will then connect to. This is "less desirable than letting the
bootloader do its thing", but a packaged VSCode application does not
allow using the bootloader (`NODE_OPTIONS`=`--require=...`). Therefore,
we have to fallback to this option.

See: 47c60558ec/src/configuration.ts (L405-L411)
2022-11-25 10:41:22 +01:00
Koen Vlaswinkel
9fc2c38970 Merge pull request #1790 from github/jest-migration/cleanup-mocha
Clean up Mocha, Sinon and Chai
2022-11-25 10:41:17 +01:00
Koen Vlaswinkel
aa5026f192 Use patch-package to add Windows support
This will apply the same change as the PR on `jest-runner-vscode` in
the local `node_modules` on every install, ensuring that we have
Windows support.
2022-11-25 10:11:19 +01:00
Koen Vlaswinkel
e55b8a366e Clean up Mocha, Sinon and Chai
This removes the Mocha, Sinon and Chai-related packages and removes
unused code from the test suite.
2022-11-24 17:24:43 +01:00
Koen Vlaswinkel
5841fbccd7 Merge pull request #1785 from github/jest-migration/cli-integration
Migrate CLI integration tests to Jest
2022-11-24 17:15:23 +01:00
Koen Vlaswinkel
925acbd36e Merge remote-tracking branch 'origin/jest-migration/integration-tests' into jest-migration/cli-integration 2022-11-24 17:02:33 +01:00
Charis Kyriakou
91ca9481eb Migrate minimal-workspace integration tests to Jest (#1786) 2022-11-24 16:01:20 +00:00
Koen Vlaswinkel
f830c23018 Fix variant analysis submission integration test
Apparently, we're not importing the same `config` file as is used by the
actual extension, so mocking methods in this file does not do anything.
However, we can mock the `vscode` module, so we can use this for
returning different values in the configuration.

We also need to mock the authentication session since we don't have one.
2022-11-24 13:38:40 +01:00
Koen Vlaswinkel
52e2a63828 Fix missed toHaveLength on object 2022-11-24 13:21:52 +01:00
Koen Vlaswinkel
3f76ad6eb8 Fix variant analysis and remote queries tests 2022-11-24 13:10:42 +01:00
Koen Vlaswinkel
1c0d6b991a Enable restoreMocks Jest configuration option
This will ensure all mocks are restored after every test. This required
a significant amount of changes in the tests since `jest.spyOn` now
needs to be called in `beforeEach`, rather than in the `describe` block.
2022-11-24 12:27:18 +01:00
Koen Vlaswinkel
68d867ef76 Fix remote queries manager tests
There were some things that were breaking due to version checks. Since
we aren't testing on these CLI versions (2.7.2 and 2.7.4 or older)
anymore, we can remove these checks and simplify the tests.
2022-11-24 11:36:03 +01:00
Koen Vlaswinkel
e04f941cee Fix spy on undefined variable 2022-11-24 10:44:08 +01:00
Koen Vlaswinkel
558eb19c97 Remove unnecessary calls to mockReset 2022-11-24 10:24:48 +01:00
Koen Vlaswinkel
31b64d2f73 Fix incorrect to.contain transformation
For `to.contain`, `jest-codemods` seems to have converted these to be
`expect.arrayContaining`, even for strings. This will make the correct
change for strings.
2022-11-24 10:23:14 +01:00
Koen Vlaswinkel
d02a5cd3dc Do not use toHaveLength for objects
Mocha supported `.to.have.length` for objects, but Jest only allows
`toHaveLength` on objects which have a length property (such as arrays).
2022-11-24 10:23:14 +01:00
Koen Vlaswinkel
e895078913 Do not use .skip from within tests
Jest does not support skipping tests when the test has already started
(which could also be in a before hook), so we need to manually return
from the tests when the CLI version does not support a tested feature.
2022-11-24 10:23:14 +01:00
Koen Vlaswinkel
1a10fd35f1 Remove calls to fail
Instead of calling `fail`, we can just let the error be caught by Jest,
which will automatically fail the tests. For other instances where we're
calling `fail` in case an error was not thrown, we will instead use
`.rejects.toThrow`.
2022-11-24 10:23:13 +01:00
Koen Vlaswinkel
614785fb7a Do not dispose the extension after every test file 2022-11-24 10:22:47 +01:00
Koen Vlaswinkel
4f8d68d8a2 Always activate the extension before running tests 2022-11-24 10:22:47 +01:00
Koen Vlaswinkel
dc6de0f8a8 Fix async describes 2022-11-24 10:22:47 +01:00
Koen Vlaswinkel
e5967c3851 First pass on converting cli-integration tests to Jest
This is a first pass on converting the cli-integration tests to Jest. It
uses a custom Jest runner (based on the jest-runner-vscode) to install
required extensions. It will also necessary to move some code for
installating the CLI to ensure it was possible to install the CLI from
outside VSCode.

Most of the conversion has been done by `npx jest-codemods`, but all
migration of Sinon has been done manually.
2022-11-24 10:22:45 +01:00
Koen Vlaswinkel
c31635fe90 Merge pull request #1782 from github/jest-migration/no-workspace
Migrate no-workspace integration tests to Jest
2022-11-24 10:21:50 +01:00
Koen Vlaswinkel
e26e1113be Remove calls to fail
Instead of calling `fail` and catching an error, this will use the
`rejects.toThrow` assertion to check that a Promise rejects with a
specific error.
2022-11-24 10:04:37 +01:00
Koen Vlaswinkel
01f6576e95 Clarify comment for activation test 2022-11-24 09:58:10 +01:00
Koen Vlaswinkel
347d234906 Use projects arg to run the Jest tests 2022-11-24 09:56:08 +01:00
Koen Vlaswinkel
043a7b1039 Use resetMocks option to reset mocks before every test 2022-11-24 09:55:48 +01:00
Koen Vlaswinkel
b10cb7771e Merge pull request #1784 from github/koesie10/move-filter-sort
Move filter and sort tests to pure tests
2022-11-23 16:39:29 +01:00
Koen Vlaswinkel
80b2a43be9 Move filter and sort tests to pure tests
The filter and sort tests were located inside the React tests since they
were already using Jest. Now that the pure tests have been switched to
Jest, these tests can finally be moved to the "normal" pure tests.
2022-11-23 14:06:57 +01:00
Koen Vlaswinkel
a985bcb872 Use different method of running tests 2022-11-23 11:23:15 +01:00
Koen Vlaswinkel
90dd97fbc0 Use correct jest-runner-vscode for no-workspace 2022-11-23 11:23:15 +01:00
Koen Vlaswinkel
0296db8b25 Move jest-runner-vscode config to correct location 2022-11-23 11:23:15 +01:00
Koen Vlaswinkel
65bb61b530 Set timeouts on tests correctly
The timeouts need to be set either on a per-file basis, or per test by
using the parameter in `it`. Since we have both Mocha and Jest types, we
need to declare in the test file which one we're using.
2022-11-23 11:23:15 +01:00
Koen Vlaswinkel
3da0034953 Do not run integration tests in parallel
This results in parallel downloads of VSCode, which is not supported.
2022-11-23 11:23:15 +01:00
Koen Vlaswinkel
a0ab34bf55 Migrate no-workspace integration tests to Jest
This migrates all no-workspace VSCode integration tests to Jest by
running `npx jest-codemods`, followed by manual fixes (mostly for Sinon
and Proxyquire).
2022-11-23 11:23:13 +01:00
Koen Vlaswinkel
cc869daf05 Merge pull request #1783 from github/koesie10/split-workflow-files
Split workflow run into more jobs
2022-11-23 10:59:54 +01:00
Koen Vlaswinkel
1c820b4812 Switch from npm install to npm ci in CI 2022-11-23 10:44:45 +01:00
Koen Vlaswinkel
d215c7e2de Split workflow run into more jobs
The unit tests and linting is now run separately, which will hopefully
speed up the time it takes for the integration tests to complete.
2022-11-23 10:19:34 +01:00
Koen Vlaswinkel
a88039bf0b Merge pull request #1780 from github/koesie10/jest-pure-tests
Convert pure tests to Jest
2022-11-22 16:13:05 +01:00
Koen Vlaswinkel
f5c39d7931 Improve error message for empty array
When `jest-codemods` was run, it replaced the error message `array.join`
by a comment for the error message. Since Jest does not support custom
error messages out-of-the-box, this will instead do an equality check
with an empty array, which will ensure that the received array is
printed.
2022-11-22 15:54:22 +01:00
Charis Kyriakou
261933b6a9 Install VS Code jest runner (#1781) 2022-11-22 11:01:46 +00:00
Nora
33eb33405e Merge pull request #1776 from github/nora/update-compiler-target
Update compiler target version in gulp and extension tsconfig
2022-11-22 11:55:14 +01:00
Koen Vlaswinkel
ec60f3f000 Dispose config store in tests
The config store was not being disposed in tests, resulting in Chokidar
watchers being left open. This was causing tests to not exit since there
were still open file descriptors.

This commit also fixes the `DbConfigStore` to make the correct `super`
call in its `dispose` method.
2022-11-22 11:53:21 +01:00
Koen Vlaswinkel
0974700557 Convert pure tests to Jest
This converts all pure tests to Jest. This was done by first running
`npx jest-codemods` with the Mocha transformation, then manually fixing
any places where it hadn't automatically converted the correct thing
or had missed things (mostly Sinon).

This also sets up VSCode correctly for running Jest.
2022-11-22 10:39:21 +01:00
Koen Vlaswinkel
03f1547160 Merge pull request #1777 from github/koesie10/jest-config-projects
Add project-based Jest config
2022-11-22 09:44:23 +01:00
Andrew Eisenberg
91a5db7359 Merge pull request #1779 from github/version/bump-to-v1.7.7
Bump version to v1.7.7
2022-11-21 12:02:20 -08:00
aeisenberg
fbd2cbd3aa Bump version to v1.7.7 2022-11-21 19:39:04 +00:00
Andrew Eisenberg
f36ab18310 Merge pull request #1778 from github/v1.7.6
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
v1.7.6
2022-11-21 09:42:39 -08:00
Andrew Eisenberg
663b26328b v1.7.6 2022-11-21 09:01:47 -08:00
Koen Vlaswinkel
55534e19d6 Add project-based Jest config
This moves the view Jest config to the view directory and adds a new
jest.config.js file which only references the view directory as a
project. This will make it easier to add multiple Jest configs for
separate projects.
2022-11-21 16:41:47 +01:00
Nora
b6f33d7c7b Update compiler target version in gulp and extension tsconfig 2022-11-21 15:49:38 +01:00
Andrew Eisenberg
e93d8393ca Merge pull request #1774 from github/aeisenberg/fix-mrva-packs
Allow synthetic variant analysis packs to handle `${workspace}`
2022-11-18 15:00:05 -08:00
Andrew Eisenberg
24bbd5153c Allow synthetic variant analysis packs to handle ${workspace}
`${workspace}` references are new in CLI version 2.11.3. These mean that
the version depended upon in a pack must be the version available in the
current codeql workspace.

When generating a variant analysis pack, however, we copy the target
query and generate a synthetic pack with the original dependencies.
This breaks workspace references since the synthetic pack is no longer
in the same workspace.

A simple workaround is to replace `${workspace}` with `*` references.
2022-11-18 14:47:07 -08:00
Andrew Eisenberg
4eb465277a Update gitignore to avoid codeql metadata files
Also, we're no longer using the rush package manager, so delete that
from gitignore.
2022-11-18 11:33:53 -08:00
Koen Vlaswinkel
3e7e4b86bd Merge pull request #1525 from github/koesie10/prettier
Add Prettier
2022-11-17 09:58:47 +01:00
Koen Vlaswinkel
f515663640 Add .git-blame-ignore-revs file for previous commit
See https://www.stefanjudis.com/today-i-learned/how-to-exclude-commits-from-git-blame/
2022-11-16 19:07:01 +01:00
Koen Vlaswinkel
ebcdf8ad0b Run Prettier on all files
This will change all existing files to match Prettier formatting.

The command used is `npm run format`.
2022-11-16 19:06:13 +01:00
Koen Vlaswinkel
f41ca1a330 Add Prettier
This adds Prettier and makes it replace tsfmt. VSCode is set to use
Prettier for formatting TypeScript/TSX files and format on save since
Prettier is very fast and does not cause any noticeable delay.
2022-11-16 19:04:17 +01:00
Koen Vlaswinkel
6219b43051 Merge pull request #1766 from github/koesie10/export-results-sorting-filtering
Add filtering and sorting to exported results
2022-11-16 19:01:36 +01:00
Koen Vlaswinkel
47297800ab Merge remote-tracking branch 'origin/main' into koesie10/export-results-sorting-filtering 2022-11-16 18:44:36 +01:00
Koen Vlaswinkel
5838f1b6a3 Merge pull request #1765 from github/koesie10/selected-copy
Use selected repositories for copying repo lists
2022-11-16 18:41:46 +01:00
Koen Vlaswinkel
bbaa27a1f0 Split filter and sort methods and simplify type checks 2022-11-16 16:32:17 +01:00
dependabot[bot]
d7fd84c8e1 Bump loader-utils from 1.4.1 to 1.4.2 in /extensions/ql-vscode (#1772)
Bumps [loader-utils](https://github.com/webpack/loader-utils) from 1.4.1 to 1.4.2.
- [Release notes](https://github.com/webpack/loader-utils/releases)
- [Changelog](https://github.com/webpack/loader-utils/blob/v1.4.2/CHANGELOG.md)
- [Commits](https://github.com/webpack/loader-utils/compare/v1.4.1...v1.4.2)

---
updated-dependencies:
- dependency-name: loader-utils
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-16 15:03:23 +00:00
Koen Vlaswinkel
6aaa7d63a7 Simplify type checks for repositoryIds 2022-11-16 13:02:55 +01:00
Robert
ed0868ba26 Merge pull request #1768 from github/robertbrignull/openVariantAnalysis
Remove the openVariantAnalysis command
2022-11-16 11:04:02 +00:00
Shati Patel
b2a3703d3a Render nodes for local database items (#1759) 2022-11-16 11:03:49 +00:00
Nora
539dd1f0f3 Merge pull request #1771 from github/nora/move-db-panel-files
New DB Panel: Move config files to config folder
2022-11-16 10:55:30 +01:00
Koen Vlaswinkel
2a30c669e1 Merge pull request #1760 from github/koesie10/filter-export-copy
Add filtering and sorting to exported repo list
2022-11-16 10:31:52 +01:00
Nora
bd6c3add1b Move files to config folder 2022-11-16 10:22:54 +01:00
Charis Kyriakou
435fc0a327 Fix rootDir used in test tsconfig (#1770) 2022-11-16 09:01:55 +00:00
Koen Vlaswinkel
53c1a585c1 Simplify filtering of repositories
Co-authored-by: Elena Tanasoiu <elenatanasoiu@github.com>
2022-11-16 09:53:37 +01:00
Andrew Eisenberg
ede534cf5f Merge pull request #1744 from github/aeisenberg/new-query-server
Enable the new query server by default
2022-11-15 13:24:01 -08:00
Andrew Eisenberg
9a7489f6cd Merge pull request #1674 from github/aeisenberg/assert-version
Assert VSCode version is high enough
2022-11-15 10:51:42 -08:00
Robert
2f5f09550d Remove openVariantAnalysis command 2022-11-15 16:49:49 +00:00
Koen Vlaswinkel
1793963f06 Merge branch 'koesie10/selected-copy' into koesie10/export-results-sorting-filtering 2022-11-15 16:14:45 +01:00
Koen Vlaswinkel
e0230375e3 Merge branch 'koesie10/filter-export-copy' into koesie10/selected-copy 2022-11-15 16:13:29 +01:00
Koen Vlaswinkel
b8a0ed4ec3 Merge remote-tracking branch 'origin/main' into koesie10/filter-export-copy 2022-11-15 16:12:13 +01:00
Nora
846eda5428 Merge pull request #1761 from github/nora/add-selected-state-to-db-config
Add selected to config
2022-11-15 16:09:06 +01:00
Koen Vlaswinkel
796611d3bc Merge pull request #1758 from github/koesie10/export-results-from-view
Add exporting of results to view
2022-11-15 16:02:23 +01:00
Koen Vlaswinkel
c88b32091b Merge pull request #1750 from github/koesie10/export-results
Add exporting of results from the context menu
2022-11-15 16:01:50 +01:00
Nora
a012d80341 Merge comments 2022-11-15 15:48:28 +01:00
Charis Kyriakou
542a78e4ef Stop showing warnings for unhandled requests by the mock API server (#1767) 2022-11-15 14:45:21 +00:00
Nora
cf7e33363a Resolve conflicts 2022-11-15 14:19:51 +01:00
Nora
0505d5a0ab Merge comments 2022-11-15 14:19:51 +01:00
Nora
27f62bc1ff Add selected to config 2022-11-15 14:19:51 +01:00
Koen Vlaswinkel
5ed4981673 Add tests for handleCopyRepoList and handleExportResults 2022-11-15 14:13:35 +01:00
Koen Vlaswinkel
e9681bc546 Restore private visibility of loadResultsFromStorage 2022-11-15 13:20:44 +01:00
Koen Vlaswinkel
7486431bea Use options instead of separate method for skipping cache store
This adds a new options argument to the `loadResults` method which
allows the caller to specify that the results should not be saved to the
cache. This exposes a smaller API surface and makes it harder to misuse
the methods.
2022-11-15 13:16:59 +01:00
Koen Vlaswinkel
95e073b9a4 Use separate directory for variant analysis exports
Each variant analysis export can be different due to different filters,
so there are two options:
- We need to clean up the directory before each export to ensure no old
  files are left
- We need to use a separate directory for each export

This implements the second option, which is more flexible and allows the
user to retain different result exports.
2022-11-15 13:05:37 +01:00
Koen Vlaswinkel
f94837ebca Add filtering and sorting to exported results
This adds filtering (based on search and selected repositories) and
sorting to exporting results. This is done in the same way as for
copying the repository list, so the changes are fairly minimal.
2022-11-15 12:06:06 +01:00
Koen Vlaswinkel
dd1ced9ba3 Merge branch 'koesie10/selected-copy' into koesie10/export-results-sorting-filtering 2022-11-15 12:02:21 +01:00
Charis Kyriakou
f1b24987eb Re-render db panel on config update (#1763) 2022-11-15 10:36:38 +00:00
Koen Vlaswinkel
4ed409d91a Use selected repositories for copying repo lists
This will use the selected repositories to limit which repositories are
included in the copied repo list. If there are both selected
repositories and a search filter (on the full name), the search filter
will be ignored and the selected repositories will be used in full.
2022-11-15 11:23:01 +01:00
Charis Kyriakou
39ae3cd7f4 Add mode and subscriptions to App container (#1762) 2022-11-15 10:03:10 +00:00
Koen Vlaswinkel
73ff057df0 Merge remote-tracking branch 'origin/main' into koesie10/filter-export-copy 2022-11-15 10:53:58 +01:00
Andrew Eisenberg
2dd482a8a4 Enable the new query server by default 2022-11-14 17:36:31 -08:00
Andrew Eisenberg
93cc4082dc Merge branch 'main' into aeisenberg/assert-version 2022-11-14 17:35:25 -08:00
Charis Kyriakou
345125994a Revert "Rename iconPath to icon" (#1764)
* Revert "Rename iconPath to icon (#1742)"

This reverts commit 93b6abeeb4.

* Add comment to explain things
2022-11-14 16:38:59 +00:00
Koen Vlaswinkel
9b0fe4ddc7 Merge pull request #1755 from github/koesie10/checkbox-state
Keep track of checkbox state in view
2022-11-14 17:18:30 +01:00
Charis Kyriakou
fca2faf021 Add extension and storage paths to App container (#1756) 2022-11-14 15:47:58 +00:00
Koen Vlaswinkel
30988993be Simplify canSelect method
Co-authored-by: Robert <robertbrignull@github.com>
2022-11-14 16:33:08 +01:00
Koen Vlaswinkel
bb4307ea3e Add filtering and sorting to exported repo list
This will pass the filter and sort parameters in the export repo list
message so it can be used by the command to filter and sort the
repositories which are placed in the repo list.
2022-11-14 14:50:52 +01:00
Koen Vlaswinkel
82a7fc5070 Move filter and sort functions to pure
These functions can be re-used by the sorting and filtering code for
exporting results and copying repository lists, so these should not be
in the view directory.

The tests have been kept in the same place for now, but they should be
moved to the pure tests directory once those have been switched to Jest.
I figured it wasn't worth it to convert these to Mocha, and convert them
back to Jest in a week.
2022-11-14 14:10:40 +01:00
Shati Patel
3fd9fd449c Add support for local dbs in config (#1751) 2022-11-14 12:45:18 +00:00
Koen Vlaswinkel
d6ae5b1359 Add exporting of results to view
This will allow a user to export the results from the view by clicking
the "Export results" button.
2022-11-14 12:03:30 +01:00
Koen Vlaswinkel
922d2122a7 Merge remote-tracking branch 'origin/main' into koesie10/export-results 2022-11-14 12:01:23 +01:00
Koen Vlaswinkel
f48567101a Merge pull request #1757 from github/koesie10/copy-repo-list-from-view
Add copying of repository list to view
2022-11-14 11:55:59 +01:00
Koen Vlaswinkel
96c24ccd5b Add copying of repository list to view
This will allow a user to use the "Copy repository list" button in the
view to copy a repository list.
2022-11-14 11:26:04 +01:00
Koen Vlaswinkel
6168145116 Merge pull request #1753 from github/koesie10/copy-repo-list
Add copying of repository list for variant analyses
2022-11-14 09:48:43 +01:00
Charis Kyriakou
a05313733f Add event emitter abstraction (#1754) 2022-11-11 16:28:20 +00:00
Koen Vlaswinkel
4caa1e2d82 Merge remote-tracking branch 'origin/main' into koesie10/export-results 2022-11-11 16:49:35 +01:00
Koen Vlaswinkel
e90f3d0b46 Keep track of checkbox state in view
This will add a new `useState` call on the top-level to keep track of
the checkbox state. It will allow all downloaded repositories to be
selected. This will allow us to make the copy repository list and export
results button dependent on the selected repositories.
2022-11-11 16:33:20 +01:00
Shati Patel
7e8fa5c5fe Bump CLI version to 2.11.3 for integration tests (#1752) 2022-11-11 14:35:37 +00:00
Koen Vlaswinkel
baae8d5710 Merge remote-tracking branch 'origin/main' into koesie10/copy-repo-list 2022-11-11 15:23:42 +01:00
Koen Vlaswinkel
0d15768093 Merge pull request #1749 from github/koesie10/split-remote-query-flows
Split flows for running remote queries
2022-11-11 15:15:26 +01:00
Koen Vlaswinkel
022d5c564f Add copying of repository list for variant analyses
This adds the ability to copy the repository list for variant analyses
from the context menu in the query history.
2022-11-11 15:14:28 +01:00
Koen Vlaswinkel
47ee82fc03 Merge remote-tracking branch 'origin/main' into koesie10/split-remote-query-flows 2022-11-11 15:00:02 +01:00
Koen Vlaswinkel
4eb8c55045 Merge pull request #1748 from github/koesie10/reduce-nesting-remote-query
Reduce nesting in `runRemoteQuery`
2022-11-11 14:46:05 +01:00
Koen Vlaswinkel
175f8eadc5 Merge remote-tracking branch 'origin/main' into koesie10/split-remote-query-flows 2022-11-11 14:37:51 +01:00
Koen Vlaswinkel
65641e3776 Move remote queries specific code out of run-remote-query
This moves some of the code that is specific to remote queries out of
the `run-remote-query.ts` file and instead places it in separate files
that only deal with remote queries, rather than also dealing with
variant analyses.
2022-11-11 14:35:02 +01:00
Koen Vlaswinkel
7649f20d4d Remove unused return values for run methods
The `runRemoteQuery` and `runVariantAnalysis` were returning values
which were only used in tests. This removes them and replaces the tests
by expectations on the commands called by the methods.
2022-11-11 14:28:09 +01:00
Koen Vlaswinkel
09120a2328 Declare type explicitly instead of inferring it 2022-11-11 14:12:55 +01:00
Koen Vlaswinkel
42c642df25 Add exporting of variant analysis results
This adds the export of variant analysis results. This is unfortunately
a larger change than I would have liked because there are many
differences in the types and I think further unification of the code
might make it less clear and would actually make this code harder to
read when the remote queries code is removed.

In general, the idea for the export of a variant analysis follows the
same process as the export of remote queries, with the difference being
that variant analysis results are loaded on-the-fly from dis, rather
than only loading from memory. This means it should use less memory, but
it also means that the export is slower.
2022-11-11 14:01:34 +01:00
Koen Vlaswinkel
62453d12c6 Split commands for exporting results
There was only a single command for exporting variant analysis results,
which would either export the selected result or a given result. From
the query history, the command was always calculating the exported
result, while we can just give a query ID to export.

This will create two separate commands for exporting results, one for
exporting the selected results (user-visible) and one for exporting a
specific remote query result. This will make it easier to add support
for exporting variant analysis results.

I'm not sure if there will be impact from renaming the command. I expect
the only impact to be that the command history might not show the
command in the correct place (i.e. it disappears from recently used
commands), but please check if that is the only impact.
2022-11-11 14:01:34 +01:00
Koen Vlaswinkel
8b360f3004 Merge pull request #1747 from github/koesie10/remove-dry-run-parameter
Remove `dryRun` parameter from `runRemoteQuery`
2022-11-11 11:38:25 +01:00
Koen Vlaswinkel
9894eda60c Merge pull request #1746 from github/koesie10/remote-queries-tests-tar
Change remote queries to test against submitted data
2022-11-11 11:36:06 +01:00
Shati Patel
1241ce985a Fix date format to 'en-US' (#1741) 2022-11-11 10:35:24 +00:00
Koen Vlaswinkel
a4402cb68b Add tar-stream as dev dependency 2022-11-11 11:24:22 +01:00
Koen Vlaswinkel
21eabc2a93 Merge pull request #1745 from github/koesie10/extract-remote-query-preparation
Extract remote query preparation to separate method
2022-11-11 11:23:07 +01:00
Koen Vlaswinkel
c089135626 Change arrow function to exported function 2022-11-11 11:23:03 +01:00
Koen Vlaswinkel
00905a9be3 Add return type to prepareRemoteQueryRun 2022-11-11 11:07:11 +01:00
Charis Kyriakou
93b6abeeb4 Rename iconPath to icon (#1742) 2022-11-11 10:56:31 +01:00
Koen Vlaswinkel
b1a5f14471 Split flows for running remote queries
This removes the `runRemoteQuery` method and instead moves all logic
specific to remote queries/variant analysis to the remote queries
manager and variant analysis manager respectively. This will make it
easier to completely remove the remote queries manager in the future.
2022-11-11 10:48:43 +01:00
Koen Vlaswinkel
082fea8587 Reduce nesting in runRemoteQuery
Now that we do not have a dry run mode, we can create and clean up the
temporary directory in the same function. This allows us to remove the
complete try..finally block inside `runRemoteQuery` and move it to a
much more local spot.
2022-11-11 10:45:14 +01:00
Koen Vlaswinkel
cca13fde48 Remove dryRun parameter from runRemoteQuery 2022-11-11 10:43:11 +01:00
Koen Vlaswinkel
2dad33f2ba Change remote queries to test against submitted data
The remote queries tests were testing the data on the filesystem, rather
than the data submitted to the server. This required using a `dryRun`
parameter to prevent deleting the temporary directory, while we can
actually just test against the submitted data.

This will create an in-memory filesystem of the submitted query pack by
un-tar-gz'ing the query pack into memory and using that to test the
existence of certain files.
2022-11-11 10:40:04 +01:00
Koen Vlaswinkel
5905cf8811 Extract remote query preparation to separate method
There is some common logic between remote queries and the variant
analysis flows which deals with parsing the query and asking the user
how to run the query. This extracts that part of the logic to a separate
method such that the only logic left in the actual `runRemoteQuery`
method is related to submitting the query.
2022-11-11 10:38:41 +01:00
Koen Vlaswinkel
616a2693ef Merge pull request #1726 from github/koesie10/new-variant-analysis-statuses
Use new variant analysis statuses
2022-11-11 10:25:10 +01:00
Koen Vlaswinkel
a80ace5334 Add alert message for failed Actions workflow
This also changes the failure reason alert component to remove the logs
button since it's not used by any failure reason. Instead, a link is
added into the message for a failed Actions workflow using which the
Actions workflow run may be opened.
2022-11-10 15:07:58 +01:00
Koen Vlaswinkel
b333a16570 Merge remote-tracking branch 'origin/main' into koesie10/new-variant-analysis-statuses 2022-11-10 14:58:37 +01:00
Koen Vlaswinkel
03e48b7ae0 Merge pull request #1728 from github/koesie10/failed-view
Handle failed status in variant analysis view
2022-11-10 11:22:24 +01:00
Charis Kyriakou
71297e360b Remove unused method argument (#1740) 2022-11-10 08:18:04 +00:00
Charis Kyriakou
47af1f8c05 Add some integration tests for the db panel (#1739) 2022-11-09 15:37:47 +00:00
Koen Vlaswinkel
a2398990bc Merge pull request #1729 from github/koesie10/failed-download-view
Handle failed result download in view
2022-11-09 12:43:51 +01:00
Charis Kyriakou
8183c3108c Surface db config errors (#1730) 2022-11-09 11:37:22 +00:00
Koen Vlaswinkel
5390a11dc7 Merge pull request #1738 from github/koesie10/update-mrva-messages
Update messages for variant analysis warnings
2022-11-09 11:54:05 +01:00
Koen Vlaswinkel
bac39630d6 Update messages for variant analysis warnings
This uses the correct title and message for all warnings currently
supported.
2022-11-09 10:16:18 +01:00
Koen Vlaswinkel
c2baa4557f Merge remote-tracking branch 'origin/main' into koesie10/failed-view 2022-11-09 10:05:14 +01:00
Andrew Eisenberg
96d99a71a7 Merge pull request #1737 from github/version/bump-to-v1.7.6
Bump version to v1.7.6
2022-11-08 20:08:54 -08:00
aeisenberg
632a675b13 Bump version to v1.7.6 2022-11-09 02:04:18 +00:00
Andrew Eisenberg
acc37fb4de Merge pull request #1736 from github/v1.7.5
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
v1.7.5
2022-11-08 18:00:33 -08:00
Andrew Eisenberg
05951b6c74 v1.7.5 2022-11-08 17:24:55 -08:00
Andrew Eisenberg
473569df5b Merge pull request #1735 from adityasharad/ast/synthetic-query-pack
Contextual queries: Support running when the library pack is in the package cache
2022-11-08 17:15:52 -08:00
Aditya Sharad
97c985b716 Contextual queries: Record whether a temp lock file was created 2022-11-08 16:37:30 -08:00
Aditya Sharad
84b9d9c994 Contextual queries: Factor common code for resolving and running
Shared by the AST viewer, jump to def, and find references
contextual queries.

This allows contextual queries to have their dependencies
resolved and be run whether the library pack is in the
workspace or in the package cache.
2022-11-08 16:06:27 -08:00
Aditya Sharad
639487be0a AST viewer: Address review comments
Clear the CLI server's pack cache before installing packs,
to avoid race conditions where the new lock file is not
detected during query running.

Adjust some helper methods.
2022-11-08 15:33:04 -08:00
Aditya Sharad
f9a19b6a4a AST viewer: Support running when the library pack is in the package cache
If the library pack containing the AST query does not have
a lock file, it is likely to be in the package cache, not
a checkout of the CodeQL repo.
In this case, use `codeql pack resolve-dependencies`
to create a temporary lock file, and `codeql pack install`
to install the dependencies of this library pack.

This allows the CLI to resolve the library path and
dependencies for the AST query before running it.
2022-11-08 14:16:18 -08:00
Koen Vlaswinkel
ab18a74b73 Update error message for no repos queried 2022-11-08 16:56:37 +01:00
Andrew Eisenberg
ab0e8a0ff2 Merge pull request #1722 from github/aeisenberg/bump-timeouts-in-test 2022-11-08 07:35:43 -08:00
Nora
03f58593ce Merge pull request #1717 from github/norascheuch/add-config-validation
Add config validation
2022-11-08 16:11:15 +01:00
Koen Vlaswinkel
a24e7c6172 Merge pull request #1727 from github/koesie10/canceled-view
Handle canceled status in variant analysis view
2022-11-08 14:10:43 +01:00
Koen Vlaswinkel
bf52c7105d Handle failed result download in view
We were not yet showing any errors when a result download had failed.
This adds a warning icon to any repositories for which the download has
failed and allow expanding the item to show an alert.
2022-11-08 13:40:22 +01:00
Koen Vlaswinkel
8e6cfa8551 Handle failed status in variant analysis view
This will show a message for the failure reason in the variant analysis
view when the variant analysis has failed. There don't seem to be
designs for these alerts, but we will need to do a full design review of
the view at some point anyway, so I don't think the exact text is
important.
2022-11-08 13:22:53 +01:00
Koen Vlaswinkel
d711d80cfb Use new variant analysis statuses
The `status` on the variant analysis has changed to have `succeeded`,
`failed` and `cancelled` instead of `completed`.
2022-11-08 13:13:55 +01:00
Koen Vlaswinkel
e164bbb79e Handle canceled status in variant analysis view
The variant analysis view was missing an alert when the variant
analysis was canceled. This adds it, and also adds a story for checking
what the view of a canceled variant analysis looks like.
2022-11-08 13:11:50 +01:00
Koen Vlaswinkel
bbdad0afc4 Merge pull request #1720 from github/koesie10/stop-query-button
Add cancelling of variant analysis to view
2022-11-08 11:05:48 +01:00
Koen Vlaswinkel
89359e30bf Use ID instead of query name in error message
Co-authored-by: Robert <robertbrignull@github.com>
2022-11-08 10:36:42 +01:00
Koen Vlaswinkel
4c0c93d120 Merge pull request #1721 from github/koesie10/run-all-unit-tests
Run all unit tests on Linux/macOS
2022-11-08 09:53:40 +01:00
Andrew Eisenberg
94b411e3b2 Merge pull request #1724 from github/aeisenberg/fix-actions-warnings
Uses newer actions versions and avoids `set-output`
2022-11-07 20:02:38 -08:00
Andrew Eisenberg
2baf99b38a Merge pull request #1723 from github/dependabot/npm_and_yarn/extensions/ql-vscode/loader-utils-1.4.1
Bump loader-utils from 1.4.0 to 1.4.1 in /extensions/ql-vscode
2022-11-07 19:53:55 -08:00
Andrew Eisenberg
082d4b8c78 Uses newer actions versions and avoids set-output
`set-output` is deprecated:
https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
2022-11-07 16:20:29 -08:00
dependabot[bot]
66cb7dc92f Bump loader-utils from 1.4.0 to 1.4.1 in /extensions/ql-vscode
Bumps [loader-utils](https://github.com/webpack/loader-utils) from 1.4.0 to 1.4.1.
- [Release notes](https://github.com/webpack/loader-utils/releases)
- [Changelog](https://github.com/webpack/loader-utils/blob/v1.4.1/CHANGELOG.md)
- [Commits](https://github.com/webpack/loader-utils/compare/v1.4.0...v1.4.1)

---
updated-dependencies:
- dependency-name: loader-utils
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-07 23:29:11 +00:00
Andrew Eisenberg
62ed83b655 Add CHANGELOG entry 2022-11-07 15:23:24 -08:00
Andrew Eisenberg
767a5cf809 Merge branch 'main' into aeisenberg/assert-version 2022-11-07 15:21:57 -08:00
Andrew Eisenberg
9519efe525 Merge pull request #1679 from github/version/bump-to-v1.7.5
Bump version to v1.7.5
2022-11-07 15:21:25 -08:00
Andrew Eisenberg
71daf0b8c6 Bumps timeouts in tests
This tests occasionally times out during setup. This change attempts to
avoid this problem by increasing the max length of the test.
2022-11-07 15:19:58 -08:00
Andrew Eisenberg
67d2fe5332 Add a way to disable version checks
Version checks are re-enabled whenever the version of vscode changes.
This is because the user would have needed to manually update their
vscode version in order to get this new version. And another failing
version check would mean there is a newer version that needs to be
downloaded.
2022-11-07 14:25:45 -08:00
Aditya Sharad
b526ff4d3a Contextual queries: update doc comments 2022-11-07 14:02:50 -08:00
Charis Kyriakou
03bc63c689 Read schema from file 2022-11-07 16:07:10 +00:00
Charis Kyriakou
916b840407 Use new function in db config store 2022-11-07 16:57:00 +01:00
Nora
4858be6ac8 Extract validation to its own file 2022-11-07 16:56:48 +01:00
Nora
daec8b691d Extract validation to its own file 2022-11-07 16:56:48 +01:00
Nora
3df94b92cd Add basic public config validation 2022-11-07 16:56:23 +01:00
Koen Vlaswinkel
5f1431ffc2 Run all unit tests on Linux/macOS
It seems like the expansion of the test files pattern is different
between Windows and Linux/macOS. This fixes it by allowing Mocha to
expand the glob pattern rather than the shell which should fix the
inconsistency.
2022-11-07 16:41:52 +01:00
Shati Patel
3bb10d8c6e Add button to open database config from the new databases UI (#1719) 2022-11-07 13:24:15 +00:00
Charis Kyriakou
3f001c981d Create remote db tree view items based on the user's db config (#1714) 2022-11-07 11:26:33 +00:00
Koen Vlaswinkel
09bae13732 Add cancelling of variant analysis to view
This implements the "Stop query" button on the view. It moves some of
the logic of actually cancelling the variant analysis to the manager
instead of being in the query history to allow better re-use of the
code.
2022-11-07 11:21:24 +01:00
Koen Vlaswinkel
93054e14a2 Merge pull request #1683 from github/koesie10/fix-duplicate-downloads
Fix duplicate variant analysis results downloads
2022-11-07 10:37:51 +01:00
Koen Vlaswinkel
a661daaa37 Merge remote-tracking branch 'origin/main' into koesie10/fix-duplicate-downloads 2022-11-07 09:43:31 +01:00
Koen Vlaswinkel
b062f61544 Merge pull request #1716 from github/koesie10/use-shared-types-in-variant-analysis
Remove `gh-api` usage from variant analysis code
2022-11-04 17:07:54 +01:00
Elena Tanasoiu
1fdb1e23f4 Merge pull request #1715 from github/elena/cancel-variant-analysis
Implement query history "cancel" option
2022-11-04 15:19:20 +00:00
Elena Tanasoiu
145f0bf1f2 Be slightly less verbose when mocking a variant analysis 2022-11-04 14:13:18 +00:00
Elena Tanasoiu
2ca15f3665 Make it possible to cancel a variant analysis from Query History
This also adds tests for cancelling a local query and a remote query.

NB: We only cancel queries that are in progress, so the tests check
the behaviour both for in progress and not in progress items.
2022-11-04 14:13:17 +00:00
Elena Tanasoiu
20b127c693 Make it possible to cancel a mock local query
We're going to add tests to check that we cancel a remote query.

We'll need a `.cancel` method to be present on our mock local queries for this.
2022-11-04 14:13:17 +00:00
Elena Tanasoiu
620cc39e63 Introduce createVariantAnalysis method in actions API
This will allow us to make an API call to cancel a variant analysis.
2022-11-04 14:13:17 +00:00
Koen Vlaswinkel
8345284327 Merge pull request #1712 from github/koesie10/filter-sort-fixes
Add missing margin to repositories sort/filter row
2022-11-04 14:54:12 +01:00
Koen Vlaswinkel
ae3c0888e8 Remove gh-api usage from variant analysis code
This removes all usages of the `gh-api` types from the variant analysis
code by replacing it by the same types defined in `shared`.

This is a breaking change for the query history since the files
serialized to disk now also change. However, since this is still behind
a feature flag the change should be safe to make now.
2022-11-04 14:44:37 +01:00
Nora
4d00c4abfc Merge pull request #1713 from github/charis-nora/introduce-error-view-in-db-panel
Introduce error in new db panel
2022-11-04 13:41:27 +01:00
Nora
99e523f645 Update extensions/ql-vscode/src/databases/ui/db-tree-data-provider.ts
Co-authored-by: Charis Kyriakou <charisk@users.noreply.github.com>
2022-11-04 13:23:29 +01:00
Nora
6e19b5200c Update extensions/ql-vscode/src/databases/ui/db-tree-data-provider.ts
Co-authored-by: Charis Kyriakou <charisk@users.noreply.github.com>
2022-11-04 13:23:23 +01:00
Nora
45bb643a8a Update extensions/ql-vscode/src/databases/ui/db-tree-view-item.ts
Co-authored-by: Charis Kyriakou <charisk@users.noreply.github.com>
2022-11-04 13:23:17 +01:00
Koen Vlaswinkel
c6548cbe41 Add missing margin to repositories sort/filter row 2022-11-04 13:08:43 +01:00
Nora
3cc7d3ce8a Add sample error
Co-authored-by: Charis Kyriakou <charisk@users.noreply.github.com>
2022-11-04 13:06:31 +01:00
Koen Vlaswinkel
3dbd071570 Merge pull request #1711 from github/koesie10/sort-repositories
Add sorting to variant analysis repositories
2022-11-04 12:27:43 +01:00
Nora
fe90f38ad4 Merge pull request #1709 from github/charis-nora/validate-db-config-file
Validate workspace-databases.json
2022-11-04 12:20:20 +01:00
Koen Vlaswinkel
588351b101 Merge remote-tracking branch 'origin/main' into koesie10/sort-repositories 2022-11-04 11:30:24 +01:00
Koen Vlaswinkel
c0ba9c5f6e Merge pull request #1705 from github/koesie10/filter-repositories-by-name
Add repository filter by full name
2022-11-04 11:28:58 +01:00
Koen Vlaswinkel
18e1cfa8aa Merge remote-tracking branch 'origin/main' into koesie10/fix-duplicate-downloads 2022-11-04 11:27:50 +01:00
Koen Vlaswinkel
49f97e1bcc Add tests for repo states 2022-11-04 11:24:52 +01:00
Nora
f6b50bb3d6 Use contributes jsonValidation instead 2022-11-04 11:24:46 +01:00
Nora
544ff89bf8 Merge comments 2022-11-04 10:20:47 +01:00
Elena Tanasoiu
e7a0c7e652 Merge pull request #1710 from github/elena/sort-sorting
Make sorting tests work with remote queries & variant analysis history items
2022-11-03 16:57:14 +00:00
Koen Vlaswinkel
5ff7b8a1c1 Add sorting to variant analysis repositories
This adds sorting to the variant analysis repositories on the outcome
panels. The sort state is shared between all panels, so unlike the
design this doesn't disable the sort when you are on e.g. the no access
panel.
2022-11-03 16:18:22 +01:00
Elena Tanasoiu
f0aa0a5ef6 Get rid of old item factory method
We don't use it anymore.
2022-11-03 14:34:27 +00:00
Elena Tanasoiu
52ee4563dc Make sorting tests work with remote queries and variant analysis history items
We can now, finally, test sorting works, with REAL objects.
2022-11-03 14:34:27 +00:00
Elena Tanasoiu
a7431bdc1d Use new factory methods in query history tests 2022-11-03 14:18:52 +00:00
Elena Tanasoiu
a1d3c612ad Use new createMockLocalQueryInfo method in query-history-info tests 2022-11-03 14:16:43 +00:00
Elena Tanasoiu
2fe0c7925d Adapt tests for query history labels to use new LocalQueryInfo factory method
We're making a number of changes:

1. We're changing the userSpecifiedLabel value to be
`user-specified-name` instead of `xxx`

2. For local queries, we're changing `in progress` to `finished in 0
seconds` when the query has results. The previous version was
contradictory because any query still in progress wouldn't have results.

3. Similarly, for remote queries, we're changing `in progress` to
`completed` when the query has results. Here we actually set a `status`
property which means `in progress` becomes `completed`.
2022-11-03 14:08:16 +00:00
Elena Tanasoiu
028cc79bb9 Combine createMockLocalQueryInfo and createMockLocalQuery
One factory method to rule them all!

There were a number of problems with these methods:

1. We were previously using two different factory methods to generate
a fake local queries. Ideally we'd just have one.

2. We weren't really creating a real LocalQueryInfo object, which
blocked us [1] from being able to correctly understand which fields we
need in our tests and how they interact together.

3. We stubbed a bunch of methods on the original object to get our tests
to work. We can now use a real object with all the trimmings.

[1]: https://github.com/github/vscode-codeql/pull/1697#discussion_r1011990685
2022-11-03 14:02:14 +00:00
Elena Tanasoiu
0639c66bb0 Change createMockRemoteQueryHistoryItem to receive resultCount and startTime
Again, we'll need these for sorting.

We also want to be able to set/unset a userSpecifiedLabel. Since this factory
method is used in `history-item-label-provider.test.ts`, we have tests there
that count on this custom label being defined/undefined.
2022-11-03 13:58:09 +00:00
Nora
e6d0646786 Fix rebase conflict changes 2022-11-03 14:56:33 +01:00
Nora
fcc814c0c9 Call db config and initialize with extension path 2022-11-03 14:56:33 +01:00
Nora
ea0887622e Copy schema to extension files 2022-11-03 14:56:33 +01:00
Nora
d4fb0fa177 Add workspace databases schema 2022-11-03 14:56:33 +01:00
Elena Tanasoiu
44aeaf7d32 Allow createMockVariantAnalysisHistoryItem to receive named params
Similarly, we want to provide params selectively to test sorting.

We're also setting some defaults to play nicely with our current
tests.
2022-11-03 13:56:09 +00:00
Elena Tanasoiu
dd55b7e03e Change createMockVariantAnalysis calls to use named params 2022-11-03 13:55:20 +00:00
Elena Tanasoiu
304c9fb12d Change createMockVariantAnalysis to receive named params
So that we can set them selectively.

For example, we'd like to set executionStartTime to test sorting by date.
2022-11-03 13:55:20 +00:00
Shati Patel
4e3b201054 Rename dbconfig file to workspace-databases.json (#1707) 2022-11-03 13:38:32 +00:00
Elena Tanasoiu
4fa5355239 Merge pull request #1702 from github/elena/de-gulp
Don't run gulp for integration test commands
2022-11-03 13:02:28 +00:00
Charis Kyriakou
7cff1fb84d Add core classes and models for the new (experimental) databases panel (#1704) 2022-11-03 12:47:23 +00:00
Shati Patel
684c492a43 Set up a watcher that checks for changes to the new db config (#1699)
Co-authored-by: Nora <norascheuch@users.noreply.github.com>
Co-authored-by: Charis Kyriakou <charisk@users.noreply.github.com>
2022-11-03 12:26:30 +00:00
Elena Tanasoiu
20e7432ca0 Mention npm run build in the docs 2022-11-03 12:22:24 +00:00
Koen Vlaswinkel
26e2021551 Merge pull request #1692 from github/koesie10/add-metadata-to-repo-row
Add repository metadata to row
2022-11-03 11:55:03 +01:00
Koen Vlaswinkel
18111ff4bf Add repository filter by full name
This adds a new textbox to the outcome panels that allows filtering by
the repository full name (e.g. `github/vscode-codeql`). The filtering
uses the same logic as the existing remote queries filter, i.e. by
converting the input and the repository full name to lower case and
checking the the latter includes the former.
2022-11-03 11:12:29 +01:00
Elena Tanasoiu
75ed7d20dc Await file operations when copying test data
Both `copyNoWorkspaceData` and `copyCliIntegrationData` return
promises. Since file copy-ing is quite fast at the moment, this
hasn't been a problem, but it might become a problem in the future
if we start copying larger files.

Let's wait for the operations to finish.
2022-11-03 09:49:57 +00:00
Elena Tanasoiu
abfd1e2e83 Make it possible to have test data in cli-integration
This will now reload any files that live in `src/vscode-tests/*/data`.
2022-11-03 09:49:56 +00:00
Elena Tanasoiu
8e7fa4f1d6 Update docs to add reminder about using test data 2022-11-03 09:49:52 +00:00
Robert
afc0d4e6db Merge pull request #1697 from github/robertbrignull/open_pending_analysis
Don't show "open on github" link when we don't yet have anything to show
2022-11-02 16:03:41 +00:00
Elena Tanasoiu
aba2277053 Stop removing files during test setup
Now that we have a watch command to check when our test files
need updating, we don't need to do this step during the setup.

Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2022-11-02 15:51:35 +00:00
Elena Tanasoiu
cf6a10ccb2 Introduce watch method for test files
Because we're no longer running `gulp` when we run our test command,
we're going to need a way to update our test files when they change.

This will watch for any changes in our test files and copy the new
version over.

Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2022-11-02 15:50:59 +00:00
Shati Patel
7296c645b9 Add database configuration store (#1691)
This "config store" creates a `dbconfig.json` file (if it doesn't yet exist),
and reads the file to load the database panel state.

Only the database config store should be able to modify the config
— the config cannot be modified externally.
2022-11-02 15:07:23 +00:00
Elena Tanasoiu
d8a3e49d19 Update contribution docs 2022-11-02 14:09:53 +00:00
Elena Tanasoiu
b639f62cfd Don't run gulp for integration tests
We previously attempted to speed up no-workspace tests [1] but realised
we still needed to run some setup steps to get the latest files [2].

Given that we already have `npm run watch` running in the background
when we run our tests, we should be able to regenerate files on the fly.

This means we can drop `gulp` from our setup steps when running integration
tests.

While there's still a danger that you forget to run `npm run watch` in
the background, we think the massive speed up (10s -> 1s) is worth it
as we add more and more tests to this extension.

[1]: https://github.com/github/vscode-codeql/pull/1694
[2]: https://github.com/github/vscode-codeql/pull/1696
2022-11-02 14:02:19 +00:00
Koen Vlaswinkel
1487ff5e0e Merge remote-tracking branch 'origin/main' into koesie10/add-metadata-to-repo-row 2022-11-02 14:05:08 +01:00
Elena Tanasoiu
0965448c02 Merge pull request #1688 from github/elena/query-history-testing-with-different-items
Make query history tests work with remote queries & variant analyses
2022-11-02 12:47:32 +00:00
Koen Vlaswinkel
cb1233d018 Improve humanizeRelativeTime tests
The tests were expecting the wrong results, except for the case where
the time was less than a second. For less than a second ago, it makes
sense to return "this minute". For times that are 2.001 minutes ago, it
makes sense to return "2 minutes ago" rather then the previous behaviour
of "3 minutes ago".
2022-11-02 13:45:44 +01:00
Koen Vlaswinkel
3c860cfcff Merge pull request #1701 from github/koesie10/rename-not-found-repo-nwos
Rename `not_found_repo_nwos` to `not_found_repos`
2022-11-02 13:18:02 +01:00
Shati Patel
4064da640b Refactor: Move sleep function to shared module and import it (#1700) 2022-11-02 12:01:14 +00:00
Robert
30dd163265 Merge pull request #1698 from github/robertbrignull/await_monitor
Don't await the monitoring command
2022-11-02 12:00:57 +00:00
Shati Patel
bd1f6cf30e Fix indentation in exported markdown results (#1693) 2022-11-02 11:51:43 +00:00
Koen Vlaswinkel
25fec684e2 Rename not_found_repo_nwos to not_found_repos
The `not_found_repo_nwos` field doesn't actually exist (anymore?) on the
GitHub API. The correct name is `not_found_repos`, so this renames the
field on the type and in the scenarios.
2022-11-02 12:49:05 +01:00
Koen Vlaswinkel
06fd3a58a7 Add new GitHub API fields to scenario files
This uses a script to add the new `stargazers_count` and `updated_at` to
the scenario files. This is done by using the GitHub API to get the
information for each repo and then updating the scenario file.

The `updated_at` values are not completely representative since they are
the `updated_at` at time of running the script, rather than at the time
the variant analysis was run. However, this should not really matter in
practice. An alternative for scanned repositories might be getting the
creation time of the `database_commit_sha` commit.
2022-11-02 12:39:30 +01:00
Robert
f6702844b3 Don't await the monitoring command 2022-11-02 11:20:44 +00:00
Robert
aac9971e2e Differentiate pending vs in-progress states in query history 2022-11-02 11:03:02 +00:00
Robert
7835ba45a4 Pull out getIconPath and getContextValue methods 2022-11-02 11:00:11 +00:00
Elena Tanasoiu
841c66c7f8 Remove typecasting for factories
To produce valid history items and have them blow up when we need to
add new fields.
2022-11-02 10:36:46 +00:00
Robert
78f091729f Merge pull request #1696 from github/robertbrignull/integration-tests
Run test setup before integration tests
2022-11-02 10:25:22 +00:00
Robert
aff369ad7f Run test setup before integration tests 2022-11-02 10:00:21 +00:00
Elena Tanasoiu
d610701d45 Use factory method to generate variant analysis 2022-11-02 09:44:25 +00:00
Robert
36754a8a10 Merge pull request #1690 from github/robertbrignull/handle_states_monitoring
Make the monitoring command slightly simpler and handle being called on any variant analysis
2022-11-02 09:33:37 +00:00
Elena Tanasoiu
4cc423217d Merge pull request #1694 from github/robert-elena/extract-no-workspace-command
Introduce command to run no-workspace tests separately
2022-11-02 09:16:26 +00:00
Elena Tanasoiu
5a4015900f Only test removal for local queries for now
Paired with @robertbrignull on debugging why having all types of
query history items isn't playing nicely when we try to remove an item.

We've tracked down the issue it the handleRemoveHistoryItem method
not correctly setting the `current` item after a deletion.

However, it's unclear whether the test setup is to blame or this is a
real bug.

I'm going to leave the tests for `handleRemoveHistoryItem` to test just
local queries for now (as they were originally) and will come back to
this in a different PR.
2022-11-01 17:31:41 +00:00
Elena Tanasoiu
e0a0051f70 Introduce command to run no-workspace tests separately
This takes down the feedback loop from 5-10 seconds to half a second
since we're not running through the setup for minimal workspace tests.
2022-11-01 17:21:31 +00:00
Koen Vlaswinkel
be62bd3b25 Add metadata to repository row
This will add the star count and last updated fields to the repository
row. We are able to re-use some components from remote queries, but we
cannot re-use `LastUpdated` since it requires a numeric duration, while
we are dealing with an ISO8601 date.
2022-11-01 16:56:11 +01:00
Robert
ae31a17344 Merge pull request #1672 from github/robertbrignull/always_trigger_monitoring
When rehydrating, always trigger a monitoring command unless the variant analysis is fully complete
2022-11-01 13:57:02 +00:00
Robert
9359d5de24 Merge pull request #1687 from github/robertbrignull/load_query_history_later
Move loading query history to after registering commands
2022-11-01 13:56:41 +00:00
Koen Vlaswinkel
fcb1ef4fd7 Fix typings on Storybook stories
It seems like the Storybook stories were not being type-checked by CI
and got out-of-sync with the required types. This fixes the types and
also uses the factories to reduce the chance of this happening with
future changes.
2022-11-01 14:25:13 +01:00
Elena Tanasoiu
a1daa91502 Break down handleItemClicked tests per history item type
We were expecting all three types to behave the same when clicked /
double clicked.

In fact local & remote queries only allow you to open the results view
when they're complete, while variant analyses always allow you to open
the results view no matter what their status.

Let's break down these tests per history item type and test the
expected behaviour more granularly.

NB: I tried moving some of the setup in beforeEach blocks, but alas
queryHistoryManager can be undefined so rather than adding `?` to
every method call, I'm just gonna leave the setup inside the tests.

In an ideal world, we'd stop declaring `queryHistoryManager` as
`undefined`:

```
let queryHistoryManager: QueryHistoryManager | undefined;
```

Baby steps!
2022-11-01 11:39:53 +00:00
Elena Tanasoiu
a21dec7461 Fix label text
In [1] we changed our factory methods to actually use QueryStatus when
creating remote query & variant analysis history items.

Previously we were just setting the value to `in progress`...

... which made the tests for history-item-label-provider.test.ts pass...

... but that value did not reflect reality ...

What we actually need to do is introduce a method to map different
query statuses to human readable strings, e.g.

QueryStatus.InProgress becomes 'in progress'

[1]: 4b9db6a298 (diff-217b085c45cd008d938c3da4714b5782db6ad31438b27b07e969254feec8298aL28)
2022-11-01 11:39:53 +00:00
Elena Tanasoiu
8cfa82f334 Move query-history-info tests next to query-history tests
We've introduced a new `local-query-history-item.ts` factory method [1]
which includes a cancellation token. The factory will need to import the
CancellationTokenSource from `vscode`.

We already had a factory method but it didn't quite map with the setup
we needed. For example we need to call `.completeQuery` rather than
providing a dummy `completedQuery` object.

The previous factory method was used in the tests for
`query-history-info.test.ts`. Because that factory omitted the
cancellation token, we could get away with having these tests in the
`tests/pure-tests` folder.

With the addition of the second factory method, the tests for
`query-history-info` blow up because they can't find `vscode`.

Now that we need to add more fields to local query history items, it's
becoming clearer that these `query-history-info` tests should live next
to the `query-history` tests in `vscode-tests/no-workspace`.

Granted, in an ideal situation we'd only have one factory method to
generate a local query history item, but combining these two methods
is actually quite painful. So for now let's at least have the query
history tests next to each other and appease Typescript.
2022-11-01 11:36:25 +00:00
Robert
cc955c70f9 Slim down VariantAnalysisMonitorResult 2022-11-01 11:15:54 +00:00
Robert
594d879640 Try to download results even if there's a failure reason 2022-11-01 11:15:54 +00:00
Robert
5174afed00 Only fire _onVariantAnalysisChange from one place 2022-11-01 11:15:54 +00:00
Koen Vlaswinkel
5a2a9fc4bf Add repository metadata to types
This adds the new `stargazers_count` and `updated_at` fields in the
repositories to the appropriate `gh-api` and `shared` types.

To make testing easier this also moves the
`variant-analysis-processor.test.ts` to the pure tests since it doesn't
and shouldn't depend on any `vscode` APIs.
2022-11-01 12:05:50 +01:00
Koen Vlaswinkel
be2ca6c368 Merge pull request #1689 from github/koesie10/move-create-gist-to-gh-api-client
Move `createGist` to `gh-api-client`
2022-11-01 11:03:00 +01:00
Elena Tanasoiu
99af9ca47d Combine getChildren tests together
And rename original `getChildren` describe block to `sorting` since
that's what the tests are checking.
2022-11-01 09:39:52 +00:00
Elena Tanasoiu
b3c8ef115d Move getChildren tests into HistoryTreeDataProvider describe block 2022-11-01 09:39:52 +00:00
Elena Tanasoiu
661638517f Move tests for getTreeItem into getTreeItem describe block 2022-11-01 09:39:52 +00:00
Elena Tanasoiu
6d3f7e3fdb Group dangling tests into a QueryHistoryManager describe block 2022-11-01 09:39:52 +00:00
Elena Tanasoiu
8550778609 Wrap tests for removal in handleRemoveHistoryItem describe block
Instead of having them dangle around.
2022-11-01 09:39:52 +00:00
Elena Tanasoiu
f837508d86 Combine beforeEach blocks
I don't know why there are two.
2022-11-01 09:39:52 +00:00
Elena Tanasoiu
4b9db6a298 Make query history tests work with remote / variant analysis queries
We're adding both remote query history items and variant analysis history
items to the query history.

We've introduced a little method to shuffle the query history list
before we run our tests so that we don't accidentally write tests that
depend on a fixed order.

The query history now has increased test coverage for:
- handling an item being clicked
- removing and selecting the next item in query history
- handling single / multi selection
- showing the item results

While we're here we're also:
1. Adding a factory to generate variant analysis history items
2. Providing all fields for remote query history items and ordering them
according to their type definition order. At least one field (`queryId`)
was missing from our factory, which we will need to make the tests work
with remote queries.
2022-11-01 09:39:51 +00:00
Elena Tanasoiu
6289411e08 Move local query tests into their own describe block
There are a couple of tests that check whether we can correctly
compare two local queries.

These shouldn't be applied to remote queries [1] so let's just
make that a bit clearer by moving them into a local queries describe
block and using the `localHistory` array to choose items to compare
instead of the `allHistory` array.

[1]: bf1e3c10db/extensions/ql-vscode/src/query-history.ts (L1311-L1314)
2022-11-01 09:39:51 +00:00
Elena Tanasoiu
0164d1094c Move factory for creating query results into shared folder 2022-11-01 09:39:51 +00:00
Elena Tanasoiu
b0ba1e0576 Move factory for creating local query into shared folder
There's a lot of clean-up in these tests so I'm making one change per commit.

Let's move out the utility methods so we can focus on just our tests.
2022-11-01 09:39:51 +00:00
Elena Tanasoiu
718a6d6948 Allow testing for multiple types of history items
At the moment our query history tests are set up to only check
local queries.

Let's prepare the ground to introduce remote query history items
and variant analysis history items.

This will allow us to expand test coverage for these other types
of items.
2022-11-01 09:39:50 +00:00
Koen Vlaswinkel
6ccaf5302f Move createGist to gh-api-client
The `createGist` functionw was part of `gh-actions-api-client`, while it
didn't actually involve anything related to the GitHub Actions API. This
moves it to the non-Actions-specific `gh-api-client` module.

Another candidate for moving to `gh-api-client` is
`getRepositoriesMetadata`, but that one is a bit more involved since it
uses `showAndLogErrorMessage`, so depends on the `vscode` module. This
means it would not be possible to test in the "pure" tests and we would
need to move all our `gh-actions-api` tests to the integration tests. It
will not be used for variant analysis queries anymore, so I don't think
it's worth moving or refactoring to not depend on `vscode`.
2022-11-01 10:38:05 +01:00
Robert
952f033377 Merge branch 'main' into robertbrignull/always_trigger_monitoring 2022-10-31 15:42:52 +00:00
Robert
12d5255073 Fix rehydrateVariantAnalysis integration tests
The method no longer accepts a second argument
2022-10-31 15:41:28 +00:00
Koen Vlaswinkel
bf1e3c10db Merge pull request #1686 from github/koesie10/live-results-view-logs
Open Actions workflow run when clicking on "View logs"
2022-10-31 16:21:21 +01:00
Koen Vlaswinkel
453cc77c3e Merge pull request #1685 from github/koesie10/open-live-results-on-github
Add opening on GitHub of live results variant analyses
2022-10-31 16:20:56 +01:00
Robert
6dc684f2b6 Fix unit test expectated results 🤦 2022-10-31 15:14:52 +00:00
Robert
6b578c830d Move loading query history to after registering commands 2022-10-31 14:54:45 +00:00
Charis Kyriakou
76119e40fb A new experimental database panel (#1682)
* Add new config setting
* Add a new database panel behind experimental config
2022-10-31 14:53:16 +00:00
Robert
c9038f5334 Add awaits 2022-10-31 14:29:26 +00:00
Koen Vlaswinkel
45764d9bff Clean up opening variant analysis on GitHub
This removes a comment and makes the test lines shorter.
2022-10-31 15:18:17 +01:00
Koen Vlaswinkel
804632274a Open Actions workflow run when clicking on "View logs"
This will hook up the "View logs" link to make it open the variant
analysis actions workflow run. The method for creating the actions
workflow run URL has been extracted from the query history to make it
callable without a history item.
2022-10-31 14:46:32 +01:00
Koen Vlaswinkel
847cb13694 Add opening on GitHub of live results variant analyses
This implements the "Open on GitHub" context menu item for live results
variant analyses.
2022-10-31 14:46:01 +01:00
Koen Vlaswinkel
dad6467599 Add controller repo to VariantAnalysis type
This adds the `controllerRepo` field to the `VariantAnalysis` shared
type. This is technically a breaking change since the old history won't
have this field and all calls on this will fail. However, the feature
is not available so this should be fine.
2022-10-31 14:19:12 +01:00
Koen Vlaswinkel
b6410073d4 Merge pull request #1681 from github/koesie10/variant-analysis-view-title
Set variant analysis view title to query name
2022-10-31 14:14:52 +01:00
Koen Vlaswinkel
1e1c7d4a5f Merge pull request #1684 from github/koesie10/fix-eslint
Fix ESLint configuration for `scripts` directory
2022-10-31 14:05:58 +01:00
Koen Vlaswinkel
31a28e70b2 Remove unnecessary await in restoreView 2022-10-31 13:57:49 +01:00
Koen Vlaswinkel
ccf03cbcff Fix view not taking into account download status
The variant analysis view would allow expanding the results when the
repo task was completed. However, it did not take into account whether
the results were actually downloaded. This will that by usign the
download status when the repo task was succeeded and sending the repo
states to the view on load.
2022-10-31 13:51:32 +01:00
Koen Vlaswinkel
47045f23c3 Fix duplicate variant analysis results downloads
This adds a new file `repo_states.json` which tracks the download status
of all repositories of a variant analysis. We will write this file when
a download has completed and skip a repository download if the repo
state is marked as `succeeded`. This should prevent duplicate downloads.

This will still queue all repositories, even those which have already
been downloaded. However, I expect the actual cost in the download
method to be negligible since it's just an in-memory check.
2022-10-31 13:51:32 +01:00
Koen Vlaswinkel
c1f24142c9 Run ESLint on all files
This wil remove the discrepancy between the files on which ESLint is run
when `lint-staged` is used and the files that are checked using
`npm run lint` and `npm run format`.

It will now also include the `.storybook` directory which was previously
excluded from the ESLint configuration.
2022-10-31 13:22:27 +01:00
Koen Vlaswinkel
762288b57f Add tsconfig.json file for scripts directory
This will fix linting errors when `lint-staged` is run and there are
changed files in the `scripts` directory.
2022-10-31 13:21:56 +01:00
Robert
c36fa0f5d3 Merge branch 'main' into robertbrignull/always_trigger_monitoring 2022-10-31 11:53:20 +00:00
Robert
b751cee618 Check directory exists before deleting 2022-10-31 11:39:05 +00:00
Robert
b497c4fa00 make public prepareStorageDirectory private 2022-10-31 11:34:06 +00:00
Robert
b53366f277 Move isVariantAnalysisComplete implementation out of variant analysis manager 2022-10-31 11:34:03 +00:00
Koen Vlaswinkel
1cce7ae0e2 Merge pull request #1680 from github/koesie10/close-webview-on-history-item-delete
Close view when variant analyis is deleted from query history
2022-10-31 12:03:08 +01:00
Koen Vlaswinkel
9b59b65591 Set variant analysis view title to query name 2022-10-31 11:41:54 +01:00
Robert
7e59d4c736 Convert to using sinon spies 2022-10-31 10:38:44 +00:00
Koen Vlaswinkel
cdbdf62612 Make webview panel creation async
This will make the creation of a webview panel async to allow the
`getPanelConfig` method to be an async function. This will allow us to
do some work (like retrieving the variant analysis) in the
`getPanelConfig` method.
2022-10-31 11:34:58 +01:00
Elena Tanasoiu
c36ce4867e Merge pull request #1650 from github/nora-elena/integration-tests
Add tests for variant analysis history item
2022-10-31 10:33:59 +00:00
Robert
7748f82c96 Stop checking result count and rename repoScanHasResults 2022-10-31 10:24:34 +00:00
Koen Vlaswinkel
5b217220fa Close view when variant analyis is deleted from query history
This will close the variant analysis view when the corresponding variant
analysis history item is deleted from the query history. This required
some extra code to handle `dispose` being called on the view to ensure
this actually disposes the panel, but we can now call `dispose()` on the
view to close it.
2022-10-31 11:18:00 +01:00
Elena Tanasoiu
7685d7651e Don't test rehydration twice 2022-10-31 10:06:27 +00:00
Koen Vlaswinkel
25a9ee1606 Merge pull request #1665 from github/koesie10/msw-integration-test
Add some basic integration tests for MRVA
2022-10-31 09:22:37 +01:00
aeisenberg
12e2eb2d8b Bump version to v1.7.5 2022-10-29 20:41:07 +00:00
Andrew Eisenberg
84b48f416f Merge pull request #1678 from github/v1.7.4
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
v1.7.4
2022-10-29 13:36:36 -07:00
Andrew Eisenberg
606ffe41b0 v1.7.4 2022-10-29 13:17:19 -07:00
github-actions[bot]
75b4934d97 Bump version to v1.7.4 (#1676)
Co-authored-by: angelapwen <angelapwen@users.noreply.github.com>
2022-10-29 00:31:47 +00:00
Angela P Wen
77c28e0453 v1.7.3 (#1675)
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
2022-10-28 23:11:00 +00:00
Andrew Eisenberg
47ae6e2b41 Assert minimum version of vscode 2022-10-28 09:58:12 -07:00
Andrew Eisenberg
9f03db2f28 Fix typos 2022-10-28 09:54:33 -07:00
Koen Vlaswinkel
72b335649c Use new mock API server and rename integration test 2022-10-28 17:22:34 +02:00
Koen Vlaswinkel
2a437c0d1a Merge remote-tracking branch 'origin/main' into koesie10/msw-integration-test 2022-10-28 17:20:48 +02:00
Koen Vlaswinkel
bc10a7a38a Merge pull request #1663 from github/koesie10/gh-api-client-msw-test
Add msw tests for gh-api-client
2022-10-28 17:20:34 +02:00
Koen Vlaswinkel
562986546d Use scenario JSON files in tests
This will check that the data returned matches the data in the JSON
files, rather than checking against constants/magic values.
2022-10-28 16:36:03 +02:00
Koen Vlaswinkel
c4d9ef26a8 Use correct tsconfig.json in pure tests
This will change the pure tests Mocha setup to actually use the
`tsconfig.json` located in the `test` directory. Before, it was using
the root-level `tsconfig.json`. To ensure we are still using mostly the
same settings, this will extend the `test/tsconfig.json` from the
root-level `tsconfig.json`.
2022-10-28 16:34:36 +02:00
Koen Vlaswinkel
a9e49f2d72 Split mock GitHub API server into VSCode and non-VSCode
This splits the mock GitHub API server class into two parts: one for the
interactive, VSCode parts and one for the non-VSCode parts. This allows
us to use the non-VSCode part in tests.
2022-10-28 14:59:18 +02:00
Charis Kyriakou
b15626853b Add script to help with scenario recording (#1671) 2022-10-28 09:22:11 +00:00
Charis Kyriakou
f04c34629e Set in memory variant analysis on submission (#1673) 2022-10-28 10:07:14 +01:00
Charis Kyriakou
a217b53bf3 Add some more mock scenarios (#1667) 2022-10-28 09:44:14 +01:00
Nora
626592ee79 Fix tests 2022-10-28 10:22:29 +02:00
Elena Tanasoiu
4826a7e91f Merge pull request #1658 from github/elena/add-tests-for-removal
Add test for `removeVariantAnalysis`
2022-10-28 09:11:17 +01:00
Koen Vlaswinkel
d12cdbe679 Merge pull request #1664 from github/koesie10/upgrade-vscode-test
Upgrade from vscode-test to @vscode/test-electron
2022-10-28 09:41:46 +02:00
Robert
599a9ed5d9 When rehydrating, always trigger a monitoring command if variant analysis is not complete 2022-10-27 17:05:32 +01:00
Robert
caeaba2f2f Make isVariantAnalysisRepoDownloaded public 2022-10-27 17:04:50 +01:00
Robert
51589e953e Move test fixtures earlier in file 2022-10-27 17:02:36 +01:00
Robert
c4b1134903 Rename variantAnalysis to be more specific 2022-10-27 16:58:43 +01:00
Koen Vlaswinkel
1ec3d044cf Merge pull request #1668 from github/koesie10/dangling-foreach-promises
Fix dangling promises in `forEach` calls
2022-10-27 15:17:28 +02:00
Charis Kyriakou
dbb549d5fb Add mock GitHub API server docs (#1661) 2022-10-27 12:08:08 +00:00
Koen Vlaswinkel
4c469e7386 Fix dangling promises in forEach calls
This will ensure that we are awaiting all calls by using `Promise.all`.
2022-10-27 14:06:48 +02:00
Shati Patel
2ccdb9e577 Correctly rehydrate variant analyses (#1666) 2022-10-27 12:30:36 +01:00
Koen Vlaswinkel
00145bbfd4 Add some basic integration tests for MRVA
This adds some basic integration tests for MRVA using the GitHub mock
API server. It only does basic assertions and still needs to stub some
things because it is quite hard to properly test things since VSCode
does not expose an API to e.g. answer quick pick pop-ups.

I'm not sure how useful these integration tests will actually be in
practice, but they do at least ensure that we are able to successfully
submit a variant analysis.
2022-10-27 12:24:22 +02:00
Koen Vlaswinkel
123219aace Upgrade from vscode-test to @vscode/test-electron 2022-10-27 10:51:30 +02:00
Koen Vlaswinkel
ecdc485e79 Add msw tests for gh-api-client
This adds some really simple tests for the `gh-api-client` file to
ensure that we can use msw mocks in pure tests.
2022-10-27 10:29:23 +02:00
Charis Kyriakou
3812e3dcb0 Add some mock scenarios (#1660) 2022-10-27 09:23:26 +01:00
Alexander Eyers-Taylor
df832746ad Also upgrade jsonrpc 2022-10-26 17:09:56 +00:00
Elena Tanasoiu
eb09a0db8a Use getter method 2022-10-26 16:55:53 +01:00
Elena Tanasoiu
ad7a04e385 Update tests to account for item removal and showView
We've merged https://github.com/github/vscode-codeql/pull/1656
which actually implements item removal. We'll need to change our
tests to account for this.

We've also merged https://github.com/github/vscode-codeql/pull/1654
which implements opening the view when we click on a variant analysis
history item. So we've changed our tests to take into account that
there's now a `showView` method being called.
2022-10-26 16:52:10 +01:00
Charis Kyriakou
158bebd03f Remove incorrect and unnecessary field from data model (#1659) 2022-10-26 15:46:42 +00:00
Alexander Eyers-Taylor
c9e87eff56 Update languageserver-client 2022-10-26 15:08:43 +00:00
Nora
c4b4cee057 Adjust handling of historyItem 2022-10-26 15:59:26 +01:00
Nora
7cffb997a7 Add query text test 2022-10-26 15:52:17 +01:00
Nora
83291c5ceb Add should handle click test 2022-10-26 15:52:17 +01:00
Nora
3c870a10e2 Add test to remove 2 entries from query history 2022-10-26 15:52:17 +01:00
Elena Tanasoiu
2a722ba264 Add test for removing a variant analysis history item
Co-authored-by: Nora Scheuch <norascheuch@github.com>
2022-10-26 15:52:17 +01:00
Elena Tanasoiu
da754a23e4 Create basic test set up and first test
Co-authored-by: Nora Scheuch <norascheuch@github.com>
2022-10-26 15:52:16 +01:00
Elena Tanasoiu
4a237ba019 Add test data for variant analysis
We will need to set up some VariantAnalysisHistoryItem types in order
to use them in our tests.

We're repeating what we've done for RemoteQueryHistoryItem for now.

Separately we'll think about setting up tests that check for both
remote queries and variant analysis in the query history.

At the moment we'd like to focus on just adding some test coverage
for variant analysis history items.

Co-authored-by: Nora Scheuch <norascheuch@github.com>
2022-10-26 15:52:16 +01:00
Nora
319d8ce0f5 Combine beforeEach 2022-10-26 15:52:16 +01:00
Nora
f313648ab7 Combine afterEach calls 2022-10-26 15:52:16 +01:00
Elena Tanasoiu
1a3fecd3e8 Add test for removeVariantAnalysis 2022-10-26 15:15:12 +01:00
Elena Tanasoiu
1348de5a5f Surround tests with describe blocks
To better indicate which method they're testing.
2022-10-26 15:06:46 +01:00
Elena Tanasoiu
8521138bce Merge pull request #1657 from github/elena/decouple-manager-from-results
Decouple VariantAnalysisManager from VariantAnalysisResultsManager
2022-10-26 15:04:10 +01:00
Elena Tanasoiu
8569fa7399 Don't track results manager as a disposable object 2022-10-26 14:36:51 +01:00
Elena Tanasoiu
ee37fbff63 Merge pull request #1656 from github/nora-charis-elena/handle-item-removal-take-two
Implement `handleRemoveHistoryItem` for variant analysis history items - take two
2022-10-26 14:16:10 +01:00
Elena Tanasoiu
d49bffe98e Decouple VariantAnalysisManager from VariantAnalysisResultsManager
At the moment we create the results manager as a private property on the `VariantAnalysisManager`.

If we instead created it at the extension level and passed it to the `VariantAnalysisManager`, we would have more freedom to write unit tests for the `VariantAnalysisManager` without needing to reach into a private results manager property.
2022-10-26 13:47:52 +01:00
Nora
832211d789 Adjust comment 2022-10-26 14:33:47 +02:00
Nora
f9553d7033 Rename method 2022-10-26 14:29:50 +02:00
Elena Tanasoiu
f18f1b0ca7 Implement handleRemoveHistoryItem for variant analysis history items
We had previously added a no-op placeholder for when we attempt
to remove a variant analysis from our query history.

This adds the implementation:
- removes the item from the query history
- cleans up any existing result files attached to the variant analysis

NB: The remote queries would store all their results in a single folder.
For variant analysis, we store results per repo. The folder names are build
using a cache key and are stored in `cachedResults`. The cache key is
built from the variant analysis id and the repo name.

In order to delete the results, we've had to pass in the full variant analysis
object to the manager and call `cacheResults.delete()` for each of its scanned
repos.

Co-authored-by: Charis Kyriakou <charisk@github.com>
Co-authored-by: Nora Scheuch <norascheuch@github.com>
2022-10-26 12:21:46 +01:00
Shati Patel
50ec71893c Implement openQueryResults for variant analysis items (#1654) 2022-10-26 10:20:23 +01:00
Andrew Eisenberg
56af69e58d Merge pull request #1638 from github/aeisenberg/persist-dbs
Fix bug where dbs are lost on restart
2022-10-25 10:28:58 -07:00
Andrew Eisenberg
d209e52a0b Merge branch 'main' into aeisenberg/persist-dbs 2022-10-25 08:54:31 -07:00
Andrew Eisenberg
09b30fe5a3 Merge pull request #1568 from asgerf/asgerf/navigate-alerts
Add commands for navigation of alerts
2022-10-25 08:51:38 -07:00
Andrew Eisenberg
c6d54de748 Update extensions/ql-vscode/CHANGELOG.md
Co-authored-by: Edoardo Pirovano <6748066+edoardopirovano@users.noreply.github.com>
2022-10-25 08:42:27 -07:00
Andrew Eisenberg
a3fafc8e59 Merge pull request #1611 from github/aeisenberg/fix-flakes
Test cleanups
2022-10-25 08:26:26 -07:00
Charis Kyriakou
6a636baa21 Remove historyItemId for variant analyses (#1651) 2022-10-25 12:57:48 +00:00
Charis Kyriakou
9e92d0c4a7 Allow multiple query history items for a single variant analysis (#1653) 2022-10-25 13:47:53 +01:00
Shati Patel
78a0a4e580 Bump CLI version to 2.11.2 for integration tests 2022-10-25 11:30:04 +01:00
Koen Vlaswinkel
f0f01720f1 Merge pull request #1648 from github/koesie10/store-scenario-bodies-as-files
Store binary scenario bodies as files
2022-10-25 11:18:38 +02:00
Elena Tanasoiu
c8b0461f7f Merge pull request #1620 from github/mob/consume-update-event
QueryHistory: Consume event when variant analysis status is updated
2022-10-25 09:20:31 +01:00
Koen Vlaswinkel
00de0820fb Add proper handling of binary responses
msw doesn't seem to support binary responses because it decodes them to
a UTF-8 string. To work around that, we will do a separate fetch of the
file and save that.
2022-10-25 10:07:43 +02:00
Koen Vlaswinkel
5a76df8489 Load response bodies from files 2022-10-25 10:07:16 +02:00
Koen Vlaswinkel
9764a93900 Store ZIP bodies as files 2022-10-25 10:06:50 +02:00
Charis Kyriakou
130d8efe35 Tidy up msw handlers used for scenario replay (#1649) 2022-10-25 08:44:29 +01:00
Angela P Wen
63a5021e5e Use sarif parser for reopened results (#1457) 2022-10-24 12:31:35 -07:00
Edoardo Pirovano
e891169ca3 MRVA: Use QLX to precompile queries
Co-authored-by: Henning Makholm <hmakholm@github.com>
2022-10-24 17:33:25 +01:00
Charis Kyriakou
98284d9b2c Add loading of mock scenarios (#1641) 2022-10-24 16:27:37 +01:00
Asger F
b480f8f375 Fix incorrect merge resolution in changelog 2022-10-24 13:20:42 +02:00
Asger F
ead1fb4cd9 Merge branch 'main' into asgerf/navigate-alerts 2022-10-24 13:19:05 +02:00
Asger F
0acf9f7b66 Fix bad suggestion merge in package.json 2022-10-24 13:18:33 +02:00
Asger F
9cb4b9d372 Update extensions/ql-vscode/package.json
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2022-10-24 13:13:57 +02:00
Shati Patel
8a10a49f66 Merge pull request #1639 from github/shati-patel/repo-count
Implement query history label for variant analysis items
2022-10-24 11:29:09 +01:00
Koen Vlaswinkel
40d281aa3f Merge pull request #1646 from github/koesie10/fix-command-visibility
Fix scenario commands visibility
2022-10-24 12:17:42 +02:00
Elena Tanasoiu
b25cb8adbe Merge branch 'main' into mob/consume-update-event 2022-10-24 11:13:41 +01:00
Nora
88edcaf067 Merge pull request #1621 from github/norascheuch/variant-analysis-rehydrate-and-remove-event
Implement rehydration for variant analysis
2022-10-24 11:47:44 +02:00
shati-patel
8737cfde0b Add undefined case to pluralize unit tests 2022-10-24 10:44:16 +01:00
shati-patel
593ca57497 Cover more cases in buildRepoLabel unit tests 2022-10-24 10:30:56 +01:00
Koen Vlaswinkel
471ead37c0 Fix scenario commands visibility
When the mock GitHub API server setting was moved to the top-level, we
forgot the comamnds in the `package.json`. This updates the commands to
have the correct visibility.

See: https://github.com/github/vscode-codeql/pull/1643
2022-10-24 11:30:09 +02:00
shati-patel
436af066fc Add unit tests for pluralize 2022-10-24 10:17:03 +01:00
shati-patel
c85338d11a refactor: move pluralize into its own module 2022-10-24 10:08:49 +01:00
Nora
1523babcb3 Implement new filePath method suggestion
Co-authored-by: Robert <robertbrignull@github.com>
2022-10-24 10:40:03 +02:00
Nora
4ed0e0fa09 Implement find-method suggestion
Co-authored-by: Robert <robertbrignull@github.com>
2022-10-24 10:40:03 +02:00
Nora
79bb894a7d Implement rehydration for variant analysis and introduce onRemoveVariantAnalysis event 2022-10-24 10:40:03 +02:00
Charis Kyriakou
da63b99a94 Update mock GitHub API request models to support failures (#1644) 2022-10-24 08:02:36 +00:00
Koen Vlaswinkel
c325a725ea Merge pull request #1642 from github/koesie10/validate-mocks
Add linter for scenario files
2022-10-24 10:01:44 +02:00
Charis Kyriakou
6c8c15155b Restructure configuration around mock GitHub API (#1643) 2022-10-24 08:44:32 +01:00
shati-patel
3cd025f879 Add a unit test for building repo labels 2022-10-21 17:01:46 +01:00
Charis Kyriakou
6b1fce9cd5 Revert to previously used version of husky (#1640) 2022-10-21 14:51:56 +00:00
Koen Vlaswinkel
104055e703 Add linter for scenario files
This adds a linter for JSON scenario files which will validate the JSON
files in the scenarios directory against the TypeScript types. It will
convert the TypeScript types to JSON schema to simplify this process.

Unfortunately, this will not currently allow adding scenarios with
failing requests since the types do not allow this. Rather than removing
this validation, we should fix the types. This can be done in a follow-up
PR.
2022-10-21 16:41:01 +02:00
shati-patel
add5417a42 Move pluralize method into "pure" helpers file (since we don't require vscode) 2022-10-21 15:04:01 +01:00
Shati Patel
31ef6aef29 Implement buildRepoLabel for variant analysis items 2022-10-21 14:18:53 +01:00
Shati Patel
bd81d3c4a7 Fix bug in pluralize helper method
Correctly handle the zero case
2022-10-21 14:17:40 +01:00
Koen Vlaswinkel
4e5abee2ea Merge pull request #1634 from github/koesie10/record-scenario
Add recording of mock scenarios
2022-10-21 14:52:29 +02:00
Asger F
bdf7208476 Mention keyboard navigation in README 2022-10-21 14:26:54 +02:00
Asger F
e1a56dd91d Update a new more nullish checks 2022-10-21 14:26:37 +02:00
Asger F
d4a58a64ee Consistently check for undefined rather than nullish 2022-10-21 14:17:06 +02:00
Koen Vlaswinkel
71b1b49502 Fix incorrect development scenarios path
Co-authored-by: Charis Kyriakou <charisk@users.noreply.github.com>
2022-10-21 14:12:35 +02:00
Asger F
65777b5e60 Use null-aware accessors in getResult 2022-10-21 13:56:30 +02:00
Asger F
53bb9d797b Title-case command names, like other commands 2022-10-21 13:55:07 +02:00
Asger F
cbf15e6d02 Update extensions/ql-vscode/src/view/results/alert-table.tsx
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2022-10-21 13:54:45 +02:00
Asger F
ecc07a50be Update extensions/ql-vscode/CHANGELOG.md
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2022-10-21 13:54:33 +02:00
Koen Vlaswinkel
7288712e47 Unscope mock commands
This reverts commit 57ba12db8b.
2022-10-21 13:12:38 +02:00
Koen Vlaswinkel
74ae5a7fdc Start mock server on startup
The mock server wasn't being started when the extension was activated
when the config setting was already set.
2022-10-21 11:39:29 +02:00
Koen Vlaswinkel
302722b982 Fix isRecording variable name 2022-10-21 11:32:13 +02:00
Koen Vlaswinkel
22f28fa6ff Hard-code scenarios path in development
The scenarios path can still be overridden by setting the config setting.
2022-10-21 11:18:55 +02:00
Koen Vlaswinkel
9ba06ef562 Merge pull request #1627 from github/koesie10/storybook-vscode-theme-addon
Create Storybook add-on for switching VSCode themes
2022-10-21 10:53:14 +02:00
Koen Vlaswinkel
cff56b7e7b Change title of cancelRecording command 2022-10-21 10:45:57 +02:00
Koen Vlaswinkel
ad41a043a7 Add comment for setContext call 2022-10-21 10:45:18 +02:00
Koen Vlaswinkel
66c6bf5e86 Rename some variables 2022-10-21 10:43:32 +02:00
Koen Vlaswinkel
463633334c Rename recordScenario to startRecording 2022-10-21 10:41:38 +02:00
Koen Vlaswinkel
9278422406 Ensure save and cancel commands are only visible with feature flag 2022-10-21 10:41:03 +02:00
Koen Vlaswinkel
57ba12db8b Scope mock commands
The command lint expects all command palette commands to have a common
prefix which these violated. So, I've moved them to being a scoped
command so we can have different lints.
2022-10-21 10:39:47 +02:00
Andrew Eisenberg
ccdffc296c Merge branch 'main' into aeisenberg/fix-flakes 2022-10-20 17:07:39 -07:00
Andrew Eisenberg
24e9fbe8ca Update changelog 2022-10-20 16:25:14 -07:00
Andrew Eisenberg
6e33b3c032 Fix bug where dbs are lost on restart
If the workspace is restarted while databases are being loaded, this
change prevents any from being lost.

The bug was that each time a database was added when rehydrating a db
from persisted state on startup, the persisted db list
was being updated. Instead of updating the list each time we add a db,
on restart, instead update the persisted list only after all are added.

Note that we need to update the persisted list after reading it in since
the act of rehydrating a database _may_ change its persisted state.
For example, the primary language of the database may be initialized
if it was not able to be determined originally.
2022-10-20 16:20:06 -07:00
Andrew Eisenberg
a625a39999 Merge pull request #1625 from github/aeisenberg/dil-fixes
A couple of small changes around the new query server
2022-10-20 10:38:20 -07:00
Andrew Eisenberg
94ef752c0b A couple of small changes around the new query server 2022-10-20 10:21:05 -07:00
Alexander Eyers-Taylor
9957b211e0 Fix missing DIL for new query server (#1623)
* Fix missing DIL for new query server

* Fix DIL error message when QLO was not expected.

* Update extensions/ql-vscode/src/run-queries-shared.ts

Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>

Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2022-10-20 14:36:31 +01:00
Elena Tanasoiu
38f22b65ef Merge pull request #1635 from github/elenatanasoiu/update-readme
Clarify the roles of different types of tests
2022-10-20 11:28:23 +01:00
Shati Patel
4eecdbfada Merge pull request #1622 from github/shati-patel/open-query-dir
Implement "open query directory" for variant analysis history items
2022-10-20 10:30:03 +01:00
Andrew Eisenberg
7637f9428a Calculate hidden configuration keys using package.json 2022-10-19 14:57:38 -07:00
Asger F
0e3679d186 Scroll selected item into view 2022-10-19 19:49:12 +02:00
Elena Tanasoiu
e5dcffc04b Clarify the roles of different types of tests
And also clean up the explanation on how to run each type of test.
2022-10-19 18:38:27 +01:00
dependabot[bot]
0ce25eef63 Bump ansi-regex from 4.1.0 to 5.0.1 in /extensions/ql-vscode (#1613)
Bumps [ansi-regex](https://github.com/chalk/ansi-regex) from 4.1.0 to 5.0.1.
- [Release notes](https://github.com/chalk/ansi-regex/releases)
- [Commits](https://github.com/chalk/ansi-regex/compare/v4.1.0...v5.0.1)

---
updated-dependencies:
- dependency-name: ansi-regex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-19 08:49:22 -07:00
dependabot[bot]
2ca4fb052e Bump husky from 4.3.8 to 8.0.1 in /extensions/ql-vscode (#1555)
Bumps [husky](https://github.com/typicode/husky) from 4.3.8 to 8.0.1.
- [Release notes](https://github.com/typicode/husky/releases)
- [Commits](https://github.com/typicode/husky/compare/v4.3.8...v8.0.1)

---
updated-dependencies:
- dependency-name: husky
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-19 08:48:35 -07:00
shati-patel
dab67f148e Implement "open query directory" for variant analysis history items 2022-10-19 16:26:34 +01:00
Koen Vlaswinkel
a032678f24 Add commands for recording of scenario
This will add the commands and the implementation in the
`MockGitHubApiServer` for the recording of a scenario.
2022-10-19 17:22:36 +02:00
Koen Vlaswinkel
dcac6f56da Add scenario recorder
This adds a new class which will setup the MSW server to record requests,
save them to memory and save them to files when calling a separate save
method.
2022-10-19 17:22:36 +02:00
Shati Patel
57ee00efd0 Merge pull request #1631 from github/shati-patel/storage-dir
Get `variantAnalysisStoragePath` from the variant analysis manager + create `timestamp` file
2022-10-19 16:17:54 +01:00
Koen Vlaswinkel
4bc799246f Merge pull request #1619 from github/koesie10/vscode-light-theme
Add VSCode light theme to Storybook
2022-10-19 17:15:03 +02:00
Charis Kyriakou
6a7856052c Add mock GitHub API config listener (#1632) 2022-10-19 15:01:29 +00:00
Koen Vlaswinkel
fe31730dd1 Merge pull request #1633 from github/koesie10/add-missing-mock-type
Add missing request type for mock GitHub API
2022-10-19 16:59:38 +02:00
shati-patel
cc74533267 Increase timeout so tests are less flaky 2022-10-19 15:40:13 +01:00
Elena Tanasoiu
1a219af821 Update all history items that are connected to the same variant analysis 2022-10-19 15:33:03 +01:00
shati-patel
43de90f03d Pass variantAnalysisStorageLocation to the results manager 2022-10-19 15:26:16 +01:00
Koen Vlaswinkel
9624858335 Add missing request type for mock GitHub API
We were still missing the `SubmitVariantAnalysisRequest` type and a type
to represent the union of all request types. This adds both of them.
2022-10-19 16:25:32 +02:00
Elena Tanasoiu
3d4cdb69b1 Check variant analysis id instead of history item ID
Since have no way to find the query item via the historyItemId.
2022-10-19 14:49:30 +01:00
shati-patel
6b7ebf543c Create timestamp inside onVariantAnalysisSubmitted 2022-10-19 14:43:02 +01:00
Charis Kyriakou
7e8782723d Add mock GitHub API server setting (#1630) 2022-10-19 13:23:39 +00:00
shati-patel
55fb0b7078 Create timestamp file in variant analysis storage directory 2022-10-19 13:12:20 +01:00
Asger F
45b6288363 Reveal panel on navigate, to prevent webview destruction 2022-10-19 14:09:38 +02:00
Charis Kyriakou
424520613e Initial setup around GitHub API mock server (#1629) 2022-10-19 12:05:28 +00:00
shati-patel
304a96cb25 Expose variant analysis storage location in variant analysis manager 2022-10-19 13:05:25 +01:00
Elena Tanasoiu
32dbc87049 Also store variantAnalysis on the query history item
Since this is expected in the `VariantAnalysisQueryHistoryItem` type,
let's also store the variant analysis object.
2022-10-19 12:19:45 +01:00
Charis Kyriakou
baf1b70460 Add GitHub API requests that will be mocked (#1626) 2022-10-19 11:38:41 +01:00
Koen Vlaswinkel
a254ceaa59 Create Storybook add-on for switching VSCode themes
This adds a Storybook add-on that allows you to switch between VSCode
theme. It follows the pattern of the [outline](https://github.com/storybookjs/storybook/tree/v6.5.12/addons/outline/src)
and [backgrounds](https://github.com/storybookjs/storybook/tree/v6.5.12/addons/backgrounds)
add-ons.

Unfortunately, it doesn't apply the CSS to just the elements it should
be applied to, but globally to the complete preview. This is a limitation
of using CSS files rather than setting inline styles on the elements. We
might be able to resolve this in the future by extracting the CSS
variables from the CSS files, but this is somewhat more involved.
2022-10-19 11:01:25 +02:00
Elena Tanasoiu
7fd5999ead QueryHistory: Consume event when variant analysis status is updated
Update the state of a query history item when the status of the variant analysis has changed.
2022-10-19 09:18:15 +01:00
Andrew Eisenberg
c85ef15d9e Test cleanups
- Avoid Installing `xvfb` since it is already available.
- Ensure `supportsNewQueryServer()` takes the CLI version into account
- Always run the new query server tests on v2.11.1 and later
- Avoid printing directory contents in `run-remote-query-tests`
- Run tests with `--disable-workspace-trust` to avoid a non-fatal error
  being thrown from the dialog service.
- Ensure the exit code of the extension host while running integration
  tests is the exit code of the actual process. Otherwise, there is
  a possibility that an error exit code is swallowed up and ignored.
- Remove a duplicate unhandledRejection handler.
- Handle Exit code 7 from windows. This appears to be a failure on
  exiting and unrelated to the tests.
- Fix handling of configuration in tests:
    1. It is not possible to update a configuration setting for internal
       settings like `codeql.canary`.
    2. On windows CI, updating configuration after global teardown. So,
       on tests avoid resetting test configuration when tests are over.

Also, I tried to remove all those pesky errors in the logs like:

> [2094:1017/235357.424002:ERROR:bus.cc(398)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")

I was following advice from here, but I can't get it working.

- https://github.com/microsoft/vscode-test/issues/127
- https://github.com/electron/electron/issues/31981
2022-10-18 16:25:35 -07:00
shati-patel
986749b40f Open query text as a .ql file
This fixes a minor bug (introduced in https://github.com/github/vscode-codeql/pull/1115/files#diff-cf43a74569f5e6eea483a9178f5de8fc372f8ca652017d3f1451dd2640876874L603) where we accidentally removed the `.ql` file extension. I've hard-coded it here, and tested it works for the local, remote, and variant-analysis cases.
2022-10-18 17:10:08 +01:00
shati-patel
9c2821a418 Unit tests for getQueryText 2022-10-18 17:10:08 +01:00
shati-patel
93a6f50c0e Create query history items at start of test 2022-10-18 17:10:08 +01:00
shati-patel
0413b01990 Implement getQueryText for variant analysis items
Also moved this to the `query-history-info` helper file
2022-10-18 17:10:08 +01:00
Koen Vlaswinkel
157a5d6afd Add VSCode light theme to Storybook
This adds a documented way to change the theme in Storybook from the
VSCode Dark+ theme to the VSCode Light+ theme. It requires multiple
changes to two files, but these are all quite simple and it has been
documented on the "Overview" page.
2022-10-18 16:25:53 +02:00
Shati Patel
6b27a4209a Merge pull request #1614 from github/shati-patel/query-history-get-id
Get query ID for query history items (incl `VariantAnalysisHistoryItem`)
2022-10-18 12:40:04 +01:00
shati-patel
1bb68d65f9 Merge branch 'main' into shati-patel/query-history-get-id 2022-10-18 11:59:22 +01:00
shati-patel
fd13c35b5d Rename queryId -> historyItemId 2022-10-18 11:58:55 +01:00
shati-patel
77deea77fc Rename: queryId -> historyItemId 2022-10-18 11:39:16 +01:00
shati-patel
2eaa923019 Rename function: getQueryId -> getQueryHistoryItemId 2022-10-18 11:31:46 +01:00
shati-patel
ad9b46e494 Use a generated queryId on VariantAnalysisHistoryItem 2022-10-18 11:29:17 +01:00
Elena Tanasoiu
fa4766fe91 Merge pull request #1599 from github/elenatanasoiu/add-batching-to-download-take-two
Download variant analysis results in batches - take two
2022-10-18 10:32:18 +01:00
Shati Patel
28eb9ead01 Merge pull request #1606 from github/shati-patel/query-history-info-tests
Add unit tests for `query-history-info`
2022-10-18 10:17:33 +01:00
Shati Patel
0013a0f1b2 Clean-up: Remove unsupported CLI version from testing matrix
We officially only support the previous 4 minor versions of the CLI, so v2.6.3 can go.
2022-10-18 09:50:13 +01:00
Elena Tanasoiu
25b71e8651 Merge branch 'main' into elenatanasoiu/add-batching-to-download-take-two 2022-10-17 16:20:31 +01:00
Elena Tanasoiu
31a97897c8 Use fewer async/awaits 2022-10-17 16:13:46 +01:00
Elena Tanasoiu
bf7509e3df Add test to check results are being downloaded
Previously we were only checking whether we're triggering the download
command in the extension.

Now we're mocking `autoDownloadVariantAnalysisResult` on the
variantAnalysisManager and checking that it's being called for all repos
that have available results.
2022-10-17 15:58:01 +01:00
Charis Kyriakou
4fd9b54c58 Remove debug log entry (#1616) 2022-10-17 14:52:26 +00:00
Elena Tanasoiu
7d2bae1f1b Remove extra parentheses 2022-10-17 14:55:09 +01:00
Elena Tanasoiu
1f4e1f27ae Make queue private and one-line initiatialization for it 2022-10-17 14:51:06 +01:00
Elena Tanasoiu
3a1800319a Move guts for adding task to a queue into a method
So that the extension command doesn't need to know how to push to a queue.
2022-10-17 14:51:06 +01:00
Elena Tanasoiu
f2fe1063d9 Rename maxConcurrentTasks to maxConcurrentDownloads 2022-10-17 14:51:06 +01:00
Elena Tanasoiu
7e1b35eae4 Don't use Promise.all
Since we're only adding one task at a time.
2022-10-17 14:51:05 +01:00
Elena Tanasoiu
3283b68ff9 Download results in batches
This makes use of the p-queue package to download our variant analysis
results in batches of 3 at a time.
2022-10-17 14:51:05 +01:00
Elena Tanasoiu
aaf21d35f6 Install p-queue 2022-10-17 14:51:05 +01:00
Elena Tanasoiu
67a6ab5c8e Test that we only download results once per repo
To make us confident that we're not repeatedly downloading results.
2022-10-17 14:51:05 +01:00
Elena Tanasoiu
64994d7c03 Extract downloadVariantAnalysisResults method
In the next commit we'll start changing this method to support batching.
2022-10-17 14:51:05 +01:00
Elena Tanasoiu
362094b8de Extract getReposToDownload method 2022-10-17 14:51:04 +01:00
Elena Tanasoiu
e791e77ef9 Extract shouldDownload method 2022-10-17 14:51:04 +01:00
Elena Tanasoiu
0009114f7b Extract scheduleForDownload method
Before we make any changes, let's extract some of the monitor code into
smaller methods.

Since we have test coverage, we're able to do this quite comfortably.
2022-10-17 14:51:04 +01:00
aeisenberg
3b644fea7b Bump version to v1.7.3 2022-10-17 10:03:25 +01:00
shati-patel
04c9f17398 Get query ID for query history items (incl VariantAnalysisHistoryItem) 2022-10-17 09:53:34 +01:00
shati-patel
60e9f552db Add unit tests for query-history-info 2022-10-17 09:51:56 +01:00
Dave Bartolomeo
38caad032b Merge pull request #1604 from github/dbartol/join-order-threshold
Make bad join order warning threshold configurable
2022-10-14 18:20:42 -04:00
Andrew Eisenberg
7c1a8b3bc9 Merge pull request #1612 from github/revert-1586-koesie10/upgrade-vscode-test
Revert "Upgrade from vscode-test to @vscode/test-electron"
2022-10-14 14:50:51 -07:00
Andrew Eisenberg
c7c709b366 Revert "Upgrade from vscode-test to @vscode/test-electron" 2022-10-14 14:15:18 -07:00
Andrew Eisenberg
bf662354fe Merge pull request #1609 from github/v1.7.2
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
v1.7.2
2022-10-14 12:55:51 -07:00
Dave Bartolomeo
131e72b162 Decouple join-order.ts from VS Code for testing purposes 2022-10-14 15:32:03 -04:00
Dave Bartolomeo
4b875e7e42 Merge remote-tracking branch 'origin/main' into dbartol/join-order-threshold 2022-10-14 15:01:41 -04:00
Andrew Eisenberg
6ea36867a2 v1.7.2 2022-10-14 10:44:07 -07:00
Andrew Eisenberg
8df061f443 Merge pull request #1607 from github/aeisenberg/fix-failing-tests
`loadPersistedState` should happen outside of dbm constructor
2022-10-14 10:13:10 -07:00
Andrew Eisenberg
0885a22984 loadPersistedState should happen outside of dbm constructor
Also, add stub to logger in tests.

This fixes some occasionally failing tests on main.
2022-10-14 09:29:47 -07:00
Andrew Eisenberg
0354b1caac Merge pull request #1605 from github/aeisenberg/fix-missing-success
Fix deserialization error
2022-10-14 08:29:37 -07:00
Koen Vlaswinkel
d32a3a0deb Merge pull request #1601 from github/koesie10/completed-status
Add display of duration and completion status
2022-10-14 17:25:10 +02:00
shati-patel
e41dba7627 Move createMockRemoteQueryHistoryItem into shared location 2022-10-14 16:14:22 +01:00
shati-patel
b2f4fecfb4 Move createMockLocalQueryInfo into shared location 2022-10-14 16:14:22 +01:00
Koen Vlaswinkel
21b6adb92c Merge pull request #1575 from github/koesie10/reset-config
Reset VSCode configuration between tests
2022-10-14 16:52:46 +02:00
Andrew Eisenberg
90577f516f Update changelog 2022-10-14 07:42:11 -07:00
Andrew Eisenberg
a2825162ac Fix deserialization error
We added a `successful` property to serialized local queries. But, this
property does not exist on older serialized queries. This change ensures
older queries get a `successful` property when deserialized.
2022-10-14 07:39:02 -07:00
Dave Bartolomeo
9b0d4bd7b8 Make bad join order warning threshold configurable
The threshold at which the bad join order detection reports a warning was previously hard-coded to 50. Initial feedback from internal QL developers suggests that this is too high, and should be configurable in any case. I've made it configurable via the `codeQL.logInsights.joinOrderWarningThreshold` setting, leaving the default at 50. Once we get more feedback about what a better default value is, I'll update the default.
2022-10-14 10:36:58 -04:00
Koen Vlaswinkel
2e26b857f4 Add tests for missing duration 2022-10-14 16:18:07 +02:00
Shati Patel
7bdd452d63 Merge pull request #1600 from github/shati-patel/query-history-info
Move `QueryHistoryInfo` type to separate file
2022-10-14 13:12:11 +01:00
shati-patel
be9a7a35bc Address review comments
- Change function name
- Fix import
2022-10-14 12:36:16 +01:00
Koen Vlaswinkel
dd8600fcc6 Fix processor test 2022-10-14 13:16:59 +02:00
Koen Vlaswinkel
cc8f304f96 Add tests for duration calculation
This adds tests for the duration calculation and moves it down a
component to make this easier. Adding tests for the
`VariantAnalysisHeader` would require constructing a complete variant
analysis object, while this is now just a simple unit test.
2022-10-14 13:04:51 +02:00
Koen Vlaswinkel
1ca623f68a Add display of duration and completion status
This will use the new fields on the API to display the duration and
completion status of a variant analysis.
2022-10-14 12:11:54 +02:00
Koen Vlaswinkel
53c404b131 Add new date fields from API to variant analysis types
This will add some new date fields that have been added in the API to
the variant analysis types and factories. They are stored as strings
since storing them as `Date` would make the types inconsistent if they
are serialized to JSON (`JSON.stringify` -> `JSON.parse` would result
in strings rather than dates).
2022-10-14 12:11:54 +02:00
Koen Vlaswinkel
f8d5fd8f6e Merge pull request #1586 from github/koesie10/upgrade-vscode-test
Upgrade from vscode-test to @vscode/test-electron
2022-10-14 11:54:22 +02:00
shati-patel
d49c2d7958 Add getRawName helper function to query-history-info 2022-10-14 10:43:57 +01:00
shati-patel
01d7329bc3 Move QueryHistoryInfo to separate file 2022-10-14 10:43:56 +01:00
github-actions[bot]
e8d230c8f5 Bump version to v1.7.2 (#1592)
Co-authored-by: aeisenberg <aeisenberg@users.noreply.github.com>
2022-10-14 09:36:00 +00:00
Charis Kyriakou
44a3e6b557 Subscribe to new variant analyses events in query history (#1598) 2022-10-14 09:25:03 +00:00
Shati Patel
8b2a3b18ce Query history: Add new VariantAnalysisHistoryItem type (#1590) 2022-10-14 10:04:56 +01:00
Charis Kyriakou
fad5bb31a0 Only show file name (not full path) in query details (#1595) 2022-10-13 13:21:31 +00:00
Shati Patel
484b7668cb Typo fixes in query history methods/properties (#1594) 2022-10-13 12:10:57 +01:00
Koen Vlaswinkel
33dd50ca4d Merge pull request #1588 from github/koesie10/open-query-text
Add ability to open the query text
2022-10-13 12:01:54 +02:00
Koen Vlaswinkel
195cd69567 Improve variant analysis query text error messages
Co-authored-by: Robert Brignull <robertbrignull@github.com>
2022-10-13 11:10:19 +02:00
Koen Vlaswinkel
268199e9e2 Rename queryText to text
The `text` property is already nested under `query`, so it's redundant
to prefix it with `query`. This also makes it consistent with the other
properties.
2022-10-13 10:24:27 +02:00
Dave Bartolomeo
6cef629507 Merge pull request #1591 from github/v1.7.1
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
Release prep v1.7.1
2022-10-12 14:29:02 -04:00
Andrew Eisenberg
563489d1e0 Release prep v1.7.1
- Add missing changelog entry
- Update .nvmrc and workflow node versions to align with vscode's
  node version.
2022-10-12 10:56:30 -07:00
Andrew Eisenberg
ebfcce30ba Merge pull request #1589 from github/aeisenberg/load-database-logging
Add better logging while loading databases
2022-10-12 10:41:21 -07:00
Shati Patel
159d900edb Add start time to VariantAnalysis type (#1587) 2022-10-12 16:56:09 +01:00
Andrew Eisenberg
46233b9355 Add better logging while loading databases 2022-10-12 08:15:22 -07:00
Koen Vlaswinkel
1d6a7f8df1 Open query text when clicking on view query
This will implement the final step of opening the query text. Inside
the webview, this will send the message to the extension host to open
the query text.
2022-10-12 17:05:23 +02:00
Koen Vlaswinkel
e380c78876 Add openQueryText message
This will allow the webview to send a `openQueryText` message, which
will open a virtual file to show the query text.
2022-10-12 17:05:23 +02:00
Koen Vlaswinkel
cd67ce9242 Add text document content provider for variant analysis
This will add a new text document content provider for showing variant
analyses. This is separate from the remote queries content provider
to allow this to evolve separately. It also retrieves the query text
from the manager rather than passing the text directly to prevent the
webview from opening a tab with arbitrary content.

See: 4c527a3573/extensions/ql-vscode/src/extension.ts (L1242-L1257)
2022-10-12 17:05:23 +02:00
Koen Vlaswinkel
cd8d82daac Add query text to variant analysis submission
This will add a new query text field to the variant analysis submission,
which will also propagate to the variant analysis itself. This will
allow us to show the query text on the variant analysis page.
2022-10-12 17:05:23 +02:00
Koen Vlaswinkel
726feb19e1 Register all settings as test setting automatically
This will register all settings for which a `Setting` instance is
created as settings which will be reset. This should make it less
error-prone to change settings in tests.
2022-10-12 16:30:38 +02:00
Koen Vlaswinkel
8c324a3263 Merge pull request #1577 from github/koesie10/open-existing-variant-analysis
Add command for opening existing variant analysis
2022-10-12 16:03:13 +02:00
Shati Patel
119649144e Emit "update" events while variant analysis is being monitored (#1579) 2022-10-12 15:00:18 +01:00
Koen Vlaswinkel
4c527a3573 Merge pull request #1585 from github/koesie10/open-query-file
Add ability to open the query file
2022-10-12 15:41:43 +02:00
Koen Vlaswinkel
525f5234b6 Upgrade from vscode-test to @vscode/test-electron
The `vscode-test` package was renamed to `@vscode/test-electron` in
December of last year. This commit updates the extension to use the new
package name.

The reason for this change is that the `vscode-test` package was
somewhat flaky in actually starting VSCode to run the tests from the
command line. The new package also has some bugfixes and other
improvements which would normally have been part of a new version of the
`vscode-test` package.
2022-10-12 15:12:17 +02:00
Koen Vlaswinkel
908abb4413 Merge pull request #1574 from github/koesie10/view-loaded-message
Handle `viewLoaded` message
2022-10-12 13:49:48 +02:00
Koen Vlaswinkel
a69ec03c6e Add ability to open the query file
This makes it possible to open the query file in the editor when
clicking on the query filename.

This is a slightly different implementation from the remote queries
implementation. The remote queries implementation will send the file
path to open to the extension host, and the extension host will simply
open the given file path. If someone is able to inject JavaScript into
the webview, this would allow them to open an arbitrary file in VSCode.

By moving the file path logic to the extension host, we can ensure that
we only allow opening the actual query file.
2022-10-12 13:46:37 +02:00
Andrew Eisenberg
a071470c5a QueryServer: Add support for new query-server (#1508)
* QueryServer: Add support for new query-server

* Add a new canary flag to enable new query server support

* Add evaluation results to query object

Ensures better backwards compatibility with legacy query objects.

* Fix query server command name

* Add log message for new query server

* Use only legacy results

Co-authored-by: alexet <alexet@semmle.com>
2022-10-12 12:19:19 +01:00
Koen Vlaswinkel
2ae95144a5 Show notification to user when loading varaint analysis fails 2022-10-12 12:47:32 +02:00
Koen Vlaswinkel
60faed1ccc Merge remote-tracking branch 'origin/main' into koesie10/view-loaded-message 2022-10-12 10:41:18 +02:00
Koen Vlaswinkel
6e6ea76c97 Rename settingState to initialSettingState 2022-10-12 10:40:08 +02:00
Robert
d30eb27320 Move inspect to config.ts to reduce duplication of knowledge 2022-10-12 10:39:23 +02:00
Angela P Wen
2104cb3d09 Bump CLI version to 2.11.1 for integration tests (#1583) 2022-10-11 14:01:06 -07:00
Henry Mercer
5644206777 Merge pull request #1581 from github/henrymercer/update-codeowners
Update CODEOWNERS
2022-10-11 16:48:39 +01:00
Koen Vlaswinkel
a6a0ee5f50 Merge pull request #1580 from github/koesie10/views-deps
Fix missing dependencies and cleanup of addEventListener
2022-10-11 17:14:15 +02:00
Henry Mercer
74c1e583b4 Update CODEOWNERS
With this change, secexp will own all folders named `remote-queries` or `variant-analysis`.
2022-10-11 16:04:27 +01:00
Koen Vlaswinkel
326653e25a Fix missing dependencies and cleanup of addEventListener
This will implement ebba9949a8
and d18e3dd40e
for the `Compare` and `RemoteQueries` views. These should not be
impacted in the same way as the `VariantAnalysis` view, but this will
make them consistent and more resilient to future changes.
2022-10-11 17:01:02 +02:00
Koen Vlaswinkel
0d057aed3f Merge pull request #1578 from github/koesie10/mrva-performance
Fix freezing of live results view
2022-10-11 16:48:49 +02:00
Koen Vlaswinkel
c90eede573 Merge pull request #1572 from github/koesie10/request-repo-results-message
Implement `requestRepoResults` message
2022-10-11 16:48:34 +02:00
Koen Vlaswinkel
ebba9949a8 Add cleanup function to registering the message listener
This cleanup function would never be called in normal operation, but if
we do decide to add a dependency to this `useEffect`, this will ensure
that only one listener is registered at a time.
2022-10-11 16:26:42 +02:00
Koen Vlaswinkel
d18e3dd40e Fix performance of variant analysis view
When the variant analysis view was being rerendered, we were also
reregistering the message listeners, while not deregistering the old
ones. This resulted in a loop of message listeners being registered,
and the variant analysis being rerendered every time a message was
received by one of the listeners. This will ensure that the listener
is only registered once to prevent this from happening.
2022-10-11 16:24:20 +02:00
Koen Vlaswinkel
9355f0633a Run monitorVariantAnalysis on a completed variant analysis
The `monitorVariantAnalysis` command will send the repository states and
finish off any downloads. Without this, the view not will not load
properly.
2022-10-11 16:22:20 +02:00
Koen Vlaswinkel
f553523f73 Add command for opening existing variant analysis
To make debugging the view easier and prevent needing to run a variant
analysis for each change, this will add a simple command which opens a
variant analysis by its ID. This it not intended to be visible to users
at any point.
2022-10-11 12:02:46 +02:00
Koen Vlaswinkel
627bb59bd5 Merge remote-tracking branch 'origin/koesie10/request-repo-results-message' into koesie10/view-loaded-message 2022-10-11 11:11:39 +02:00
Koen Vlaswinkel
95cbe02768 Use unzipped file path for loading results 2022-10-11 11:10:45 +02:00
Asger F
d08e005b46 When stepping up or down, collapse the previous node 2022-10-11 11:09:45 +02:00
Koen Vlaswinkel
e73a6874b2 Merge remote-tracking branch 'origin/main' into koesie10/request-repo-results-message 2022-10-11 11:08:49 +02:00
Elena Tanasoiu
dc6ae6cc39 Merge pull request #1576 from github/elenatanasoiu/unzip
Make download method handle zip files
2022-10-11 09:13:18 +01:00
Elena Tanasoiu
3902596823 Use real zip file for VariantAnalysisManager download tests
Now that we're unzipping results, we also have to use something closer
to a zip file when testing download functionality for the
`variantAnalysisManager`.

The `variantAnalysisManager` has access to the
`variantAnalysisResultsManager` so we could've stubbed the result
manager's `download` method instead of going as far as using a zip
fixture.

However, since the results manager is private it seems bad to make it
public in order to stub one of its methods.

So using realistic data in the setup seems like a good compromise.
2022-10-10 23:40:28 +01:00
Elena Tanasoiu
c400485a4e Delete duplicate test
This checks the same thing as the test before it.
2022-10-10 23:40:28 +01:00
Elena Tanasoiu
1a7ddcf843 Make download method handle zip files
This will:
- download a zip file as an ArrayBuffer
- save the file as `results.zip`
- unzip the contents into a `results/` folder

For the tests:

- In order to check whether we're saving the correct files in the tests,
we've had to make the `getRepoStorageDirectory` method public.
Unfortunately the temporary file path generated for tests is random so
we're not able to hardcode it.

- Now that we have a real zip file to use in our tests, we're first
converting this file into an ArrayBuffer, then stubbing the API to
return it. We then check that it's saved and unzipped correctly.
2022-10-10 23:38:48 +01:00
Elena Tanasoiu
7cef45c434 Use real zip file in our download tests
This matches what type of file we'd expect in real life: a zip file
containing a sarif file.

We've copied an example `results.sarif` file from other tests in the
`no-workspace` folder.
2022-10-10 23:38:21 +01:00
Elena Tanasoiu
69b06ae95c Make getVariantAnalysisRepoResult return the correct type
We expect this method to return a zip file which can be typed to an
`ArrayBuffer`. In the following commits we'll read this buffer and save it
as a zip file.
2022-10-10 23:07:04 +01:00
Koen Vlaswinkel
ae2bd81215 Use new test config for testings currently writing to the config 2022-10-10 15:41:52 +02:00
Koen Vlaswinkel
b9be9cff9f Add new class and helper for setting test config values
This class will be used to set test config values for the tests. It is
able to set the config value to a specified value for every test and
restore the value to the original value after the test.
2022-10-10 15:40:42 +02:00
Asger F
4871728216 Added change note 2022-10-10 15:36:36 +02:00
Koen Vlaswinkel
8c5d73bd76 Simplify tests index-template
Instead of using the `glob` library and a custom promise, this will use
`glob-promise` which is used by other parts of the codebase already.
This reduces the amount of code which manually needs to call `reject`
and makes it easier to read.
2022-10-10 15:30:31 +02:00
Koen Vlaswinkel
81b53c9c19 Merge pull request #1573 from github/koesie10/real-cancellation-token
Use real `CancellationTokenSource` in tests
2022-10-10 09:15:20 +02:00
Elena Tanasoiu
a232b56bcd Merge pull request #1566 from github/shati-elena/query-history-analysis-added
Emit `variantAnalysisAdded` event
2022-10-07 17:32:35 +01:00
Elena Tanasoiu
c26d786a1c Emit variantAnalysisAdded event
When we first submit the variant analysis for processing, we'd like to update
the query history panel.

At the moment we're just adding the setup for triggering the event. In a future
PR we'll consume this event and change the query history panel accordingly.

In order for this to happen we will need to introduce a new `VariantAnalysisHistoryItem`
type which will massage the data we get from the API into a type which the Query
History panel can consume.

Co-authored-by: Shati Patel <shati-patel@github.com>
2022-10-07 17:08:39 +01:00
Asger F
f759eed0f5 Remove unsed parts of result-keys.ts 2022-10-07 16:26:56 +02:00
Koen Vlaswinkel
99d2df2067 Remove mock variant analysis view
The mock variant analysis view would only show the loading message. This
completely removes it since it does not provide value anymore.
2022-10-07 15:07:06 +02:00
Koen Vlaswinkel
866b137fd4 Remove default values from VariantAnalysis component
The `VariantAnalysis` component will now only receive values from the
`VariantAnalysisView`. We still allow setting defaults to support
Storybook.
2022-10-07 15:02:34 +02:00
Koen Vlaswinkel
76a00e5fa5 Send variant analysis on viewLoaded message
When the `viewLoaded` message is received by the view, it will now
retrieve the variant analysis from the manager and send it to the
view. This will allow the view to display the variant analysis.
2022-10-07 14:57:38 +02:00
Koen Vlaswinkel
f0d71ba356 Use real CancellationTokenSource in tests
This will change tests that are using a mocked `CancellationTokenSource`
to use a real `CancellationTokenSource` instead. Tests are run inside
VSCode, so we can use these without mocking.
2022-10-07 14:30:48 +02:00
Koen Vlaswinkel
b4fbfb6d2b Merge pull request #1570 from github/koesie10/variant-analysis-results-manager
Add variant analysis results manager
2022-10-07 14:08:03 +02:00
Koen Vlaswinkel
1d02c19854 Add tests for RepoRow expansion 2022-10-07 14:00:46 +02:00
Koen Vlaswinkel
3167ceec91 Send message to webview when results are loaded 2022-10-07 12:32:15 +02:00
Koen Vlaswinkel
fba49020e3 Send message to load results when expanding a repo item 2022-10-07 12:31:41 +02:00
Koen Vlaswinkel
dea36820e4 Add command to load results
This adds a new VSCode command which can be used to load results.
2022-10-07 12:30:55 +02:00
Koen Vlaswinkel
60df319754 Save repo task object to storage
To create the interpreted and raw results from the SARIF/BQRS files, we
need some information from the repo task object. This will store the
repo task object to the filesystem as JSON so we can read them when
loading results.
2022-10-07 12:28:19 +02:00
Koen Vlaswinkel
0bdee6e77e Switch caching/loading of results to use the full name
In most cases, we will not have access to the full repo task object
since this needs to be retrieved from the API. Since we are only using
the full name from the repo task object, we can just use the full name
instead.
2022-10-07 12:24:51 +02:00
Koen Vlaswinkel
88440ba148 Store variant analyses in manager
This will store all variant analysis that are run in the manager. Right
now, it only stores the variant analyses in memory. In the future, these
will be loaded from the query history and can be restored after a
restart.
2022-10-07 12:21:57 +02:00
Koen Vlaswinkel
a0fb3b47c8 Merge remote-tracking branch 'origin/main' into koesie10/variant-analysis-results-manager 2022-10-07 11:36:17 +02:00
Koen Vlaswinkel
86d10b439b Merge pull request #1550 from github/koesie10/restore-mrva-on-restart
Restore variant analysis view on restart of VSCode
2022-10-07 11:29:18 +02:00
Asger F
5a694653d7 Rename command IDs.
We register a handler for the old command ID, but do not mention it in package.json.
This seems to be backward compatible without polluting the command palette.
2022-10-07 10:35:41 +02:00
Koen Vlaswinkel
902c489979 Use nullish coalescing operator for loading results 2022-10-07 10:28:13 +02:00
Asger F
0f6100cc42 Bugfix in getPathNode 2022-10-07 09:22:07 +02:00
Koen Vlaswinkel
7fed5baebc Merge remote-tracking branch 'origin/main' into koesie10/restore-mrva-on-restart 2022-10-06 18:30:24 +02:00
dependabot[bot]
d3e961ffb3 Bump @primer/octicons-react in /extensions/ql-vscode (#1569)
Bumps [@primer/octicons-react](https://github.com/primer/octicons) from 16.3.0 to 17.6.0.
- [Release notes](https://github.com/primer/octicons/releases)
- [Changelog](https://github.com/primer/octicons/blob/main/CHANGELOG.md)
- [Commits](https://github.com/primer/octicons/compare/v16.3.0...v17.6.0)

---
updated-dependencies:
- dependency-name: "@primer/octicons-react"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-06 08:29:04 -07:00
Koen Vlaswinkel
a20d9102e6 Add variant analysis results manager
This adds a new variant analysis results manager which is responsible
for downloading and loading variant analysis results to/from the
filesystem. It is essentially the `AnalysesResultsManager` modified to
suit the variant analysis results.
2022-10-06 15:13:52 +02:00
Asger F
88bfd19c91 Switch commands to up/down/left/right semantics 2022-10-06 15:06:08 +02:00
Koen Vlaswinkel
131d252a8b Merge pull request #1567 from github/koesie10/set-repo-results-message
Implement message for setting download status
2022-10-06 10:43:46 +02:00
Asger F
125f63887a Make raw result view respond to navigation events 2022-10-05 22:57:32 +02:00
Asger F
20dea5ea46 Also show selection in raw result view 2022-10-05 22:57:32 +02:00
Asger F
3c4682e556 Ensure nodes are expanded 2022-10-05 22:57:32 +02:00
Asger F
bb61b5ea25 Replace the expansion index with the result key 2022-10-05 22:57:29 +02:00
Asger F
2949fc33d1 Replace 'expanded' with a Set<number> 2022-10-05 22:56:58 +02:00
Asger F
ab933fcb81 Add 'show next/previous alert' commands 2022-10-05 22:56:26 +02:00
Koen Vlaswinkel
90023137ca Merge pull request #1562 from github/koesie10/set-variant-analysis-message
Implement `setVariantAnalysis` message
2022-10-05 16:20:32 +02:00
Koen Vlaswinkel
fcecfa112e Merge remote-tracking branch 'origin/main' into koesie10/restore-mrva-on-restart 2022-10-05 13:01:24 +02:00
Koen Vlaswinkel
303a7d1662 Show loading icon when downloading repo results 2022-10-05 12:58:28 +02:00
Koen Vlaswinkel
7c935b37b0 Receive setRepoStates message in webview 2022-10-05 12:58:28 +02:00
Koen Vlaswinkel
339fc9a755 Post setRepoStates message when downloading 2022-10-05 12:58:28 +02:00
Koen Vlaswinkel
4138ca1085 Receive setRepoResults message in React component 2022-10-05 12:58:28 +02:00
Koen Vlaswinkel
6941584214 Add variant analysis view to disposables of manager 2022-10-05 12:53:05 +02:00
Koen Vlaswinkel
525d7f5f3d Receive setVariantAnalysis message in React component
This will store the variant analysis in the React state and replace it
when the `setVariantAnalysis` message is received.
2022-10-05 12:53:05 +02:00
Koen Vlaswinkel
84621b7ecc Fix variant analysis monitor failing
All fields in the variant analysis skipped repositories are optional,
but this was not properly defined in the API types. This will correct
the types and the functions processing the data such that they handle
non-existing fields.
2022-10-05 12:53:05 +02:00
Koen Vlaswinkel
2baa53a149 Post message to view when variant analysis is updated 2022-10-05 12:53:05 +02:00
Koen Vlaswinkel
15579012f1 Emit event when variant analysis is updated 2022-10-05 12:53:05 +02:00
Koen Vlaswinkel
28b00b249b Update variant analysis from API response
This will ensure that when we return a new variant analysis summary from
the API, the variant analysis object will be updated.
2022-10-05 12:53:05 +02:00
Koen Vlaswinkel
401da636a0 Keep track of opened variant analysis views
To be able to send messages to the open view for a variant analysis, we
need to have a reference to the view. This is done by keeping track of
all open views in a dictionary indexed by their variant analysis ID.

We currently only allow one view per variant analysis, but do allow
multiple variant analysis views to be open at a time. In the future, we
may want to allow multiple views per variant analysis (such that e.g.
"Split right" works), but this is not supported yet.

The reason for the indirection through the interfaces is to prevent
circular dependencies between the variant analysis view and the manager.
2022-10-05 12:53:02 +02:00
Elena Tanasoiu
ab9cf465cc Merge pull request #1559 from github/elenatanasoiu/download-variant-analysis-results
Download variant analysis results
2022-10-05 11:43:05 +01:00
Elena Tanasoiu
bb7246b612 Pass in variant analysis summary to autodownload command
This was missed in 4f84376faa
2022-10-04 18:09:02 +01:00
Elena Tanasoiu
b82cd8b6f4 Use real cancellation token match VSCode behaviour 2022-10-04 18:08:50 +01:00
Elena Tanasoiu
f56f017a84 Generate ids using faker for test factories 2022-10-04 17:07:15 +01:00
Elena Tanasoiu
7dc5eebcc1 Generate a real NotFoundRepoGroup
This won't have an `id` field. We initially generated this the same
way we did for all other skipped repos, but this one is special because
it's only providing the fullName field, while the others also provide
`id` and `private`.
2022-10-04 16:36:00 +01:00
Elena Tanasoiu
644a83d6d8 Only use safe navigator for optional fields 2022-10-04 16:35:59 +01:00
Elena Tanasoiu
4f84376faa Make monitor trigger autodownload of result when a new repo is scanned
This introduces a new `autoDownloadVariantAnalysisResult` command which
will be called by the VariantAnalysisMonitor every time it detects a new
repo has been scanned.

In turn, this will use the `autoDownloadVariantAnalysisResult` method
which we defined in an earlier commit on the VariantAnalysisManager.
2022-10-04 16:35:59 +01:00
Elena Tanasoiu
5e76c08f84 Only import what we need from vscode in VariantAnalysisMonitor
In the next commit, we'll also import `commands`.
2022-10-04 16:35:59 +01:00
Elena Tanasoiu
765c956481 Introduce download method on VariantAnalysisManager
This method will be called from the VariantAnalysisMonitor once
a new repo has been scanned.

It will then perform an API request to get the repo task for it,
which will contain an `artifact_url`.

Finally it will use the API method we introduced in the previous commit
to download the result for the repo and then save it on disk.
2022-10-04 16:35:59 +01:00
Elena Tanasoiu
deac8c8c02 Add API method for download scanned repo result
This will download the result for a particular repo by making a call
to the download URL via octokit.
2022-10-04 16:35:59 +01:00
Elena Tanasoiu
a47031b0d5 Call monitor from new VariantAnalysisManager class 2022-10-04 16:35:59 +01:00
Elena Tanasoiu
3bf27b3472 Set up factories for VSCode VariantAnalysis
In a previous PR [1] we introduced factories for generating variant analyses
(and their associated objects) that were returned from the API.

Let's also introduce factories for generating their VSCode equivalent.

We can immediately use them for generating a VariantAnalysis object for the
monitor tests.

[1]: https://github.com/github/vscode-codeql/pull/1545
2022-10-04 16:35:58 +01:00
Shati Patel
9422c6d65c Fix running Jest unit tests from the debugger on Windows (#1563) 2022-10-04 13:28:49 +01:00
Koen Vlaswinkel
b81e3c7b94 Merge pull request #1560 from github/koesie10/reduce-duplication-repo-rows
Combine repository row components into a single component
2022-10-04 12:19:50 +02:00
Andrew Eisenberg
011eee1d16 Merge pull request #1565 from github/aeisenberg/db-folder-check
Use better heuristics when checking db folders
2022-10-03 14:50:57 -07:00
Andrew Eisenberg
924d24b106 Update extensions/ql-vscode/src/vscode-tests/no-workspace/helpers.test.ts
Co-authored-by: Angela P Wen <angelapwen@github.com>
2022-10-03 14:36:34 -07:00
Andrew Eisenberg
54ba5ced09 Use better heuristics when chekcking db folders 2022-10-03 14:07:55 -07:00
Koen Vlaswinkel
78a90ffa92 Merge pull request #1553 from github/koesie10/show-variant-analysis-view
Open variant analysis view after submission
2022-10-03 11:21:26 +02:00
Koen Vlaswinkel
b95ee896df Combine repository row components into a single component
This is a follow-up to clean up the skipped and analyzed repository
component duplication. The rows in both tabs are very similar, so this
will combine them to use a single component.
2022-10-03 11:07:14 +02:00
Koen Vlaswinkel
d33b07b2d1 Merge branch 'main' into koesie10/show-variant-analysis-view 2022-10-03 10:06:58 +02:00
James Fletcher
3d7f303c65 Merge pull request #1558 from github/lgtm-update
Remove mentions of lgtm.com from README
2022-09-30 20:23:21 +01:00
Andrew Eisenberg
540d6758d1 Merge pull request #1557 from github/aeisenberg/view-column
Ensure results view is opened in column beside
2022-09-30 09:22:21 -07:00
Koen Vlaswinkel
b5b34743f1 Open variant analysis view after submission
This will open the variant analysis view after the variant analysis has
been submitted. It will also show a notification that the analysis has
been submitted, which includes the query name.
2022-09-30 17:01:12 +02:00
Robert
0a6db47b5f Merge pull request #1549 from github/robertbrignull/skipped-repos
Implement skipped repositories tabs
2022-09-30 13:10:12 +01:00
James Fletcher
f679a2efec remove lgtm.com from reaadme 2022-09-30 11:47:43 +00:00
Robert
72253a1bb8 Merge branch 'main' into robertbrignull/skipped-repos 2022-09-30 11:22:38 +01:00
Elena Tanasoiu
2065c7d75c Merge pull request #1545 from github/elenatanasoiu/monitor-variant-analysis
Implement monitoring for variant analysis live results
2022-09-30 10:00:03 +01:00
Elena Tanasoiu
ff4ea3e4c8 Exit early if variant analysis completes 2022-09-30 09:41:23 +01:00
Andrew Eisenberg
9bd932294a Ensure results view is opened in column beside
The results view will always open next to the current editor.
2022-09-29 13:04:28 -07:00
Andrew Eisenberg
afdc8164c8 Merge pull request #1554 from github/aeisenberg/bump-to-2.11.0-cli
Update tests to v2.11.0
2022-09-29 09:18:40 -07:00
dependabot[bot]
ea022f4cde Bump @octokit/rest from 18.6.0 to 19.0.4 in /extensions/ql-vscode (#1551)
Bumps [@octokit/rest](https://github.com/octokit/rest.js) from 18.6.0 to 19.0.4.
- [Release notes](https://github.com/octokit/rest.js/releases)
- [Commits](https://github.com/octokit/rest.js/compare/v18.6.0...v19.0.4)

---
updated-dependencies:
- dependency-name: "@octokit/rest"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-29 09:12:38 -07:00
Andrew Eisenberg
48ced51035 Update tests to v2.11.0 2022-09-29 07:50:43 -07:00
Koen Vlaswinkel
177688dc56 Merge pull request #1544 from github/koesie10/scanned-repos-tab
Add analyzed repositories component
2022-09-29 16:05:20 +02:00
Koen Vlaswinkel
c5cbf92b3a Merge pull request #1546 from github/koesie10/refactor-raw-results-table
Refactor `RawResultsTable` component
2022-09-29 16:03:29 +02:00
Robert
529ceb133e Fix text when 1 repo is shown 2022-09-29 13:02:22 +01:00
Robert
baaa3d31c0 Update codicon styling 2022-09-29 13:00:34 +01:00
Robert
9629c99ccb Move alertTitle and alertMessage to props 2022-09-29 13:00:18 +01:00
Robert
7ade7be0c4 Use simple array type 2022-09-29 12:40:40 +01:00
Robert
4272cee01b Rename files to end .stories.tsx 2022-09-29 12:31:53 +01:00
Koen Vlaswinkel
d8fbc56ec2 Restore variant analysis view on restart of VSCode
This implements persistence for the variant analysis webview, allowing
the webview panel to be restored when VSCode is restarted. It's probably
easier to add this now than to try to add it later.

The basic idea is that there are no real differences when opening the
webview for the first time. However, when VSCode is restarted it will
use the `VariantAnalysisViewSerializer` to restore the webview panel.
In our case this means recreating the `VariantAnalysisView`.

To fully test this, I've also added a mock variant analysis ID as the
state of the webview. This value is now randomly generated when calling
the `codeQL.mockVariantAnalysisView` command. This allows us to test
opening multiple webviews and that the webviews are restored with the
correct state.

See: https://code.visualstudio.com/api/extension-guides/webview#persistence
2022-09-29 13:26:56 +02:00
Elena Tanasoiu
e41b0ff779 Only check for failure reason during monitoring
There's no need to check for the status of variant analysis in order to
mark it as failed. The presence of a failure reason should be enough.
2022-09-29 10:29:05 +01:00
Koen Vlaswinkel
cf3ba32906 Merge pull request #1548 from github/koesie10/filter-raw-results
Hide repositories with raw results without rows
2022-09-29 11:08:19 +02:00
Koen Vlaswinkel
741d364a52 Simplify check for raw results
Co-authored-by: Robert <robertbrignull@github.com>
2022-09-29 10:18:33 +02:00
Elena Tanasoiu
49a2555dab Only send repository ids in databases param
At the moment we're only able to send one of:
- repositories
- repositoryLists
- repositoryOwners

In the future, we intend to be able to send a combination of these
but at the moment the API will only ever allow you to send one.

So let's be consistent and just send `repositories` here.
2022-09-28 16:20:33 +01:00
Elena Tanasoiu
f4e6a0db9b Remove failure_message
Since the API would either return a real value or skip this field.
2022-09-28 16:07:09 +01:00
Elena Tanasoiu
4e7b89864c Declare type of status in function signature
Rather than casting it later in the function body.
2022-09-28 15:54:38 +01:00
Elena Tanasoiu
02443b5ddd Add missing / to nwo names 2022-09-28 15:54:38 +01:00
Elena Tanasoiu
50b507dba5 Parse failure reason correctly 2022-09-28 15:54:38 +01:00
Elena Tanasoiu
aea5d33c42 Be verbose about expected output 2022-09-28 15:54:38 +01:00
Elena Tanasoiu
b2427a6534 Rename nwos to full_names
To match what we now return in the API.
2022-09-28 15:54:37 +01:00
Elena Tanasoiu
b95f6a5afb Replace forEach & push with map 2022-09-28 15:54:27 +01:00
Koen Vlaswinkel
7b7413ba26 Merge pull request #1547 from github/koesie10/fix-remote-query-run
Fix not being able to run variant analyses
2022-09-28 13:35:53 +02:00
Koen Vlaswinkel
d33fa5df8a Hide repositories with raw results without rows
Currently, when running a query which produces raw results, we will show
all repositories, even if they do not have any results. This change will
ensure that we are only showing repositories which have results. This
matches the behavior for queries which produce interpreted results.
2022-09-28 13:34:31 +02:00
Koen Vlaswinkel
2efff809eb Fix not being able to run variant analyses
The `controllerRepo` parameter was being encoded/escaped by Octokit,
resulting in a URL like
`repos/dsp-testing%2Fqc-controller/code-scanning/codeql/queries` rather
than `repos/dsp-testing/qc-controller/code-scanning/codeql/queries`.

This switches it to use the ID instead, since we already have the ID
and do not have access to the owner and repo separately anymore.
2022-09-28 13:18:47 +02:00
Robert
c442ff5599 Implement skipped repositories tabs 2022-09-28 12:09:32 +01:00
Elena Tanasoiu
e4de8c6b9b Define mock variant analysis with scanned repos
Now that we have a monitor, we expect the variant analysis to return
a list of scanned repos.

Let's re-use our previous factory for creating mocked responses to
get a dummy variant analysis with scanned repos.
2022-09-28 11:33:47 +01:00
Elena Tanasoiu
c032e4f9a7 Hook up new monitor class to VScode command introduced earlier
In a previous commit we were submitting a variant analysis to the API
and then triggering a `monitorVariantAnalysis` command.

Here we're hooking up the command to the VariantAnalysisMonitor class.
2022-09-28 11:33:47 +01:00
Elena Tanasoiu
487cc7b088 Introduce a VariantAnalysisMonitor class
This will poll the API every 5 seconds for changes to the variant
analysis. By default it will continue to run for a maximum of 2 days,
or when the user closes VSCode.

The monitor will receive a variantAnalysis summary from the API that
will contain an up-to-date list of scanned repos.

The monitor will then return a list of scanned repo ids.

In a future PR we'll add the functionality to:
- update the UI for in progress/completed states
- raise error on timeout
- download the results
2022-09-28 11:33:47 +01:00
Elena Tanasoiu
d9e9c1b885 Make createMockApiResponse more convenient
So that we're able to:
- set the status value
- build scanned and skipped repos by default

For previous tests, we needed to perform checks on scanned & skipped
repos so we needed to build them outside of this method. When we re-use
this method for the VariantAnalysisMonitor, we will just need a generic
ApiResponse so we can create these repos inside the method.
2022-09-28 11:33:47 +01:00
Elena Tanasoiu
e19637b59c Extract methods for generating VariantAnalysis objects
We're going to need some of these methods to generate a valid VariantAnalysis.

We might as well extract them from the tests for the VariantAnalysisProcessor.
2022-09-28 11:33:47 +01:00
Elena Tanasoiu
066bf3fd26 Trigger monitoring processs
Once we submit a variant analysis and get our response from the API,
we'd like to set up a way to monitor the variant analysis as it starts
producing live results.

Here we're using a VSCode command to trigger a monitoring process which
will poll the API for changes.
2022-09-28 11:33:46 +01:00
Elena Tanasoiu
7ab1f3a83d Introduce a way to process API responses into variant analyses
This receives an API response and builds a VariantAnalysis from the fields.
2022-09-28 11:33:45 +01:00
Koen Vlaswinkel
e3e2fcc349 Refactor RawResultsTable component
The `RawResultsTable` was using inline styles, while we should prefer
to use styled components. This refactors it to use styled components and
also improves some other miscelleanous things (extracting the props to
a separate type and moving the `Cell` above the `Row` since the latter
uses the former).
2022-09-28 11:32:11 +02:00
Elena Tanasoiu
17ed18a29d Install faker 2022-09-27 18:28:41 +01:00
Koen Vlaswinkel
110d930b68 Merge pull request #1543 from github/koesie10/outcome-panel
Add outcome panels
2022-09-27 15:20:24 +02:00
Koen Vlaswinkel
f8cc3aec32 Add analyzed repositories component
This adds the analyzed repositories component for showing within the
"Analyzed" tab. I wasn't completely sure whether there should be a
difference between "Pending" and "In progress", but pending will now not
show an icon, while in progress will show a spinner.

For the collapsible items, it does not reuse the `CollapsibleItem`
component because that component is tightly coupled with the styles
of the remote queries component.
2022-09-27 14:59:18 +02:00
Koen Vlaswinkel
f408418f23 Merge remote-tracking branch 'origin/main' into koesie10/outcome-panel 2022-09-27 14:03:13 +02:00
Robert
0b638b6ae1 Merge pull request #1538 from github/robertbrignull/submit-variant-analysis
Implement submitting a live-results variant analysis
2022-09-27 10:36:24 +01:00
Robert
ce7c7119c7 Return a VariantAnalysis from runRemoteQuery 2022-09-27 10:11:49 +01:00
Robert
5dce5e83b0 Promise resolves successfully but result is undefined 2022-09-26 15:08:37 +01:00
Robert
ac3b94dac8 Merge pull request #1541 from github/robertbrignull/loading-component
Add loading component
2022-09-26 14:55:41 +01:00
Robert
519c3039b8 Don't wait for dialog box 2022-09-26 14:55:00 +01:00
Koen Vlaswinkel
0a5c272b17 Merge pull request #1539 from github/koesie10/alert-components
Add Alert component for showing warnings and errors
2022-09-26 15:00:38 +02:00
Robert
32ec043cbe Hook into main variant analysis component 2022-09-26 13:52:37 +01:00
Robert
454a1eab39 Adjust styling 2022-09-26 13:48:32 +01:00
Koen Vlaswinkel
d3701944bf Add outcome panels
This creates the component for showing the outcome panels. It does not
implement the content of each individual panel; it only implements the
tabs, panel views, and the general warnings.
2022-09-26 14:03:03 +02:00
Koen Vlaswinkel
43bcd69e39 Use proper casing for alert type text 2022-09-26 14:01:22 +02:00
Koen Vlaswinkel
53a17d5728 Use better color variables for alerts 2022-09-26 13:59:55 +02:00
Andrew Eisenberg
b0dab966f3 Merge pull request #1498 from alexet/alexet/prepare-new-qs
QueryServer: Abstract over the query running parts.
2022-09-23 11:10:39 -07:00
Andrew Eisenberg
e4a3161283 Merge pull request #1540 from github/aeisenberg/safe-max-fix
Ensure `safeMax` is safe for undefined values
2022-09-23 10:49:02 -07:00
Robert
47e53da89c Fix typo 2022-09-23 17:25:49 +01:00
Robert
f8f81cfb40 Add loading component 2022-09-23 17:20:13 +01:00
Andrew Eisenberg
fd43bed99d Merge remote-tracking branch 'alexet/alexet/prepare-new-qs' into alexet/prepare-new-qs 2022-09-23 08:56:38 -07:00
Andrew Eisenberg
ffc3d406c2 Merge branch 'main' into alexet/prepare-new-qs 2022-09-23 08:56:10 -07:00
Andrew Eisenberg
11bf3c9462 Ensure safeMax is safe for undefined values
I came across this when I had a query that threw an error while running
for unrelated reasons. At this point, the query results were in a bad
state, but this caused `safeMax` to be called with `undefined` and
it prevented the extension from starting. This changed fixed the error.
2022-09-23 08:21:44 -07:00
Robert
9b2c40b298 Move duplicate definition to constant 2022-09-23 15:41:28 +01:00
Robert
abf6c6f108 Remove unnecessary async 2022-09-23 15:41:11 +01:00
Robert
910c1b7352 Stub isVariantAnalysisLiveResultsEnabled instead of updating setting 2022-09-23 14:43:48 +01:00
Robert
f47d6ec21c Stub getRepositoryFromNwoStub 2022-09-23 14:43:16 +01:00
Robert
0e23dd59db Remove settings duplicated in beforeEach 2022-09-23 14:11:00 +01:00
Koen Vlaswinkel
160a0aebfe Add Alert component for showing warnings and errors 2022-09-23 15:10:15 +02:00
Robert
4d3385825b Move test to pure-tests directory 2022-09-23 13:05:07 +01:00
Robert
80862944d8 Add tests of parseVariantAnalysisQueryLanguage 2022-09-23 12:31:11 +01:00
Robert
91344a74f6 Fix tests that use parseResponse 2022-09-23 12:31:01 +01:00
Robert
7538ad1ba4 Add parseVariantAnalysisQueryLanguage method 2022-09-23 12:21:14 +01:00
Robert
24c2663fe7 Use separate describe blocks for live results enabled vs disabled 2022-09-23 12:03:27 +01:00
Robert
50aaf3b537 Move more implementation of fetching the controller repo into getControllerRepo
This involved changing a few different methods to take a Repository object
instead of taking owner and repo separately. Overall I think this is a good change.
2022-09-23 11:01:25 +01:00
Robert
847082cd30 Set live results mode to off both before and after tests 2022-09-23 10:41:14 +01:00
Koen Vlaswinkel
8c7c197b22 Merge pull request #1537 from github/koesie10/icons-storybook
Add Storybook stories for icons
2022-09-23 09:28:14 +02:00
dependabot[bot]
1f95eb2f49 Bump sinon from 13.0.1 to 14.0.0 in /extensions/ql-vscode (#1535)
Bumps [sinon](https://github.com/sinonjs/sinon) from 13.0.1 to 14.0.0.
- [Release notes](https://github.com/sinonjs/sinon/releases)
- [Changelog](https://github.com/sinonjs/sinon/blob/main/docs/changelog.md)
- [Commits](https://github.com/sinonjs/sinon/compare/v13.0.1...v14.0.0)

---
updated-dependencies:
- dependency-name: sinon
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-22 10:38:00 -07:00
Robert
7874a34947 Add tests for runRemoteQuery when in live results mode 2022-09-22 17:33:35 +01:00
Koen Vlaswinkel
a74c8a7cee Merge pull request #1536 from github/koesie10/eslint-plugin-react-hooks
Add ESLint plugin for React hooks
2022-09-22 17:39:12 +02:00
Koen Vlaswinkel
3aced3c4d3 Add Storybook stories for icons
This will add Storybook stories for the error, success, and warning
icons, as well as for the generic `Codicon` component.

To show the available icons for the `Codicon` component, a static JSON
list is generated from the contents of a CSV file included as part of
the `@vscode/codicons` npm package. The command to regenerate the file
is included in the story.
2022-09-22 17:37:33 +02:00
Koen Vlaswinkel
bec23f36d2 Add ESLint plugin for React hooks
This will add the ESLint plugin for React hooks which will automatically
check that all dependencies are listed in `useMemo`, `useEffect`, etc.

See: https://www.npmjs.com/package/eslint-plugin-react-hooks
2022-09-22 17:10:45 +02:00
Koen Vlaswinkel
92bbf3a2e8 Merge pull request #1534 from github/koesie10/variant-analysis-header-domain-model
Use domain model for VariantAnalysisHeader
2022-09-22 15:27:32 +02:00
Koen Vlaswinkel
5c478e98d9 Merge pull request #1532 from github/koesie10/split-common-components
Split CodePaths and FileCodeSnippet into multiple files
2022-09-22 15:09:42 +02:00
Koen Vlaswinkel
f26988731e Add missed dependency in useMemo 2022-09-22 15:03:35 +02:00
Koen Vlaswinkel
e6f9ce050b Extract potentially reusable functions to shared file 2022-09-22 15:00:09 +02:00
Robert
52f993f748 Implement submitting a variant analysis 2022-09-22 12:20:24 +01:00
Charis Kyriakou
99fe65f6f7 Update skipped repo groups structure for variant analysis (#1533) 2022-09-22 12:02:30 +01:00
Robert
7d721d9544 Add getControllerRepoId method 2022-09-22 11:35:16 +01:00
Koen Vlaswinkel
1005ecdc6a Fix mock view 2022-09-22 12:06:04 +02:00
Koen Vlaswinkel
c9f65be721 Use domain model for VariantAnalysisHeader
This will change the VariantAnalysisHeader to take the VariantAnalysis
domain model instead of a large amount of props.

It also adds the `canceled` status to the `VariantAnalysisStatus` to
represent a stopped variant analysis.
2022-09-22 11:58:26 +02:00
Koen Vlaswinkel
9ad28f36b4 Split CodePaths and FileCodeSnippet into multiple files 2022-09-22 11:12:03 +02:00
Koen Vlaswinkel
9c076152cb Merge pull request #1523 from github/koesie10/refactor-common-components
Refactor CodePaths and FileCodeSnippet components
2022-09-22 11:03:56 +02:00
Charis Kyriakou
bbb6f10f17 Add new GitHub API client with functions for new MRVA flow (#1527) 2022-09-22 09:02:44 +00:00
Koen Vlaswinkel
8a671be85c Merge remote-tracking branch 'origin/main' into koesie10/refactor-common-components 2022-09-22 10:51:30 +02:00
Koen Vlaswinkel
0476815f8a Merge pull request #1531 from github/koesie10/move-components-to-common
Move CodePaths and FileCodeSnippet to common directory
2022-09-22 10:43:56 +02:00
Koen Vlaswinkel
53dfd1243f Move CodePaths and FileCodeSnippet to common directory 2022-09-22 10:26:55 +02:00
Koen Vlaswinkel
d69772d1f8 Merge pull request #1517 from github/koesie10/variant-analysis-stats
Add variant analysis stats component
2022-09-22 10:06:22 +02:00
Koen Vlaswinkel
2fd5f38574 Merge pull request #1528 from github/koesie10/fix-export-all-selection
Fix "Export All" not always exporting the correct query
2022-09-22 10:05:44 +02:00
Koen Vlaswinkel
06d22841cf Rename getQueryById to getRemoteQueryById 2022-09-22 09:30:07 +02:00
Koen Vlaswinkel
0133cd7734 Improve error message for not found queries
Co-authored-by: Charis Kyriakou <charisk@users.noreply.github.com>
2022-09-22 09:28:57 +02:00
Robert
a53c04e2c1 Merge pull request #1530 from github/robertbrignull/release-instructions
Clarify step of the release process
2022-09-21 17:16:09 +01:00
Robert
eba6c190e8 Merge pull request #1529 from github/version/bump-to-v1.7.1
Bump version to v1.7.1
2022-09-21 17:09:41 +01:00
Charis Kyriakou
d0e6e3ca89 Define variant analysis domain models (#1521) 2022-09-21 16:59:44 +01:00
Robert
cc00456cbc Clarify step of the release process 2022-09-21 16:56:28 +01:00
robertbrignull
434567aa34 Bump version to v1.7.1 2022-09-21 15:22:10 +00:00
Koen Vlaswinkel
7b1a93d7c6 Use HorizontalSpace instead of margin-left 2022-09-21 15:38:28 +02:00
Koen Vlaswinkel
d3ea84e863 Rename VariantAnalysisCompletionStats to VariantAnalysisStatusStats 2022-09-21 15:22:00 +02:00
Koen Vlaswinkel
1b6685ef6f Fix "Export All" not always exporting the correct query
The "Export All" button was always exporting the selected query, while a
different query could be open in a VSCode panel. This will ensure that
the query ID is passed to the export function, so that the correct query
is exported.
2022-09-21 14:24:54 +02:00
Koen Vlaswinkel
f26795ca17 Merge remote-tracking branch 'origin/main' into koesie10/variant-analysis-stats 2022-09-21 12:28:47 +02:00
Koen Vlaswinkel
617f7bab0a Extract icons to reusable components 2022-09-21 12:25:36 +02:00
Koen Vlaswinkel
8da1a28478 Add documentation to formatDecimal function 2022-09-21 12:16:37 +02:00
Koen Vlaswinkel
4518d9a81d Use div instead of empty styled component 2022-09-21 12:16:20 +02:00
Koen Vlaswinkel
3817133b5b Refactor CodePaths and FileCodeSnippet components
This refactors the CodePaths and FileCodeSnippet components to be more
readable and in style with the rest of the "new" components. It does the
following:

- Remove uses of the `style` and `sx` props; replace it by using
  `styled-components` instead
- Remove uses of Primer icons
- Split out the components into multiple files
- Change the colors of the severity to match VSCode colors (and make
  them themable)

I haven't removed the use of the Primer `Overlay` component yet, since
this component seems to do quite a lot and the VSCode WebView UI Toolkit
doesn't have a replacement for it.
2022-09-21 11:29:39 +02:00
Robert
c9b68caee4 Merge pull request #1526 from github/v1.7.0
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
Release PR for v1.7.0
2022-09-21 09:51:37 +01:00
Andrew Eisenberg
60c4d8d40a Merge pull request #1519 from github/aeisenberg/upgrade-db-fix
Avoid error after upgrading a database
2022-09-20 09:38:26 -07:00
Robert
1a9d63315f v1.7.0 2022-09-20 16:23:47 +01:00
Charis Kyriakou
5c8098f28d Move GitHub Actions API client to gh-api directory (#1524) 2022-09-20 15:52:55 +01:00
Charis Kyriakou
bcf70c6962 Move zipFile util to its own module for easy re-use (#1522) 2022-09-20 09:57:33 +01:00
Koen Vlaswinkel
64f33a5f44 Merge pull request #1520 from github/koesie10/react-components-common
Move common React components to separate directory
2022-09-20 10:51:37 +02:00
dependabot[bot]
48a527ad52 Bump applicationinsights from 1.8.7 to 2.3.5 in /extensions/ql-vscode (#1515)
Bumps [applicationinsights](https://github.com/microsoft/ApplicationInsights-node.js) from 1.8.7 to 2.3.5.
- [Release notes](https://github.com/microsoft/ApplicationInsights-node.js/releases)
- [Commits](https://github.com/microsoft/ApplicationInsights-node.js/compare/1.8.7...2.3.5)

---
updated-dependencies:
- dependency-name: applicationinsights
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-19 10:02:35 -07:00
Koen Vlaswinkel
faabe6d887 Move common React components to separate directory 2022-09-19 10:03:30 +02:00
Koen Vlaswinkel
4b8d611d86 Merge pull request #1512 from github/koesie10/variant-analysis-header
Add variant analysis top header
2022-09-19 09:21:21 +02:00
Andrew Eisenberg
bfc9a17ffb Update CHANGELOG 2022-09-16 16:19:58 -07:00
Andrew Eisenberg
a4a3f70984 Avoid error after upgrading a database
The `runUpgrade` query server command is mistakenly caching the old
dbscheme in memory after running the upgrade. The problem is in the
CLI. The workaround is to restart the query server after running an
upgrade. This is not a great solution, but considering that explicit
upgrades are now very rare. I do not think it is worth putting in
too much effort for a proper fix.
2022-09-16 15:58:39 -07:00
Koen Vlaswinkel
98bae3253d Merge branch 'koesie10/variant-analysis-header' into koesie10/variant-analysis-stats 2022-09-16 16:34:43 +02:00
Koen Vlaswinkel
70098aa19c Fix running unit tests on Windows 2022-09-16 14:58:26 +02:00
Koen Vlaswinkel
1261fdd41e Add stories for individual variant analysis header components 2022-09-16 14:43:02 +02:00
Koen Vlaswinkel
c914312e85 Move variant analysis header tests to individual components 2022-09-16 14:40:41 +02:00
Koen Vlaswinkel
cd2b5a8c59 Set timezone and locale for tests 2022-09-16 14:36:12 +02:00
Koen Vlaswinkel
29a43c7dc1 Merge pull request #1518 from github/koesie10/codeowners-mrva
Add correct CODEOWNERS for MRVA webviews
2022-09-16 13:45:23 +02:00
Koen Vlaswinkel
8ef3c3713b Add correct properties to variant analysis mock view 2022-09-16 13:33:34 +02:00
Koen Vlaswinkel
54f83d11d6 Add correct CODEOWNERS for MRVA webviews 2022-09-16 13:30:26 +02:00
Koen Vlaswinkel
22cfad6711 Add variant analysis stats to header component 2022-09-16 13:25:23 +02:00
Koen Vlaswinkel
cbc2650f30 Add tests for date and number formatting functions 2022-09-16 13:18:21 +02:00
Koen Vlaswinkel
55b060af97 Use browser date format 2022-09-16 13:18:21 +02:00
Koen Vlaswinkel
9f347d136b Format date according to designs 2022-09-16 13:18:21 +02:00
Koen Vlaswinkel
0d0367c39d Add tests for variant analysis stats component 2022-09-16 13:18:21 +02:00
Koen Vlaswinkel
ba0a30dcfe Add variant analysis stats component 2022-09-16 13:18:21 +02:00
Koen Vlaswinkel
3079d7f285 Split variant analysis header component 2022-09-16 12:10:13 +02:00
Koen Vlaswinkel
10eb355900 Merge pull request #1467 from github/koesie10/deprecate-lgtm-download
Deprecate download from LGTM by hiding it behind canary flag
2022-09-16 09:39:37 +02:00
Andrew Eisenberg
0daea7399a Merge branch 'main' into alexet/prepare-new-qs 2022-09-15 14:36:00 -07:00
Koen Vlaswinkel
1b0077a115 Implement PR feedback 2022-09-15 10:06:13 +02:00
Charis Kyriakou
db5e743055 Some more renames around webviews (#1513) 2022-09-14 16:01:49 +01:00
Charis Kyriakou
a6d63222f5 Consolidate view loading messages into one (#1511) 2022-09-14 15:19:21 +01:00
Koen Vlaswinkel
58e80ecce3 Rename styled components to be more descriptive 2022-09-14 16:14:30 +02:00
Koen Vlaswinkel
0ad44a3fe2 Use VSCodeLink for links in header 2022-09-14 16:11:20 +02:00
Charis Kyriakou
09dccc13a2 Renamed 'interface managers' to something more specific (#1510) 2022-09-14 13:09:43 +00:00
Koen Vlaswinkel
2cdded9cca Add story for variant analysis view 2022-09-14 14:27:37 +02:00
Koen Vlaswinkel
e8a0b24f57 Add Jest tests to VSCode config 2022-09-14 14:20:54 +02:00
Koen Vlaswinkel
182c2f3b8e Add variant analysis header to view 2022-09-14 14:14:19 +02:00
Koen Vlaswinkel
e5376b3469 Add DOM tests for variant analysis header 2022-09-14 13:56:38 +02:00
Koen Vlaswinkel
ef22cf174e Add React testing library 2022-09-14 13:56:38 +02:00
Koen Vlaswinkel
d158487081 Add variant analysis header 2022-09-14 13:56:38 +02:00
Charis Kyriakou
2e9c0c301c Add new variant analysis view (#1506) 2022-09-14 11:52:58 +00:00
Koen Vlaswinkel
f256e18041 Merge pull request #1509 from github/koesie10/fix-eslint-vscode-setting
Fix ESLint VSCode configuration
2022-09-14 10:46:46 +02:00
Koen Vlaswinkel
aa23680603 Fix ESLint VSCode configuration
The working directory of ESLint was not set directly, so ESLint warnings
did not show up in VSCode. This sets the working directory properly such
that ESLint warnings are shown in VSCode.

See: https://github.com/Microsoft/vscode-eslint#settings-options
2022-09-14 10:21:55 +02:00
Andrew Eisenberg
e5fe2148ab Add back the evaluation results to CompletedQuery
This ensures that queries created by new versions of the extension
can still be read by older versions of the extension.
2022-09-13 14:51:44 -07:00
Andrew Eisenberg
c44b7b1d78 Apply suggestions from code review 2022-09-13 14:51:44 -07:00
alexet
24ede1b66f QueryServer: Abstract over the query running parts of the query server in preperation for the new query server. 2022-09-13 14:51:44 -07:00
Andrew Eisenberg
6335b9881b Add back the evaluation results to CompletedQuery
This ensures that queries created by new versions of the extension
can still be read by older versions of the extension.
2022-09-13 14:08:35 -07:00
shati-patel
8c0fee5a2e Bump CLI version to 2.10.5 for integration tests 2022-09-13 16:58:21 +01:00
Koen Vlaswinkel
e95f8e85a8 Merge remote-tracking branch 'origin/main' into koesie10/deprecate-lgtm-download 2022-09-13 10:38:53 +02:00
Andrew Eisenberg
c6531a293e Apply suggestions from code review 2022-09-12 16:10:58 -07:00
alexet
e648d9c67c QueryServer: Abstract over the query running parts of the query server in preperation for the new query server. 2022-09-12 16:10:58 -07:00
Koen Vlaswinkel
45efca9425 Merge pull request #1503 from github/koesie10/remove-open-on-github-for-mrva
Remove open on GitHub item from cancelled local results
2022-09-09 09:25:05 +02:00
Alexander Eyers-Taylor
9071f54863 Don't display destructive upgrades any more. (#1501)
* Don't display destructive upgrades any more.

* Add change note

* Update extensions/ql-vscode/CHANGELOG.md

Co-authored-by: Aditya Sharad <6874315+adityasharad@users.noreply.github.com>
2022-09-08 18:57:12 +00:00
Koen Vlaswinkel
0aa34a51ff Merge pull request #1504 from github/koesie10/remove-query-name-from-query-id
Remove query name from query ID for MRVA queries
2022-09-08 17:04:09 +02:00
Koen Vlaswinkel
181b5d6f7b Remove query name from query ID for MRVA queries 2022-09-08 13:59:26 +02:00
Koen Vlaswinkel
7502fdee67 Remove open on GitHub item from cancelled local results
This will make a distinction between cancelled local and remote results,
allowing us to hide the *Open Variant Analysis on GitHub* item from
local failed/cancelled items. It also hides the *Show Evaluator Log*
items for cancelled/failed remote queries.
2022-09-08 13:36:50 +02:00
Koen Vlaswinkel
24652a84e4 Merge pull request #1497 from github/koesie10/storybook
Setup Storybook for testing UI components
2022-09-08 10:38:22 +02:00
Koen Vlaswinkel
2ee46cfd81 Add comment to .npmrc file for Storybook option 2022-09-08 09:22:08 +02:00
Alexander Eyers-Taylor
7c4eac8520 Avoid prompting for upgrades when they wouldn't be prompted. (#1500) 2022-09-07 17:53:37 +01:00
Koen Vlaswinkel
6fdc632743 Add overview page for Storybook 2022-09-07 17:06:23 +02:00
Koen Vlaswinkel
a38a0356a0 Remove MRVA prefix from component stories 2022-09-07 16:43:19 +02:00
Koen Vlaswinkel
9383b03971 Move Storybook config to TypeScript 2022-09-07 16:41:42 +02:00
Koen Vlaswinkel
baf130d60e Remove WebView UI Toolkit stories 2022-09-07 16:37:37 +02:00
Koen Vlaswinkel
d15e3885d7 Add documentation about parameters in preview.js 2022-09-07 16:36:24 +02:00
Koen Vlaswinkel
2211e2317d Add mock VSCode API in Storybook
This allows us to add a story for the "main" remote queries view.
2022-09-07 14:35:04 +02:00
Koen Vlaswinkel
6018ebaca9 Setup Storybook for testing UI components
This sets up Storybook for testing of React components. It adds stories
for some of the MRVA components. It does not add stories for the main
MRVA views since those are not independent of VSCode and need to be run
from within VSCode.
2022-09-06 10:55:55 +02:00
Koen Vlaswinkel
da9065101f Merge pull request #1492 from github/koesie10/retry-artifacts
Add retry for finding result-index artifact
2022-09-05 10:08:11 +02:00
Koen Vlaswinkel
80867e6f58 Move result-index availability check to monitorQuery 2022-09-02 15:47:17 +02:00
Dave Bartolomeo
5067fbc452 Merge pull request #1494 from github/version/bump-to-v1.6.13
Bump version to v1.6.13
2022-09-02 05:17:43 -04:00
dbartol
d88b5170ac Bump version to v1.6.13 2022-09-01 21:06:50 +00:00
Dave Bartolomeo
d4673d9ca0 Merge pull request #1493 from dbartol/v1.16.12
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
v1.16.12
2022-09-01 16:38:14 -04:00
Dave Bartolomeo
87f45a7739 v1.16.12 2022-09-01 16:25:04 -04:00
Koen Vlaswinkel
0c89df9a80 Merge pull request #1482 from github/koesie10/bundle-codicons
Bundle Codicons using Webpack
2022-09-01 16:12:55 +02:00
Koen Vlaswinkel
57666bbbe3 Add retry for finding result-index artifact
It seems like the result-index artifact may not be available immediately
after the workflow run has finished. This adds a retry mechanism to wait
for the result-index to be available. It will retry at most 10 times
with a wait of 1 second between each retry.
2022-09-01 13:01:56 +02:00
Koen Vlaswinkel
ba8b32078d Simplify and clarify Webpack font config 2022-09-01 11:21:06 +02:00
Koen Vlaswinkel
fa4dd087e5 Remove Codicons references from webview 2022-09-01 09:39:19 +02:00
Dave Bartolomeo
ac74b967b3 Merge pull request #1490 from dbartol/dbartol/log-version/work 2022-08-31 21:01:36 -04:00
Dave Bartolomeo
c349c6a048 Fix race condition when generating evaluator log summaries
The original code that logged the human-readable log summary generated the log asynchronously, which was a reasonable choice. When I added support for viewing and scanning logs, I didn't notice that the summary was being generated asynchronously, and wrote my code assuming that the summary was already on disk when I opened it to find where each relation's log started. The effect was that, depending on timing, the evaluation sometimes failed with an error popup complaining about not being able to open the log summary file.

The fix is to _generate_ the log summary synchronously, but continue to _log_ it asynchronously.
2022-08-31 18:17:45 -04:00
Dave Bartolomeo
234b05994c Guard --sourcemap option based on CLI version 2022-08-31 18:08:21 -04:00
Koen Vlaswinkel
af8f0231c0 Merge pull request #1485 from github/koesie10/add-github-download-button
Remove canary requirement for GitHub database download
2022-08-31 16:57:12 +02:00
Edoardo Pirovano
84bd029749 Restart CLI server too when restarting query server 2022-08-31 14:39:44 +01:00
shati-patel
7d2e4b6de4 Bump CLI version to 2.10.4 for integration tests 2022-08-31 13:52:40 +01:00
Koen Vlaswinkel
23a0e03cef Completely remove using credentials in non-canary mode
This does not remove the previously added mechanism of not requesting
credentials, but using them when they are available. I expect this to be
used in the future.
2022-08-31 14:22:17 +02:00
Koen Vlaswinkel
21c5ed01ad Fix typo in getOctokit JSDoc
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2022-08-31 11:48:27 +02:00
Koen Vlaswinkel
d2af550bcc Merge remote-tracking branch 'origin/main' into koesie10/bundle-codicons 2022-08-31 09:51:46 +02:00
Koen Vlaswinkel
cf36a52762 Merge pull request #1478 from github/koesie10/abstract-interface-manager
Add abstract interface manager
2022-08-31 09:48:05 +02:00
Koen Vlaswinkel
ac1a97efa0 Refactor databaseFetcher tests to not use proxyquire 2022-08-30 15:32:08 +02:00
Koen Vlaswinkel
8d5067f622 Update CHANGELOG 2022-08-30 15:09:16 +02:00
Koen Vlaswinkel
fe5f1c417d Remove authentication requirement for download GitHub databases
This makes authentication for download GitHub CodeQL databases optional.
If you are already authenticated, your token will be used. If you are
not authenticated, an anonymous request will be made.

If the canary flag is enabled, you will be prompted for credentials when
downloading a database and you are not yet logged in.
2022-08-30 15:05:15 +02:00
Koen Vlaswinkel
95438bb7e3 Remove canary requirement for GitHub database download 2022-08-30 14:33:48 +02:00
Koen Vlaswinkel
6d7d0ca41a Merge pull request #1477 from github/koesie10/unified-webpack-bundle
Unify the Webpack bundle
2022-08-30 11:29:45 +02:00
Koen Vlaswinkel
3749e17769 Bundle Codicons using Webpack
This will include the Codicons inside the webview bundle, reducing the
number of files that need to be loaded and the resource roots that need
to be included.
2022-08-29 14:31:29 +02:00
Koen Vlaswinkel
ee49fb5070 Merge branch 'koesie10/unified-webpack-bundle' into koesie10/abstract-interface-manager 2022-08-29 14:12:20 +02:00
Koen Vlaswinkel
de6c523bad Merge remote-tracking branch 'origin/main' into koesie10/unified-webpack-bundle 2022-08-29 13:57:23 +02:00
Koen Vlaswinkel
6612c279ae Merge pull request #1479 from github/koesie10/improve-controller-repo-prompt
Improve prompot for controller repo
2022-08-29 09:53:26 +02:00
Koen Vlaswinkel
2dfa0e8b52 Simplify interface manager and types 2022-08-29 09:51:49 +02:00
Koen Vlaswinkel
0197306713 Remove unnecessary top-level package-lock.json 2022-08-29 09:47:24 +02:00
Dave Bartolomeo
269165eaa3 Merge pull request #1476 from github/version/bump-to-v1.6.12
Bump version to v1.6.12
2022-08-26 10:38:05 -04:00
Koen Vlaswinkel
14c736d72e Improve prompot for controller repo
This will improve the prompt for the controller repo by making clear
that the GitHub Actions workflow will be run in the specified repo.
2022-08-26 13:58:11 +02:00
Koen Vlaswinkel
b8898b939c Add abstract interface manager
This will add a new abstract class that implements the creation of the
panel and webview to reduce duplication across the different interface
managers.
2022-08-26 12:34:28 +02:00
Koen Vlaswinkel
45da1e0f1f Unify the Webpack bundle
This will move all webviews into a single Webpack bundle. This will make
it easier to add new webviews since we don't need to add a new bundle,
but just need to add a new directory with an `index.tsx` file.

It also moves the CSS processing to Webpack so that we don't need to
specify the CSS files to use separately, but can simply do so in the
TypeScript files.
2022-08-26 11:15:24 +02:00
dbartol
88c990c6ae Bump version to v1.6.12 2022-08-25 20:46:21 +00:00
Dave Bartolomeo
ac7211c117 Merge pull request #1475 from dbartol/dbartol/extension-release/work
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
Prepare for release 1.6.11
2022-08-25 16:36:44 -04:00
Dave Bartolomeo
d1d13fbd2e Update changelog for release 2022-08-25 13:11:50 -04:00
Dave Bartolomeo
f99166d26c Update Node version to match vscode 2022-08-25 13:01:35 -04:00
dependabot[bot]
9cd6f9a768 Bump d3 and @types/d3 in /extensions/ql-vscode (#1461)
Bumps [d3](https://github.com/d3/d3) and [@types/d3](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/d3). These dependencies needed to be updated together.

Updates `d3` from 6.7.0 to 7.6.1
- [Release notes](https://github.com/d3/d3/releases)
- [Changelog](https://github.com/d3/d3/blob/main/CHANGES.md)
- [Commits](https://github.com/d3/d3/compare/v6.7.0...v7.6.1)

Updates `@types/d3` from 6.7.5 to 7.4.0
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/d3)

---
updated-dependencies:
- dependency-name: d3
  dependency-type: direct:production
  update-type: version-update:semver-major
- dependency-name: "@types/d3"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-24 08:13:04 -07:00
Koen Vlaswinkel
4dd16f4611 Merge pull request #1472 from github/koesie10/fix-data-not-loaded-in-mrva-results
Fix data not being loaded in MRVA results panel
2022-08-24 15:14:26 +02:00
Koen Vlaswinkel
2113d08545 Fix data not being loaded in MRVA results panel
When the MRVA results panel is closed (so the panel gets disposed) and
opened again, it would not load the MRVA data (such as whether a query
has already been downloaded). This fixes it by also resetting the
internal state of whether the panel is loaded when the panel is
disposed.
2022-08-24 13:20:01 +02:00
Koen Vlaswinkel
5b5ef26864 Merge pull request #1471 from github/revert-1466-koesie10/add-github-download-button
Revert "Remove canary requirement for GitHub database download"
2022-08-24 12:12:44 +02:00
Koen Vlaswinkel
c5a6e64df8 Revert "Remove canary requirement for GitHub database download" 2022-08-24 11:51:44 +02:00
Charis Kyriakou
178d626062 Upgrade webview-ui-toolkit version with long link fix (#1469) 2022-08-24 10:17:41 +01:00
Dave Bartolomeo
d1d48b3506 Merge pull request #1468 from dbartol/dbartol/pmod-highlight/work
Add `implements` and `signature` to syntax highlighting
2022-08-23 17:02:03 -04:00
Dave Bartolomeo
9180d1d9fc Fix comment 2022-08-23 16:42:57 -04:00
Dave Bartolomeo
674c5ecbff Add implements and signature to syntax highlighting 2022-08-23 14:56:47 -04:00
Koen Vlaswinkel
951d0b1004 Merge remote-tracking branch 'origin/main' into koesie10/deprecate-lgtm-download 2022-08-23 16:27:23 +02:00
Koen Vlaswinkel
edcac6925c Merge pull request #1466 from github/koesie10/add-github-download-button
Remove canary requirement for GitHub database download
2022-08-23 16:24:12 +02:00
Koen Vlaswinkel
2989e4cfb9 Update CHANGELOG 2022-08-23 16:08:23 +02:00
Koen Vlaswinkel
8f869813a9 Deprecate download from LGTM by hiding it behind canary flag 2022-08-23 16:05:11 +02:00
Koen Vlaswinkel
c10500c5ea Update CHANGELOG 2022-08-23 14:58:36 +02:00
Koen Vlaswinkel
0832850009 Remove canary requirement for GitHub database download 2022-08-23 14:45:48 +02:00
Alexander Eyers-Taylor
b352830674 Improve startup time (#1465)
* ArchiveFileSystem: Only parse zips once

* CLIServer: Only get version once
2022-08-23 11:05:10 +01:00
Andrew Eisenberg
e913165249 Merge pull request #1463 from github/aeisenberg/bump-timeout 2022-08-17 17:21:31 -07:00
Andrew Eisenberg
ef94bb3d38 Bump telemetry test timeout
This test is failing occasionally on our CI system. Let's see if this
change prevents the failures.
2022-08-17 15:47:30 -07:00
Shati Patel
4d6076c4ea Escape HTML characters when rendering MRVA results as markdown (#1462) 2022-08-17 10:52:36 +01:00
Dave Bartolomeo
43650fde00 Merge pull request #1454 from github/dbartol/join-order
Report suspicious join orders
2022-08-15 14:13:35 -04:00
Angela P Wen
f2c72a67f6 Bump CLI version to 2.10.3 for integration tests (#1460) 2022-08-15 16:41:26 +00:00
Dave Bartolomeo
2b1f3227ce Fix computation of result sizes in IN_LAYER events 2022-08-12 17:00:26 -04:00
Dave Bartolomeo
841f1d3310 Replace console logging to route through problem reporter 2022-08-12 16:43:21 -04:00
Dave Bartolomeo
99756ae63b Fix PR feedback 2022-08-12 16:25:52 -04:00
Dave Bartolomeo
9a2bea39e6 Better handling of missing log data 2022-08-12 16:14:24 -04:00
Dave Bartolomeo
1aab49c719 Specify return type 2022-08-12 16:01:58 -04:00
Dave Bartolomeo
cf925c256f Update extensions/ql-vscode/src/log-insights/log-scanner-service.ts
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2022-08-12 15:50:28 -04:00
Dave Bartolomeo
8383a76e43 Merge branch 'dbartol/join-order' of https://github.com/github/vscode-codeql into dbartol/join-order 2022-08-12 15:41:52 -04:00
Dave Bartolomeo
c6d792f41e Fix PR feedback
Better handling of malformed RA
2022-08-12 15:39:32 -04:00
Dave Bartolomeo
277192e7d3 Update extensions/ql-vscode/src/log-insights/join-order.ts
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2022-08-12 14:59:20 -04:00
Dave Bartolomeo
85988ecf34 Update extensions/ql-vscode/src/log-insights/join-order.ts
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2022-08-12 14:50:10 -04:00
Dave Bartolomeo
49d12674b7 Cache regexprs 2022-08-12 14:47:50 -04:00
Dave Bartolomeo
beeb19dc05 Fix typo 2022-08-12 12:58:46 -04:00
Dave Bartolomeo
de88d27057 Update extensions/ql-vscode/src/log-insights/join-order.ts
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2022-08-12 12:49:29 -04:00
Dave Bartolomeo
eb2d00e999 Update extensions/ql-vscode/src/log-insights/join-order.ts
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2022-08-12 12:48:28 -04:00
Dave Bartolomeo
d58fb54928 Better formatting of metrics 2022-08-11 13:51:11 -04:00
Dave Bartolomeo
fdc209ca08 Test for log scanning 2022-08-10 18:07:59 -04:00
Dave Bartolomeo
28092f2b86 Move more of log scanning into pure code 2022-08-10 17:33:55 -04:00
Dave Bartolomeo
8970ad78ae Remove code added via bad merge 2022-08-10 13:51:08 -04:00
Dave Bartolomeo
e7a0c58940 Fix CodeQL alert 2022-08-10 13:18:00 -04:00
Dave Bartolomeo
02270aaeee Fix lint 2022-08-10 13:13:59 -04:00
Dave Bartolomeo
51fb03b4b1 Fix tests to match code changes 2022-08-10 13:11:34 -04:00
Dave Bartolomeo
838a2b71ac Scan logs on change in current query 2022-08-09 18:02:27 -04:00
Charis Kyriakou
f01c421d42 Merge pull request #1458 from github/version/bump-to-v1.6.11
Bump version to v1.6.11
2022-08-09 16:59:14 +01:00
charisk
561bc6f53c Bump version to v1.6.11 2022-08-09 15:21:26 +00:00
Charis Kyriakou
24b421e82d v1.6.10 (#1456)
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
2022-08-09 16:17:57 +01:00
Dave Bartolomeo
3c57597a19 Share code for splitting records from pseudo-JSONL 2022-08-05 17:36:45 -04:00
Dave Bartolomeo
e8d5029912 Merge remote-tracking branch 'origin/main' into dbartol/join-order-temp 2022-08-05 17:34:52 -04:00
Dave Bartolomeo
cb514f5c78 Pre-cleanup to avoid merge conflicts 2022-08-05 14:59:40 -04:00
Dave Bartolomeo
57bb8cee41 Update regexes to match new summary text 2022-08-04 16:17:27 -04:00
Dave Bartolomeo
1219ef4a8c Remove unnecessary command 2022-08-04 16:17:09 -04:00
Dave Bartolomeo
677a0f7940 Fix lint 2022-08-04 14:42:47 -04:00
Charis Kyriakou
b8cca29eb3 Ensure query history state is persisted after new query is added (#1451) 2022-08-04 15:06:47 +01:00
Shati Patel
4cbf104bdf (Minor) Remove outdated comment (#1453) 2022-08-04 13:24:48 +00:00
Angela P Wen
26ccde9e7d Bump CLI version to 2.10.2 for integration tests 2022-08-03 10:30:55 +01:00
Angela P Wen
beb5b78b89 Add 50ms wait for flaky telemetry popup test (#1449) 2022-08-02 08:24:07 -07:00
Dave Bartolomeo
c3a21b93c0 Merge pull request #1430 from github/dbartol/goto-ql
Initial implementation of sourcemap-based jump-to-QL command
2022-08-01 13:52:06 -04:00
Dave Bartolomeo
6b9f73e156 Add comment to test data file 2022-08-01 13:19:15 -04:00
Dave Bartolomeo
6409e09063 Code cleanup 2022-08-01 12:28:35 -04:00
Dave Bartolomeo
8f5611b074 Move sourcemap tests to cli-integration 2022-08-01 12:14:00 -04:00
Dave Bartolomeo
7f3fcce1ac Temporarily increase delay for extension activation in test 2022-07-29 13:11:46 -04:00
Dave Bartolomeo
4bc1d1ed8a Force activation of extension 2022-07-29 12:44:06 -04:00
Dave Bartolomeo
02e5b4e830 Fix installation of dependent extensions 2022-07-29 12:03:43 -04:00
Dave Bartolomeo
538792e8bb Try installing extension dependencies for minimal-workspace tests 2022-07-29 11:35:52 -04:00
Dave Bartolomeo
56ec970121 Merge branch 'dbartol/goto-ql' of https://github.com/github/vscode-codeql into dbartol/goto-ql 2022-07-29 11:01:07 -04:00
Dave Bartolomeo
57a04297bd Only disable specific extensions for minimal-workspace tests 2022-07-29 11:01:02 -04:00
Dave Bartolomeo
59f1e4e90a Update extensions/ql-vscode/src/pure/log-summary-parser.ts 2022-07-28 22:31:18 -04:00
Dave Bartolomeo
7c1fce3319 Merge remote-tracking branch 'origin/main' into dbartol/goto-ql 2022-07-28 22:29:45 -04:00
Dave Bartolomeo
476ea7aef0 Integration test 2022-07-28 22:20:22 -04:00
Elena Tanasoiu
0c654c4320 Merge pull request #1444 from github/elenatanasoiu/fix-bugs
Don't show parentheses when results are not yet fetched in Query History
2022-07-26 10:33:32 +01:00
Elena Tanasoiu
895ac6ae26 Squash extra whitespace for Query History labels
We'd like to remove duplicate whitespace in these labels in order
to make it less likely that we introduce extra space.

We initially also tried trimming whitespaces at the start and end
of these labels but that had no effect.
2022-07-26 09:49:27 +01:00
Elena Tanasoiu
52484f1211 Don't show parentheses when results are not yet fetched
We missed a place where we needed to check if results are present
before attempting to show them.

Let's also add tests for this.
2022-07-26 09:47:55 +01:00
Elena Tanasoiu
cba188b4db Use named arguments for mock function
We'd like to be able to add tests for when the result count exists and
when it's missing.

Let's change the createMockRemoteQueryInfo method so that we can pass
in parameters by name, e.g.

```
createMockRemoteQueryInfo(undefined, 2)
```

becomes

```
createMockRemoteQueryInfo({ repositoryCount: 2 }
```
2022-07-26 09:46:10 +01:00
Elena Tanasoiu
123b1fc085 Clarify title description
To make it clear it's referring to a `user-specified` label, not that the user is not specified.
2022-07-25 17:16:36 +01:00
Angela P Wen
833f8e06ca Add a tree viewer UI for the evaluator logs (#1433)
Co-authored-by: Aditya Sharad <6874315+adityasharad@users.noreply.github.com>
2022-07-22 12:01:39 +02:00
Andrew Eisenberg
747049ed1b Merge pull request #1435 from github/dependabot/npm_and_yarn/extensions/ql-vscode/yargs-parser-20.2.4
Bump yargs-parser from 5.0.0-security.0 to 20.2.4 in /extensions/ql-vscode
2022-07-20 08:47:15 -07:00
Andrew Eisenberg
d62e9181f2 Merge pull request #1436 from github/dependabot/npm_and_yarn/extensions/ql-vscode/semver-regex-and-husky-3.1.4
Bump semver-regex and husky in /extensions/ql-vscode
2022-07-20 08:45:04 -07:00
Dave Bartolomeo
e4d1f4e73e Fix newline handling for cross-platform logs
We were splitting JSONL records based on the current OS newline sequence. In order to handle reading of logs from the opposite OS, I've switched our split to handle both flavors of line ending. This originally showed up as log parser unit tests failing on Windows (the checked-in log used Unix line endings), but could affect real world usage as well.
2022-07-20 11:21:53 -04:00
dependabot[bot]
c1922126d3 Bump terser from 5.14.1 to 5.14.2 in /extensions/ql-vscode
Bumps [terser](https://github.com/terser/terser) from 5.14.1 to 5.14.2.
- [Release notes](https://github.com/terser/terser/releases)
- [Changelog](https://github.com/terser/terser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/terser/terser/commits)

---
updated-dependencies:
- dependency-name: terser
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-20 12:03:15 +01:00
elenatanasoiu
d2ebb3d20a Bump version to v1.6.10 2022-07-20 11:57:41 +01:00
Angela P Wen
72858e341a Bump CLI version to 2.10.1 for integration tests (#1442) 2022-07-20 11:55:43 +02:00
Elena Tanasoiu
4499773f6f Merge pull request #1440 from github/v1.6.9
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
v1.6.9
2022-07-20 10:16:21 +01:00
Elena Tanasoiu
1d3b0e0ca9 v1.6.9 2022-07-20 10:01:12 +01:00
Elena Tanasoiu
98e503c768 Merge pull request #1438 from github/shati-patel/gist-description
MRVA: Fix Gist description when repository count is undefined
2022-07-20 09:46:22 +01:00
Elena Tanasoiu
62c3974d35 Check for undefined, null or zero repositories
`undefined`, `null` and 0 will evaluate to `false` so if we only want to
display the repository count when these values are not present we can
check for a truthy value:

```
query.repositoryCount ? `(${pluralize(...)})` : '';
```

instead of checking explicitly:

```
query.repositoryCount !== undefined && query.repositoryCount !== null && query.repositoryCount != 0 ? `(${pluralize(...)})` : '';
```
2022-07-20 09:30:54 +01:00
Dave Bartolomeo
40e0027074 Fix newline handling for cross-platform logs
We were splitting JSONL records based on the current OS newline sequence. In order to handle reading of logs from the opposite OS, I've switched our split to handle both flavors of line ending. This originally showed up as log parser unit tests failing on Windows (the checked-in log used Unix line endings), but could affect real world usage as well.
2022-07-19 17:29:33 -04:00
shati-patel
ab1c2e0a0d Explicitly check for undefined 2022-07-19 20:00:10 +01:00
shati-patel
d918c41197 Fix Gist description when repository count is undefined 2022-07-19 18:25:25 +01:00
Dave Bartolomeo
84048ccac1 Merge remote-tracking branch 'origin/main' into dbartol/goto-ql 2022-07-19 09:39:51 -04:00
dependabot[bot]
cbb09da0d0 Bump semver-regex and husky in /extensions/ql-vscode
Bumps [semver-regex](https://github.com/sindresorhus/semver-regex) and [husky](https://github.com/typicode/husky). These dependencies needed to be updated together.

Updates `semver-regex` from 2.0.0 to 3.1.4
- [Release notes](https://github.com/sindresorhus/semver-regex/releases)
- [Commits](https://github.com/sindresorhus/semver-regex/compare/v2.0.0...v3.1.4)

Updates `husky` from 4.2.5 to 4.3.8
- [Release notes](https://github.com/typicode/husky/releases)
- [Commits](https://github.com/typicode/husky/compare/v4.2.5...v4.3.8)

---
updated-dependencies:
- dependency-name: semver-regex
  dependency-type: indirect
- dependency-name: husky
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-19 12:51:24 +00:00
dependabot[bot]
c8d3428f21 Bump yargs-parser in /extensions/ql-vscode
Bumps [yargs-parser](https://github.com/yargs/yargs-parser) from 5.0.0-security.0 to 20.2.4.
- [Release notes](https://github.com/yargs/yargs-parser/releases)
- [Changelog](https://github.com/yargs/yargs-parser/blob/main/CHANGELOG.md)
- [Commits](https://github.com/yargs/yargs-parser/commits/v20.2.4)

---
updated-dependencies:
- dependency-name: yargs-parser
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-19 12:51:22 +00:00
Elena Tanasoiu
2cf5b39cfe Merge pull request #1432 from github/charisk-elena/result-count-on-history-labels
Add result count to remote queries in Query History
2022-07-19 13:50:22 +01:00
Elena Tanasoiu
13921bf8a2 Extract sum method for adding up repo results
When a queryResult is created, it comes with an array for AnalysisSummaries.
There is one summary per repository.

We've had to calculate the total number of results for all summaries in multiple
places, so let's extract a method for this as well.
2022-07-19 13:26:56 +01:00
Elena Tanasoiu
12a97ecba2 Shorten param forwarding for repositoryCount 2022-07-19 13:26:54 +01:00
Elena Tanasoiu
26529232f4 Rename numRepositoriesQueries to repositoryCount
To make it consistent with `resultCount`.
2022-07-19 13:25:48 +01:00
Elena Tanasoiu
1b425fc261 DRY up labels using the new pluralize method 2022-07-19 13:25:40 +01:00
Elena Tanasoiu
9c598c2f06 Extract pluralize method
There are at least 4 different files where this method could DRY things up,
so let's extract it.

I've chosen to move it to src/helpers.ts but happy to be told there's a better
place for shared utility methods like this one.
2022-07-19 12:32:24 +01:00
Elena Tanasoiu
99a784f072 Be able to sort remote queries by number of results
Previously we would set all remote query results to -1 when someone
attempted to sort queries.

We would then only sort local queries as those had access to the number
of results.

Let's include number of results for remote queries in the sorting.

Co-authored-by: Shati Patel <shati-patel@github.com>
2022-07-19 12:32:24 +01:00
Elena Tanasoiu
030488a459 Make local and remote query results match
In the previous commit we're now displaying number of results for remote
queries.

Previously we could only do this for local queries.

Let's make the format match for both types of queries by displaying
number of results in parentheses: `(x results)`.

Co-authored-by: Shati Patel <shati-patel@github.com>
2022-07-19 12:32:24 +01:00
Elena Tanasoiu
377f7965b1 Add result count to remote queries in Query History
When you run a remote query, we'd like to display more information about
it in the Query History panel.

At the moment we've improved this [1] by adding the language and number of repositories.

In this commit we're also adding the number of results for a remote query.

So the final format of the query history item will change from:

`<query_name> - <query_status>`

to

`<query_name> (<language>) on x repositories (y results) - <query_status>`

[1]: https://github.com/github/vscode-codeql/pull/1427

Co-authored-by: Charis Kyriakou <charisk@github.com>
Co-authored-by: Shati Patel <shati-patel@github.com>
2022-07-19 12:32:22 +01:00
Charis Kyriakou
651a6fbda8 Ensure completed flag is set on remote query history items (#1434) 2022-07-19 10:40:02 +01:00
Elena Tanasoiu
55ffdf7963 Merge pull request #1431 from github/shati-elena/rename-gist
Add useful information to MRVA gist titles
2022-07-19 09:11:47 +01:00
Elena Tanasoiu
cc907d2f31 Add test for exportResultsToGist method
While we're here we're also adding a test for the `exportResultsToGist`
method, as there were no tests for the `export-results.ts` file.

We initially attempted to add the test to the pure-tests folder, but the
`export-results.ts` file imports some components from `vscode`, which
meant we needed to set up the test in an environment where VSCode
dependencies are available.

We chose to add the test to `vscode-tests/no-workspace` for convenience,
as there are already other unit tests there.

We've also had to import our own query and analysis result to be able
to work with data closer to reality for exported results.

Since we've introduced functionality to build a gist title, let's check
that the `exportResultsToGist` method will forward the correct title to
the GitHub Actions API.

Co-authored-by: Shati Patel <shati-patel@github.com>
2022-07-18 19:52:51 +01:00
Dave Bartolomeo
49a1576d14 Merge branch 'dbartol/goto-ql' of https://github.com/github/vscode-codeql into dbartol/goto-ql 2022-07-18 14:33:37 -04:00
Dave Bartolomeo
0cc4561ee9 Discard cached sourcemap when summary document is closed
Also some minor lint feedback
2022-07-18 14:33:33 -04:00
Elena Tanasoiu
c4df9dbec8 Extract method for creating Extension context
We'd like to re-use this to test the `exportResultsToGist` method in
`export-results.ts`.

So let's move it to a shared folder in the `vscode-tests/no-workspace` folder.

Since there's no `helper.ts` file in this folder and to avoid any confusion with
the `helpers.test.ts` file, I've opted to put this shared method into `index.ts`.

Happy to be told there's a better pattern for this as it doesn't feel very nice!
2022-07-18 19:22:44 +01:00
Elena Tanasoiu
c384a631dc Handle missing repo count gracefully
Let's handle this case gracefully and skip displaying the number of repositories
when they're not available.

Similarly let's add a check to see if we should pluralize the `repository` noun
or not.

Co-authored-by: Shati Patel <shati-patel@github.com>
2022-07-18 19:22:44 +01:00
Elena Tanasoiu
b079690f0e Add useful information to MRVA gist titles
All exported MRVA gists are given the name `CodeQL variant analysis
results', which makes it hard to work out what it contains at a glance.

We're adding more information in the gist title to make it more useful.

Example of new title:

`Empty Block (Go) x results (y repositories)`

This translates to:

`<query name> (<query language>) <number of results> results (<number of repositories> repositories)`

Co-authored-by: Shati Patel <shati-patel@github.com>
2022-07-18 19:22:41 +01:00
Elena Tanasoiu
4e863e995b Introduce method to add analysis results
We'd like to improve MRVA query gists by giving them more descriptive
titles that contain useful information about the query.

Let's add the number of query results to the title of the gist.

To do this we'll first need to count all the results provided to us in
the `analysisResults` array. There is an item in this array for each of
the repositories we've queried, so we're introducing a method to sum up
results for all the items in the array.

Co-authored-by: Shati Patel <shati-patel@github.com>
2022-07-18 19:20:58 +01:00
Dave Bartolomeo
576737cac8 Update extensions/ql-vscode/src/log-insights/summary-language-support.ts
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2022-07-15 14:50:48 -04:00
Dave Bartolomeo
742aa4ca19 Use error message helper 2022-07-15 11:43:05 -04:00
Shati Patel
f992679e94 MRVA: Include more info in query history label (#1427)
Co-authored-by: Elena Tanasoiu <elenatanasoiu@github.com>
2022-07-15 13:58:45 +01:00
Shati Patel
ffe1704ac0 Replace code paths dropdown with VS Code UI Toolkit (#1429) 2022-07-15 13:04:36 +01:00
Dave Bartolomeo
b5e6700cba Log message on failure to open sourcemap 2022-07-14 18:10:58 -04:00
Dave Bartolomeo
7f5302dc37 fs-extra 2022-07-14 17:39:16 -04:00
Dave Bartolomeo
3ea5524048 Hide "Go to QL Code" behind canary flag 2022-07-14 17:21:52 -04:00
Dave Bartolomeo
1823ae8397 Fix test expectation 2022-07-14 17:03:39 -04:00
Dave Bartolomeo
6dca9ccbeb Fix linter issues 2022-07-14 14:12:10 -04:00
Dave Bartolomeo
f3c2862937 Fix lint error 2022-07-14 14:06:19 -04:00
Dave Bartolomeo
855cb485d5 Initial implementation of sourcemap-based jump-to-QL command 2022-07-14 13:55:46 -04:00
Edoardo Pirovano
bd2dd04ac6 Regularly scrub query history view 2022-07-14 16:59:08 +01:00
Edoardo Pirovano
bbf4a03b03 Fix typo in config parameter name 2022-07-13 16:34:18 +01:00
Shati Patel
f38eb4895d Replace "repository search" filter box with VS Code UI Toolkit (#1424) 2022-07-13 15:13:31 +01:00
Andrew Eisenberg
f559b59ee5 Merge pull request #1420 from github/robertbrignull/api-retry
Add API retries for octokit requests
2022-07-12 08:12:21 -07:00
Angela P Wen
c9d895ea42 Parse summary of evaluator logs into data model (#1405)
Co-authored-by: Aditya Sharad <6874315+adityasharad@users.noreply.github.com>
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2022-07-12 14:04:55 +02:00
Shati Patel
e57bbcb711 Use VSCodeTags instead of Primer Labels in webview (#1421) 2022-07-01 16:21:44 +01:00
Shati Patel
b311991644 MRVA: Fix grammar in pop-up message (#1416) 2022-07-01 12:43:46 +01:00
Robert
825054a271 Use octokit retry module 2022-07-01 11:19:49 +00:00
Robert
f7aa0a5ae5 Install @octokot/plugin-retry 2022-07-01 11:06:22 +00:00
Andrew Eisenberg
f486ccfac6 Merge pull request #1418 from github/aeisenberg/resolve-ml-libs
Resolve ml-queries from directory
2022-06-30 08:56:15 -07:00
Andrew Eisenberg
70f74d3baf Resolve ml-queries from directory
Previously, there was a bug where quick eval queries would crash when
the eval snippet is in a library file.

The problem was that the `codeql resolve queries` command fails when
passed a library file. The fix is to avoid passing the library file at
all. Instead, pass the directory. This is safe because the resolve
queries command only needs to know which query pack the file is
contained in. Passing in the parent directory is the same as passing in
a file in this particular case.
2022-06-30 08:36:55 -07:00
Charis Kyriakou
ebad1844df MRVA: Don't show notification if user aborts firing off a query (#1417) 2022-06-30 14:35:33 +01:00
Charis Kyriakou
a40a2edaf2 Merge pull request #1414 from github/version/bump-to-v1.6.9
Bump version to v1.6.9
2022-06-29 13:17:30 +01:00
charisk
5f3d525ff8 Bump version to v1.6.9 2022-06-29 11:56:36 +00:00
Charis Kyriakou
8f5d88156f Merge pull request #1413 from github/v1.6.8
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
v1.6.8
2022-06-29 12:53:51 +01:00
Charis Kyriakou
7c941fe8a8 v1.6.8 2022-06-29 12:42:18 +01:00
Henry Mercer
e9835cb376 Improve changelog note
Co-authored-by: Edoardo Pirovano <6748066+edoardopirovano@users.noreply.github.com>
2022-06-29 12:01:10 +01:00
Henry Mercer
7651a960b1 Add changelog note 2022-06-29 12:01:10 +01:00
Henry Mercer
5b17a84733 Avoid resolve ml-models errors being logged during quick eval
Currently `resolve ml-models` only supports queryspecs, i.e. .ql, .qls,
directory, and query pack specifications. Therefore quick evaluation within
a library isn't
supported.
2022-06-29 12:01:10 +01:00
Andrew Eisenberg
22873a2f3c Invoke codeql pack install after adding a quick query
This ensures the pack lock file is in place after the quick query is
generated.
2022-06-29 10:25:00 +01:00
Andrew Eisenberg
2debadd3bf Update changelog 2022-06-29 10:25:00 +01:00
Charis Kyriakou
6808d7dcaf MRVA: Display alert text even if location is undefined (#1407) 2022-06-29 08:35:56 +01:00
Shati Patel
3480aa5495 Remove older CLI versions from testing matrix (#1410) 2022-06-28 14:07:11 +00:00
Shati Patel
a4d1ad57c7 Bump CLI version for integration tests (#1409) 2022-06-28 13:49:37 +00:00
Robert
628e0e924d Merge pull request #1408 from github/robertbrignull/cutoff_repos
Add cutoff repos and counts to error message
2022-06-28 06:16:18 -07:00
Robert
16077f4124 Add cutoff repos to error message 2022-06-28 12:21:11 +01:00
Charis Kyriakou
e6a68b3223 Add ability to define repo lists in a file outside of settings (#1402) 2022-06-24 16:48:10 +01:00
Charis Kyriakou
539a494914 Only copy repos that have results when copying repo list (#1406) 2022-06-24 14:13:33 +01:00
Charis Kyriakou
9c29c5c9c6 Add ability to create repo list from MRVA results (#1403) 2022-06-24 09:26:12 +01:00
Charis Kyriakou
fd4b6022a9 Refactor: Invert dependency between query history and remote quries managers (#1396) 2022-06-23 13:28:57 +01:00
dependabot[bot]
58bbb59e39 Bump shell-quote from 1.7.2 to 1.7.3 in /extensions/ql-vscode
Bumps [shell-quote](https://github.com/substack/node-shell-quote) from 1.7.2 to 1.7.3.
- [Release notes](https://github.com/substack/node-shell-quote/releases)
- [Changelog](https://github.com/substack/node-shell-quote/blob/master/CHANGELOG.md)
- [Commits](https://github.com/substack/node-shell-quote/compare/v1.7.2...1.7.3)

---
updated-dependencies:
- dependency-name: shell-quote
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-23 10:58:47 +01:00
Robert
5cc55530e1 Merge pull request #1399 from github/robertbrignull/skipped_private_repos
Show in log message when repos are filtered out for being private
2022-06-23 02:28:54 -07:00
Robert
3d74dbf48a Update extensions/ql-vscode/src/vscode-tests/no-workspace/remote-queries/run-remote-query.test.ts
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2022-06-23 10:16:37 +01:00
Elena Tanasoiu
b7489d8f66 Merge pull request #1400 from github/elenatanasoiu/check-for-codeql-folder-in-workspace
Fail fast if codeql repo is missing from the workspace
2022-06-23 09:26:40 +01:00
Elena Tanasoiu
e0b2aa9b45 Update docs for running cli-integration tests 2022-06-23 09:13:20 +01:00
Elena Tanasoiu
10b4c15053 Fail fast if codeql CLI is missing from the workspace
In order to run our cli-integration tests, we're required to have a
local copy of the codeql CLI repo. We can then run the tests by running
the `Launch Integration Tests - With CLI` task from inside VS Code.

(See CONTRIBUTING.md for details.)

If we don't have the CLI repo cloned locally or we're not pointing to it
in `launch.json`, we don't get a clear indication of what the problem is.

The tests will still attempt to run.

Let's fail fast instead and add an actionable error message to the output.
2022-06-23 09:13:20 +01:00
Robert
8bc83a336a Show skipped private repos in log message 2022-06-22 17:18:29 +01:00
Elena Tanasoiu
c84b858205 Merge pull request #1397 from github/elenatanasoiu/improve-mrva-controller-feedback
MRVA: Improve experience when controller repo does not exist
2022-06-22 17:03:26 +01:00
Elena Tanasoiu
e5f3a973a0 Improve experience when controller repo does not exist
The controller repo is set via the `codeQL.variantAnalysis.controllerRepo`
setting in VSCode.

While we have validation to check that the repo is not null and the
format of the controller repo is correct: `<owner>/<repo>`, we still
allow you to provide a non-existent repo (e.g. a mispelled one).

When the MRVA request is sent over to the API, it will verify that the
repo exists and return a very generic "Not Found" response.

This will then be logged out in the "Output" tab for VSCode.

We'd like to give users a better indication of what has gone wrong in
this case so we're making the error message more verbose.

Co-authored-by: Charis Kyriakou <charisk@github.com>
Co-authored-by: Shati Patel <shati-patel@github.com>
2022-06-22 16:42:51 +01:00
Andrew Eisenberg
3682f05a42 Merge pull request #1398 from github/aeisenberg/integration-tests-fix
Fix failing integration test
2022-06-21 17:33:54 -07:00
Andrew Eisenberg
eb5ce029ba Fix failing integration test
How did this ever work? It was using an old variant of the
qlpack name.

Also, this commit makes the unhandledRejection handler less
verbose. This gets hit when the tests end and there is a cancellation.
this is not an error.
2022-06-21 17:22:43 -07:00
Charis Kyriakou
0ebff2d6e6 Add ability of running MRVA against a whole org (#1372) 2022-06-21 09:19:07 +01:00
Andrew Eisenberg
d061634fe3 Merge pull request #1379 from github/aeisenberg/fix-bqrs-decode
Fix quoting of string columns in csv
2022-06-20 08:38:36 -07:00
Andrew Eisenberg
6b9410c67e Merge pull request #1388 from github/aeisenberg/fix-flaky-test
Arcane workaround to fix a flaky test
2022-06-20 08:13:22 -07:00
Andrew Eisenberg
8245e54e9c Update extensions/ql-vscode/src/vscode-tests/no-workspace/query-history.test.ts 2022-06-20 08:00:31 -07:00
Shati Patel
8ee744ef0c Bump CLI version used in integration tests (#1394) 2022-06-20 12:02:53 +00:00
Charis Kyriakou
da179b2580 Use VSCodeProgressRing instead of Primer's Spinner (#1392) 2022-06-20 08:39:28 +01:00
Shati Patel
0714f06adc MRVA: Include number of repositories queried in confirmation message (#1393) 2022-06-17 16:15:13 +01:00
Charis Kyriakou
b2906257a1 Remove use of Primer's box component (#1389) 2022-06-17 08:16:51 +01:00
Shati Patel
18097e4676 Allow repo names with periods (#1391) 2022-06-16 17:43:31 +01:00
Charis Kyriakou
efcade84c6 First pass at using VS Code UI toolkit (#1382) 2022-06-16 08:24:42 +00:00
Andrew Eisenberg
7f27375d17 Arcane workaround to fix a flaky test
For an inexplicable reason, the first time the selection
occurs, the value is incorrect. We often miss this error
in our tests if the expectation is reached before the
selection changed event fires.

It seems that the _second_ time the selection changed
event fires, the value is correct.

This change ensures we wait for the second selection change.
And we avoid running expectations until then.e
2022-06-15 15:16:51 -07:00
Andrew Eisenberg
01e1f134be Merge pull request #1361 from github/dependabot/npm_and_yarn/extensions/ql-vscode/glob-promise-4.2.2
Bump glob-promise from 3.4.0 to 4.2.2 in /extensions/ql-vscode
2022-06-15 21:22:15 +02:00
dependabot[bot]
0695b0557f Bump glob-promise from 3.4.0 to 4.2.2 in /extensions/ql-vscode
Bumps [glob-promise](https://github.com/ahmadnassri/node-glob-promise) from 3.4.0 to 4.2.2.
- [Release notes](https://github.com/ahmadnassri/node-glob-promise/releases)
- [Commits](https://github.com/ahmadnassri/node-glob-promise/compare/v3.4.0...v4.2.2)

---
updated-dependencies:
- dependency-name: glob-promise
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-15 18:24:24 +00:00
Elena Tanasoiu
c63f0c0833 Merge pull request #1387 from github/elenatanasoiu/node-18
Prepare for Node 18 upgrade
2022-06-15 19:23:01 +01:00
Elena Tanasoiu
3264ffaaa4 Upgrade webpack
We're upgrading the minimum version of webpack from 5.28.0 to 5.62.2
since this version doesn't rely on OpenSSL for its hashing algorithm so
it wouldn't need legacy OpenSSL support when we decide to upgrade to
Node 18.

This allows us to build our extension on Node 18:
https://github.com/github/vscode-codeql/runs/6904100934?check_suite_focus=true

Happily, this also works fine with our current version of Node (16.13.0).
2022-06-15 18:00:46 +01:00
Elena Tanasoiu
40959c8876 Use source-map 0.7.4
A new release of source-map was pushed 10 days ago:
https://github.com/mozilla/source-map/releases/tag/v0.7.4

It contains a fix for building on Node 18 (which was added in Oct
2020): https://github.com/mozilla/source-map/issues/423.

Let's make use of it!
2022-06-15 18:00:38 +01:00
Elena Tanasoiu
ecea7f4638 Merge pull request #1386 from github/elenatanasoiu/update-release-docs
Follow guidance for git tagging in contribution docs
2022-06-15 17:27:27 +01:00
Elena Tanasoiu
0b15a166fa Follow guidance for git tagging in contribution docs
Adding two things:
- A bit more detail on how to add a tag and how to delete a badly named one
- Switch to the official way of sharing tags according to the git docs[^1]

[^1]: https://git-scm.com/book/en/v2/Git-Basics-Tagging
2022-06-15 16:57:38 +01:00
elenatanasoiu
c368424a15 Bump version to v1.6.8 2022-06-15 15:42:36 +01:00
Elena Tanasoiu
5df1f80307 Merge pull request #1384 from github/v1.6.7
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
v1.6.7
2022-06-15 15:03:00 +01:00
Elena Tanasoiu
4b59045149 v1.6.7 2022-06-15 13:41:11 +00:00
Andrew Eisenberg
a3a05131c7 Handle quote escaping in csv export 2022-06-13 11:17:37 -07:00
Elena Tanasoiu
a9922b86fe Merge pull request #1374 from github/elenatanasoiu/set-node-version
Use the same Node version as VSCode
2022-06-13 16:54:10 +02:00
Elena Tanasoiu
431350ac0e Merge pull request #1375 from github/elenatanasoiu/adjust-font-on-results
Use base styling for MRVA results font
2022-06-13 16:53:32 +02:00
Elena Tanasoiu
5f8802fe7f Use base styling for MRVA results font
It's been pointed out that MRVA results are hard to read as the font is
small and narrowly spaced. It also doesn't match the font type normally
used in source files.

We can instead switch to using the font-family used by VS Code itself and
increase the font size from `x-small` to `small` for code snippets.
2022-06-13 14:28:15 +01:00
Elena Tanasoiu
5f21594d23 Provide a maximum node version in package.json
As recommended here https://github.com/github/vscode-codeql/pull/1369#issuecomment-1142418037, since the current build for this extension does not work with Node v18 https://github.com/github/vscode-codeql/issues/1373, it would be good to set a maximum node version until this gets addressed.

So we're updating `engines` here to allow for a maximum version, which in this case is v17.0.0.
2022-06-13 11:21:29 +01:00
Elena Tanasoiu
8964ec1a4d Use the same Node version as VSCode
As recommended here https://github.com/github/vscode-codeql/pull/1369#issuecomment-1142418037, we want to stay in sync with the current node version shipped with
VSCode (v16.13.0):

32d40cf44e/remote/.yarnrc (L2)

For this we can add a `.nvmrc` file to alert nvm to switch to the preferred version automatically.

It will also help prevent builds from failing when setting up the project for the first time, as building the extension currently fails in Node v18: https://github.com/github/vscode-codeql/issues/1373

We're also updating the docs to mention using `nvm` to manage node versions and point to the right place to check for current supported versions.
2022-06-13 11:21:25 +01:00
Andrew Eisenberg
aa270e57ec Refactor exportCsvResults and create test
1. `exportCsvResults` now no longer requires an `onFinish` callback.
2. The test adds a generic framework for creating a mock cli server.
   This should be used in future tests.
2022-06-06 10:21:12 +02:00
Andrew Eisenberg
fe7eb07f39 Don't choose a non-existent result set for csv viewing
If the `#select` resultset doesn't exist, arbitrarily choose the first
result set when viewing csv results. This will almost certainly be the
correct result set.

In the future, we could offer a popup if there are multiple result sets
available, but let's wait on that until someone actually asks for it.
2022-06-06 09:23:40 +02:00
Andrew Eisenberg
c10da7f960 Update Changelog 2022-06-03 16:26:02 -07:00
Andrew Eisenberg
0c8390c094 Fix quoting of string columns in csv 2022-06-03 16:24:10 -07:00
shati-patel
d41c63bf7d Change parameter type + extract local variable 2022-06-01 21:19:35 +01:00
shati-patel
a3bbdafabb Add tests for 'tryGetRemoteLocation' 2022-06-01 21:19:35 +01:00
shati-patel
a78eef464b Handle undefined URLs 2022-06-01 21:19:35 +01:00
shati-patel
e8348ac12a Check format of URI 2022-06-01 21:19:35 +01:00
shati-patel
5efc3835db Add sourceLocationPrefix to one of the test files 2022-06-01 21:19:35 +01:00
shati-patel
c4ed6e88de Pass sourceLocationPrefix down through all the functions 2022-06-01 21:19:35 +01:00
shati-patel
51e6559145 Update tryGetRemoteLocation to use sourceLocationPrefix (if available) 2022-06-01 21:19:35 +01:00
Charis Kyriakou
db8b419885 Combine time constants (#1371) 2022-06-01 16:52:18 +01:00
Elena Tanasoiu
475d7cc535 Merge pull request #1369 from github/elenatanasoiu/fix-casing-query-history
Be consistent about casing in Query History menu
2022-06-01 12:24:29 +01:00
Elena Tanasoiu
1858de5ed0 Update Changelog 2022-06-01 12:07:13 +01:00
Angela P Wen
642f4788fb Update tests to CLI v2.9.3 (#1370) 2022-05-31 17:44:43 +00:00
Elena Tanasoiu
7e70f8b758 Be consistent about casing in Query History
Reported here: https://github.com/github/code-scanning/issues/6008

We originally started out by capitalizing each word [1], but made some
small changes [2] which resulted in our Query History options
being inconsistent.

Let's fix that.

[1]: a5da556496/extensions/ql-vscode/package.json
[1]: b470e41431
2022-05-31 18:34:37 +01:00
Charis Kyriakou
e417bea948 Move time constants to time module (#1368) 2022-05-31 13:21:45 +01:00
Andrew Eisenberg
6b4be93169 Merge pull request #1363 from github/aeisenberg/resolve-ml-model
Add new support for resolve ml-models
2022-05-30 18:46:53 -07:00
Andrew Eisenberg
061eaad743 Update extensions/ql-vscode/src/cli.ts
Change version where precise ml-model resolution was introduced.
2022-05-30 18:32:11 -07:00
Andrew Eisenberg
8ff21d6c89 Merge pull request #1365 from github/aeisenberg/time
Extract time functions
2022-05-30 07:54:18 -07:00
Andrew Eisenberg
0d9f4e8c0f Merge pull request #1366 from github/aeisenberg/handle-missing-nwo
Handle missing nwos returned from graphql query
2022-05-30 07:53:55 -07:00
Andrew Eisenberg
02288718dc Handle missing nwos returned from graphql query 2022-05-27 13:12:49 -07:00
Andrew Eisenberg
615cf86fc0 Refactor time functions
Rename, add comments, and extract some local variables.
2022-05-27 08:51:14 -07:00
Andrew Eisenberg
d63a209674 Make conditional statement more explicit 2022-05-27 07:08:58 -07:00
Andrew Eisenberg
9d26304f7a Extract time functions
Create the `time.ts` module as a place to put fime functions.
Move two time functions there and create tests for them.

The `humanizeUnit` function now uses ECMAscript apis. This ensures
that pluralization happens appropriately.

Also, fix a small bug in the results view to enure `repository`
is correctly pluralized.
2022-05-26 15:47:03 -07:00
Andrew Eisenberg
f73bda438a Merge pull request #1362 from github/aeisenberg/last-update-sort
Add sort MRVA results by last updated
2022-05-26 09:15:37 -07:00
Andrew Eisenberg
19b65a654e Fix method name 2022-05-26 08:44:04 -07:00
Andrew Eisenberg
770127e67a Use the repo push icon 2022-05-26 06:55:12 -07:00
Andrew Eisenberg
f373e6467a Store LastUpdated as a duration, not a timestamp
The `lastUpdated` value is now the duration between timestamp of the
last time the repo was updated and time the file was downloaded.
This fixes the duration and it won't change over time.
2022-05-25 20:30:28 -07:00
Andrew Eisenberg
e43b4e66a1 Add sort MRVA results by last updated
1. Refactor references of `Stargazers` to `RepositoryMetadata` since
   the query is now more generic.
2. Update the graphql query to request last updated as well as stars
3. Update web view to display last updated
4. Update sort mechanism for last updated

A few notes:

1. I used `Intl.RelativeTimeFormat` to humanize the times. It wasn't as
   simple as I had hoped since I need to also make a guess as to which
   unit to use.
2. The icon used by last updated is not quite what is in the wireframes.
   But, I wanted to stick with primer icons and I used the closest I can
   get.
3. The last updated time is retrieved when the query is first loaded
   into vscode and then never changes. However, this time is always
   compared with `Date.now()`. So, opening the query up a week from now,
   all of the last updated times would be one week older (even if the
   repository has been updated since then).

   I don't want to re-retrieve the last updated time each time we open
   the query, so this timestamp will get out of date eventually.

   Is this confusing as it is?
2022-05-24 19:57:40 -07:00
Andrew Eisenberg
90ec003386 Add new support for resolve ml-models
The new support will be available in the next
release of the CLI, most likely 2.9.3,

This change requires the query to be run to be
passed in to the call to resolve ml-models.
2022-05-24 17:24:46 -07:00
Angela P Wen
2f9aca785e Log most expensive predicates and timings to query log (#1349) 2022-05-20 13:21:33 -07:00
Andrew Eisenberg
405a6c9901 Merge pull request #1353 from github/aeisenberg/sort-remote-results
Add sorting to variant analysis results
2022-05-20 09:23:10 -07:00
Andrew Eisenberg
3611b1fe61 Add comments and simplify some JSX
Use `ActionMenu.Anchor` instead of `ActionMenu.Button`.

The theming styles are not correct. Will work on that next.
2022-05-20 08:01:54 -07:00
Andrew Eisenberg
7b33441519 Merge pull request #1360 from github/dependabot/npm_and_yarn/extensions/ql-vscode/mocha-10.0.0
Bump mocha from 9.1.3 to 10.0.0 in /extensions/ql-vscode
2022-05-19 08:29:52 -07:00
dependabot[bot]
2a8f61dfbe Bump mocha from 9.1.3 to 10.0.0 in /extensions/ql-vscode
Bumps [mocha](https://github.com/mochajs/mocha) from 9.1.3 to 10.0.0.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v9.1.3...v10.0.0)

---
updated-dependencies:
- dependency-name: mocha
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-19 13:05:48 +00:00
Andrew Eisenberg
dcfd6d43c0 Merge pull request #1307 from github/dependabot/npm_and_yarn/extensions/ql-vscode/js-yaml-4.1.0
Bump js-yaml from 3.14.0 to 4.1.0 in /extensions/ql-vscode
2022-05-18 15:03:36 -07:00
Andrew Eisenberg
4e4d8b2f04 Fix js-yaml issues
With js-yaml 4.0, safeLoad is no longer available. Use load instead.
2022-05-18 14:45:28 -07:00
Andrew Eisenberg
50197ba7b7 Merge pull request #1308 from github/dependabot/npm_and_yarn/extensions/ql-vscode/style-loader-3.3.1
Bump style-loader from 0.23.1 to 3.3.1 in /extensions/ql-vscode
2022-05-18 14:40:50 -07:00
Andrew Eisenberg
6c376d8721 Add integration test for ensuring the graphql query succeeds 2022-05-18 14:20:24 -07:00
Andrew Eisenberg
82ada54103 Add sorting to variant analysis results
Sort by stars, number of results, and name.

This also includes a graphql query that retrieves all the stars
for relevant repositories.
2022-05-18 13:56:17 -07:00
shati-patel
0fdfeb3cd3 Bump version to v1.6.7 2022-05-17 16:37:42 +01:00
shati-patel
096d7719c6 v1.6.6
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
2022-05-17 16:07:06 +01:00
Angela P Wen
619c485224 Show query results before structured evaluator log summary completes (#1350) 2022-05-17 10:45:52 -04:00
Shati Patel
9367d5fb45 MRVA: Export results to local markdown files (#1344) 2022-05-17 10:03:23 +01:00
Shati Patel
50ec97ad91 Update CLI version used in tests 2022-05-16 17:43:06 +01:00
shati-patel
fa5fcde987 Rename button component 2022-05-16 16:45:07 +01:00
shati-patel
5b33333404 Fix padding to match design doc 2022-05-16 16:45:07 +01:00
shati-patel
cf50624e4e Tidy up 2022-05-16 16:45:07 +01:00
shati-patel
ccc9ed8b49 MRVA: Add webview button to export results 2022-05-16 16:45:07 +01:00
shati-patel
141f5381e7 MRVA: Export results from query history 2022-05-16 10:08:46 +01:00
shati-patel
be054ca4f8 Move "exporting results" to a separate file 2022-05-12 13:26:16 +01:00
Shati Patel
0a06452450 Update extensions/ql-vscode/src/remote-queries/remote-queries-manager.ts
Co-authored-by: Charis Kyriakou <charisk@users.noreply.github.com>
2022-05-11 17:27:45 +01:00
shati-patel
b840d3f9bf Tidy up Gist creation 2022-05-11 17:27:45 +01:00
shati-patel
c829c30688 MRVA: Add command to export markdown results to gist 2022-05-11 17:27:45 +01:00
Shati Patel
7947afb1b4 Remove unnecessary commas from alert shortDescription 2022-05-10 11:39:41 +01:00
dependabot[bot]
c32b53613d Bump js-yaml from 3.14.0 to 4.1.0 in /extensions/ql-vscode
Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.14.0 to 4.1.0.
- [Release notes](https://github.com/nodeca/js-yaml/releases)
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/3.14.0...4.1.0)

---
updated-dependencies:
- dependency-name: js-yaml
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-09 21:51:58 +00:00
Andrew Eisenberg
c058e7a128 Merge pull request #1340 from github/aeisenberg/fix-integration-tests
Fix cli-integration tests
2022-05-09 14:48:17 -07:00
Andrew Eisenberg
1dc663339d Revert back to vscode-test 2022-05-09 14:02:22 -07:00
Andrew Eisenberg
351db4efc8 Fix cli-integration tests
The main problem this commit fixes is with vscode 1.67.0, an error is
thrown when inside of integration tests and a dialog box is opened. We
were opening the telemetry dialog box. Now, an env variable is set
during cli-integration tests that prevents the dialog from being
opened.

There are also other cleanups and improvements with cli-integration
tests that assist with running locally:

- `vscode-test` dependency has been renamed to `@vscode/test-electron`,
  so use that instead and make the small API changes to support it.
- Commit the codeql-pack.lock.yml file so it isn't recreated on each
  test run.
- Ensure all databases are removed before _and after_ each test run
  that manipulates the set of installed databases
- Similarly, for quick query files, delete them before and after each
  test.
- Change some async `forEach` blocks to for loops in order to support
  sequential operations more easily.
2022-05-09 13:50:28 -07:00
Shati Patel
12d6ea3966 Update CLI version used in tests 2022-05-05 18:17:18 +01:00
shati-patel
e1adc7b428 MRVA: Rename summary file to make it appear first alphabetically 2022-05-05 14:32:55 +01:00
shati-patel
dc34adadcd Tidy up tests to use expected directory 2022-05-05 14:01:39 +01:00
shati-patel
6e06381640 Move expected files into subdirectory 2022-05-05 14:01:39 +01:00
shati-patel
f55389cd26 MRVA: Also test names of generated markdown files 2022-05-05 14:01:39 +01:00
shati-patel
6d930f53ba Don't include file extension for summary file
(to be consistent with other markdown files)
2022-05-04 17:18:00 +01:00
shati-patel
f7616cf685 Refactor: Include filename when generating markdown 2022-05-04 17:18:00 +01:00
Andrew Eisenberg
f55d9820bd Merge pull request #1329 from github/aeisenberg/run-queries-message
Further massage the message after running remote queries
2022-05-04 08:03:04 -07:00
Andrew Eisenberg
befc2cddd2 Apply suggestions from code review
Co-authored-by: Robert <robertbrignull@github.com>
2022-05-04 07:46:53 -07:00
Andrew Eisenberg
ef268e043f Further massage the message after running remote queries 2022-05-03 16:38:44 -07:00
Dave Bartolomeo
cff235c420 Auto-format 2022-05-03 18:14:03 -04:00
Dave Bartolomeo
1089a052ec Initial implementation of join order metric scanning 2022-05-03 13:20:30 -04:00
Charis Kyriakou
e10d2aef8e Upgrade node version minimum requirement (#1326) 2022-05-03 16:10:45 +01:00
Charis Kyriakou
a97c5fe836 MRVA: Support both local and gist links when generating markdown 2022-05-03 13:27:53 +01:00
shati-patel
9b6eddddae MRVA: Expand path results individually 2022-04-29 18:50:30 +01:00
shati-patel
ed84825e65 See if replaceAll works on actions 2022-04-29 14:58:16 +01:00
shati-patel
cb84003c31 Actually fix the test + code scanning error 🤞🏽 2022-04-29 14:58:16 +01:00
shati-patel
a1cd87aa3a Update test data + try to fix code scanning error 2022-04-29 14:58:16 +01:00
shati-patel
7d3b015e20 Generate markdown for raw result tables 2022-04-29 14:58:16 +01:00
Charis Kyriakou
7d0d11f526 MRVA: Add view on GitHub action to cancelled/failed queries (#1325) 2022-04-29 11:11:33 +01:00
Shati Patel
eb2520e7ca Fix outdated description of "watch" command 2022-04-28 15:29:38 +01:00
shati-patel
2675bf464e Correctly indent code snippets that use tabs 2022-04-28 12:03:39 +01:00
shati-patel
b638449498 Link to specific highlighted line instead of whole code snippet 2022-04-28 12:03:39 +01:00
Dave Bartolomeo
1d195cb347 Merge remote-tracking branch 'origin/main' into dbartol/join-order 2022-04-27 17:50:50 -04:00
Dave Bartolomeo
8d8ed28aea Add necessary dependencies 2022-04-27 17:50:46 -04:00
shati-patel
e12bf63f9a Minor tidy-up 2022-04-27 16:45:01 +01:00
shati-patel
ffcc1f82f1 Generate markdown summary file for raw results 2022-04-27 16:45:01 +01:00
shati-patel
04d7b12dd8 Extract "getAnalysisResultCount" to helper file 2022-04-27 16:45:01 +01:00
shati-patel
3e33b00a75 Add test data for raw results 2022-04-27 16:45:01 +01:00
Andrew Eisenberg
12dc378fc1 Merge pull request #1305 from github/aeisenberg/mrva-result-message
Update the warning message after running variant analysis
2022-04-26 11:46:03 -07:00
Andrew Eisenberg
bbe99f4451 Fix newlines in tests 2022-04-26 11:34:00 -07:00
shati-patel
91b17f8fa6 Update CLI version used in tests 2022-04-26 14:36:48 +01:00
Shati Patel
69f1778309 Update extensions/ql-vscode/src/remote-queries/remote-queries-markdown-generation.ts
Co-authored-by: Charis Kyriakou <charisk@users.noreply.github.com>
2022-04-26 10:15:45 +01:00
shati-patel
c55e801d00 Add example with multiple paths 2022-04-26 10:15:45 +01:00
shati-patel
b363f77a83 Tidy up how we display paths 2022-04-26 10:15:45 +01:00
shati-patel
f55f46f95b Markdown rendering: Display paths 2022-04-26 10:15:45 +01:00
github-actions[bot]
5ee2f0efe1 Bump version to v1.6.6 (#1315)
Co-authored-by: angelapwen <angelapwen@users.noreply.github.com>
2022-04-25 10:34:34 -07:00
Angela P Wen
1314a36ba4 v1.6.5 (#1314)
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
Co-authored-by: Shati Patel <42641846+shati-patel@users.noreply.github.com>
2022-04-25 09:42:44 -07:00
shati-patel
2b8b621298 10% nicer way of wrapping code lines 😄
+ update test data to contain a single-line example
2022-04-25 12:42:10 +01:00
shati-patel
aed4c9fc58 MRVA: Make markdown code snippets look nicer
Remove some extraneous newlines
2022-04-25 12:42:10 +01:00
Andrew Eisenberg
604001dfb1 Update extensions/ql-vscode/src/remote-queries/run-remote-query.ts
Move comment
2022-04-22 13:42:10 -07:00
shati-patel
1a03c0e4ac Attempt to fix tests 2022-04-22 14:52:15 +01:00
shati-patel
a8c54b7640 MRVA: Don't display excessive error/warning pop-ups if user doesn't select a repo list 2022-04-22 14:52:15 +01:00
shati-patel
9bb60c9474 Link to workflow + fix incorrect comment 2022-04-22 13:01:54 +01:00
shati-patel
0b2ce7a071 MRVA: Display available results, even if some jobs are cancelled 2022-04-22 13:01:54 +01:00
Andrew Eisenberg
44145baca7 Use os.EOL instead of \n 2022-04-21 08:47:48 -07:00
Angela P Wen
dac7881ca3 Bug fix for show eval log and show eval log summary commands in query history view (#1304) 2022-04-21 08:11:58 -07:00
Charis Kyriakou
31bd927959 Fix max-width for code paths (#1309) 2022-04-21 13:12:40 +00:00
dependabot[bot]
46922de3c0 Bump style-loader from 0.23.1 to 3.3.1 in /extensions/ql-vscode
Bumps [style-loader](https://github.com/webpack-contrib/style-loader) from 0.23.1 to 3.3.1.
- [Release notes](https://github.com/webpack-contrib/style-loader/releases)
- [Changelog](https://github.com/webpack-contrib/style-loader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/style-loader/compare/v0.23.1...v3.3.1)

---
updated-dependencies:
- dependency-name: style-loader
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-21 13:02:49 +00:00
shati-patel
908a862dd1 Tidy up test 2022-04-21 09:57:23 +01:00
shati-patel
6676ba99d0 Add initial test data for problem query 2022-04-21 09:57:23 +01:00
shati-patel
6d3c6e598f Change folder structure to have separate folders for path-problem and problem queries 2022-04-21 09:57:23 +01:00
shati-patel
e1a10fc827 Markdown results: Highlight snippets with "<strong>" 2022-04-21 09:17:31 +01:00
Andrew Eisenberg
2ebdbaafa3 Update the warning message after running variant analysis
Adds more information about onboarding new repos.
2022-04-20 14:46:23 -07:00
shati-patel
a74dfea08b Use HTML code blocks
This is so that we can highlight code snippets using `<strong>` tags
2022-04-20 10:32:24 +01:00
Andrew Eisenberg
44ff380c86 Merge pull request #1295 from github/aeisenberg/result-log
Add better error messages for partial failing variant analysis
2022-04-19 17:55:31 -07:00
Andrew Eisenberg
0a41713253 Add new test
And rename test file.
2022-04-19 17:45:17 -07:00
Andrew Eisenberg
f5a5675da4 Merge pull request #1298 from github/aeisenberg/no-results-mixing
Avoid loading wrong results into an open window
2022-04-19 16:02:14 -07:00
Andrew Eisenberg
7a8cf55090 Merge pull request #1294 from github/aeisenberg/db-name-github
Display nicer names for github-downloaded databases
2022-04-19 16:01:04 -07:00
Andrew Eisenberg
7932de3b7d Merge pull request #1299 from github/aeisenberg/remove-jsonc 2022-04-18 09:06:13 -07:00
Andrew Eisenberg
c8ba967a54 Remove jsonc dependency
This dependency was only used to parse package.json and
this can be just as easily parsed by regular JSON object.

jsonc can also parse JSON with comments, but there are no
comments in package.json.
2022-04-14 15:45:24 -07:00
Andrew Eisenberg
f5d2f0e0ca Merge pull request #1263 from github/dependabot/npm_and_yarn/extensions/ql-vscode/zip-a-folder-1.1.3
Bump zip-a-folder from 0.0.12 to 1.1.3 in /extensions/ql-vscode
2022-04-14 15:36:44 -07:00
Andrew Eisenberg
2c7e2f4b7f Avoid loading wrong results into an open window
This fixes a bug where an open results view will accumulate results from
other queries who have their results downloaded while this view is open.

The fix is to ensure that the results view for the query is open when
some results are downloaded.
2022-04-14 14:54:42 -07:00
dependabot[bot]
ee3ebe687b Bump zip-a-folder from 0.0.12 to 1.1.3 in /extensions/ql-vscode
Bumps [zip-a-folder](https://github.com/maugenst/zip-a-folder) from 0.0.12 to 1.1.3.
- [Release notes](https://github.com/maugenst/zip-a-folder/releases)
- [Commits](https://github.com/maugenst/zip-a-folder/commits)

---
updated-dependencies:
- dependency-name: zip-a-folder
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-14 21:09:55 +00:00
Andrew Eisenberg
77024f0757 Merge pull request #1297 from github/dependabot/npm_and_yarn/extensions/ql-vscode/async-2.6.4
Bump async from 2.6.3 to 2.6.4 in /extensions/ql-vscode
2022-04-14 14:08:46 -07:00
Andrew Eisenberg
c0e39886eb Add unit tests for remote queries in logs
Also, change text slightly.
2022-04-14 13:39:36 -07:00
dependabot[bot]
6339e7897d Bump async from 2.6.3 to 2.6.4 in /extensions/ql-vscode
Bumps [async](https://github.com/caolan/async) from 2.6.3 to 2.6.4.
- [Release notes](https://github.com/caolan/async/releases)
- [Changelog](https://github.com/caolan/async/blob/v2.6.4/CHANGELOG.md)
- [Commits](https://github.com/caolan/async/compare/v2.6.3...v2.6.4)

---
updated-dependencies:
- dependency-name: async
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-14 19:41:37 +00:00
Andrew Eisenberg
783a8a8772 Merge pull request #1290 from github/aeisenberg/remote-history-label-editing
Allow remote query items to have their labels edited
2022-04-14 12:40:50 -07:00
Andrew Eisenberg
8f2d865999 Display nicer names for github-downloaded databases
This will now name databases downloaded from github based on their nwo.

Also, this adds a new button to suggest downloading from github in an
empty databases view.
2022-04-14 12:36:43 -07:00
Andrew Eisenberg
d6d0825926 Merge branch 'main' into aeisenberg/remote-history-label-editing 2022-04-14 12:30:08 -07:00
Andrew Eisenberg
37de2e7f52 Add better error messages for partial failing variant analysis
Two scenarios handled:

1. no database for existing repo
2. repo does not exits (or no access rights for current user)

In either case, an error message is sent to the logs, with a notificaiton
in a popup.
2022-04-13 16:32:13 -07:00
Andrew Eisenberg
800c9e0c93 Remove deprecated comments
Also, change interpolation of result count. For Remote queries, this
value will be empty. For local queries, use the label `X results`, where
`X` is the number of results for this query.
2022-04-13 14:08:44 -07:00
shati-patel
a1bc7eb4d5 Capitalize! 2022-04-13 17:00:17 +01:00
shati-patel
8ff45d2aee Split handling of highlighted code lines into helper function 2022-04-13 17:00:17 +01:00
Andrew Eisenberg
8ec19777b5 Merge pull request #1291 from github/aeisenberg/handle-remote-cancel
Handle cancelling of remote queries
2022-04-13 06:59:14 -07:00
Andrew Eisenberg
3e388fedeb Merge pull request #1292 from github/aeisenberg/rename-remote-queries
Rename remote queries -> variant analysis
2022-04-13 06:41:33 -07:00
Andrew Eisenberg
83ffba2f08 Rename remote queries -> variant analysis
In some user facing text.
2022-04-12 13:16:44 -07:00
Andrew Eisenberg
f1c4fef8ba Allow remote query items to have their labels edited
The labels for remote query items are interpolated using the same
strategy as local queries with two caveats:

1. There is no easy way to get the result count without reading files,
   so, this value is kept empty.
2. There is no database name for remote queries. Instead, use the
   nwo of the controller repo.

Also, adds tests for the history item label provider.
2022-04-12 12:37:31 -07:00
Andrew Eisenberg
eec506a209 Introduce history-item-label-provider
The label provider is the instance that performs the logic for
generating labels for history items, using string interpolation when
necessary.

This commit creates the label provider and uses it with local queries.
Remote queries will be changed in the next commit.
2022-04-12 12:35:01 -07:00
Andrew Eisenberg
2ca0060c6a Remove references to 'remote query' in user-facing text
(Only in recently introduced locations. More work still needs to be
done.)

Also:

- Change error to info
- Create credentials directly, don't use a callback.
2022-04-12 12:20:39 -07:00
shati-patel
8b2d79a7f7 Formatting fixes and code tidy-up 2022-04-12 12:32:45 +01:00
shati-patel
c4db8b6d4b Create markdown summary file for sharing MRVA results 2022-04-12 12:32:45 +01:00
Andrew Eisenberg
61d4305593 Handle cancelling of remote queries
This change issues a cancel request when the user clicks on "cancel" for
a remote query.

The cancel can take quite a while to complete, so a message is popped up
to let the user know.
2022-04-11 19:05:00 -07:00
Andrew Eisenberg
542e1d24aa Allow remote query items to have their labels edited
The labels for remote query items are interpolated using the same
strategy as local queries with two caveats:

1. There is no easy way to get the result count without reading files,
   so, this value is kept empty.
2. There is no database name for remote queries. Instead, use the 
   nwo of the controller repo.
2022-04-11 14:20:57 -07:00
shati-patel
47ec074cfb Tidy-up and address review comments 2022-04-11 15:24:08 +01:00
shati-patel
e44835e795 Make line endings consistent? 2022-04-11 15:24:08 +01:00
shati-patel
2e28146a58 Create markdown files for sharing results 2022-04-11 15:24:08 +01:00
Andrew Eisenberg
85e051a76d Merge pull request #1285 from github/aeisenberg/reenable-openvsx
Reenable publishing to open-vsx
2022-04-08 09:40:40 -07:00
Andrew Eisenberg
7027a61e63 Update changelog 2022-04-07 14:01:28 -07:00
Andrew Eisenberg
e8c5b27d92 Reenable publishing to open-vsx
The extension ms-vscode.test-adapter-converter is now available on
open-vsx, but under a different name.

Fixes https://github.com/github/vscode-codeql/issues/1085

I have verified that I can publish and install the extension by
manually publishing v1.6.4.
2022-04-07 13:58:16 -07:00
Andrew Eisenberg
a3deec7875 Merge pull request #1280 from febuiles/patch-2
Update dependency-review.yml
2022-04-07 08:39:47 -07:00
Andrew Eisenberg
6282a462c8 Merge pull request #1283 from github/bump-cli 2022-04-07 07:44:29 -07:00
Shati Patel
dac5952e96 Bump CLI version used in integration tests 2022-04-07 15:30:41 +01:00
Federico Builes
ada6fcb908 Try using workflow_dispatch. 2022-04-07 13:36:57 +02:00
Andrew Eisenberg
8d2f902420 Merge pull request #1282 from github/version/bump-to-v1.6.5
Bump version to v1.6.5
2022-04-07 02:11:28 -07:00
aeisenberg
fc3fe7a81e Bump version to v1.6.5 2022-04-06 22:39:04 +00:00
Federico Builes
14608fe5f7 Update dependency-review.yml 2022-04-06 15:17:40 +02:00
864 changed files with 273758 additions and 31292 deletions

5
.git-blame-ignore-revs Normal file
View File

@@ -0,0 +1,5 @@
# Run this command to always ignore formatting commits in `git blame`
# git config blame.ignoreRevsFile .git-blame-ignore-revs
# Formatted all code using Prettier instead of tsfmt
ebcdf8ad0bb5bcb3efa679211709671716b892ba

9
.gitattributes vendored
View File

@@ -18,4 +18,11 @@ yarn.lock merge=binary
# https://mirrors.edge.kernel.org/pub/software/scm/git/docs/gitattributes.html
# suggests that this might interleave lines arbitrarily, but empirically
# it keeps added chunks contiguous
CHANGELOG.md merge=union
CHANGELOG.md merge=union
# Mark some JSON files containing test data as generated so they are not included
# as part of diffs or language statistics.
extensions/ql-vscode/src/stories/variant-analysis/data/*.json linguist-generated
# Always use LF line endings, also on Windows
* text=auto eol=lf

82
.github/actions/create-pr/action.yml vendored Normal file
View File

@@ -0,0 +1,82 @@
name: Create a PR if one doesn't exists
description: >
Creates a commit with the current changes to the repo, and opens a PR for that commit. If
any PR with the same title exists, then this action is marked as succeeded.
inputs:
commit-message:
description: >
The message for the commit to be created.
required: true
title:
description: >
The title of the PR. If empty, the title and body will be determined from the commit message.
default: ''
required: false
body:
description: >
The body (description) of the PR. The `title` input must be specified in order for this input to be used.
default: ''
required: false
head-branch:
description: >
The name of the branch to hold the new commit. If an existing open PR with the same head
branch exists, the new branch will be force-pushed to that PR instead of creating a new PR.
required: true
base-branch:
description: >
The base branch to target with the new PR.
required: true
token:
description: |
The GitHub token to use. It must have enough privileges to
make API calls to create and close pull requests.
required: true
runs:
using: composite
steps:
- name: Update git config
shell: bash
run: |
git config --global user.email "github-actions@github.com"
git config --global user.name "github-actions[bot]"
- name: Commit, Push and Open PR
shell: bash
env:
COMMIT_MESSAGE: ${{ inputs.commit-message }}
HEAD_BRANCH: ${{ inputs.head-branch }}
BASE_BRANCH: ${{ inputs.base-branch }}
GH_TOKEN: ${{ inputs.token }}
TITLE: ${{ inputs.title }}
BODY: ${{ inputs.body }}
run: |
set -exu
if ! [[ $(git diff --stat) != '' ]]; then
exit 0 # exit early
fi
# stage changes in the working tree
git add .
git commit -m "$COMMIT_MESSAGE"
git checkout -b "$HEAD_BRANCH"
# CAUTION: gits history changes with the following
git push --force origin "$HEAD_BRANCH"
PR_JSON=$(gh pr list --state open --json number --head "$HEAD_BRANCH")
if [[ $? -ne 0 ]]; then
echo "Failed to fetch existing PRs."
exit 1
fi
PR_NUMBERS=$(echo $PR_JSON | jq '. | length')
if [[ $PR_NUMBERS -ne 0 ]]; then
echo "Found existing open PR: $PR_NUMBERS"
exit 0
fi
gh pr create --head "$HEAD_BRANCH" --base "$BASE_BRANCH" --title "$TITLE" --body "$BODY" --assignee ${{ github.actor }} --draft
if [[ $? -ne 0 ]]; then
echo "Failed to create new PR."
exit 1
fi

View File

@@ -2,6 +2,8 @@ name: "CodeQL config"
queries:
- name: Run standard queries
uses: security-and-quality
- name: Experimental queries
uses: security-experimental
- name: Run custom javascript queries
uses: ./.github/codeql/queries
paths:

View File

@@ -0,0 +1,148 @@
/**
* @name A VS Code command should not be used in multiple locations
* @kind problem
* @problem.severity warning
* @id vscode-codeql/unique-command-use
* @description Using each VS Code command from only one location makes
* our telemetry more useful, because we can differentiate more user
* interactions and know which features of the UI our users are using.
* To fix this alert, new commands will need to be made so that each one
* is only used from one location. The commands should share the same
* implementation so we do not introduce duplicate code.
* When fixing this alert, search the codebase for all other references
* to the command name. The location of the alert is an arbitrarily
* chosen usage of the command, and may not necessarily be the location
* that should be changed to fix the alert.
*/
import javascript
/**
* The name of a VS Code command.
*/
class CommandName extends string {
CommandName() { exists(CommandUsage e | e.getCommandName() = this) }
/**
* In how many ways is this command used. Will always be at least 1.
*/
int getNumberOfUsages() { result = count(this.getAUse()) }
/**
* Get a usage of this command.
*/
CommandUsage getAUse() { result.getCommandName() = this }
/**
* Get the canonical first usage of this command, to use for the location
* of the alert. The implementation of this ordering of usages is arbitrary
* and the usage given may not be the one that should be changed when fixing
* the alert.
*/
CommandUsage getFirstUsage() {
result =
max(CommandUsage use |
use = this.getAUse()
|
use
order by
use.getFile().getRelativePath(), use.getLocation().getStartLine(),
use.getLocation().getStartColumn()
)
}
}
/**
* Represents a single usage of a command, either from within code or
* from the command's definition in package.json
*/
abstract class CommandUsage extends Locatable {
abstract string getCommandName();
}
/**
* A usage of a command from the typescript code, by calling `executeCommand`.
*/
class CommandUsageCallExpr extends CommandUsage, CallExpr {
CommandUsageCallExpr() {
this.getCalleeName() = "executeCommand" and
this.getArgument(0).(StringLiteral).getValue().matches("%codeQL%") and
not this.getFile().getRelativePath().matches("extensions/ql-vscode/test/%")
}
override string getCommandName() { result = this.getArgument(0).(StringLiteral).getValue() }
}
/**
* A usage of a command from the typescript code, by calling `CommandManager.execute`.
*/
class CommandUsageCommandManagerMethodCallExpr extends CommandUsage, MethodCallExpr {
CommandUsageCommandManagerMethodCallExpr() {
this.getCalleeName() = "execute" and
this.getReceiver().getType().unfold().(TypeReference).getTypeName().getName() = "CommandManager" and
this.getArgument(0).(StringLiteral).getValue().matches("%codeQL%") and
not this.getFile().getRelativePath().matches("extensions/ql-vscode/test/%")
}
override string getCommandName() { result = this.getArgument(0).(StringLiteral).getValue() }
}
/**
* A usage of a command from any menu that isn't the command palette.
* This means a user could invoke the command by clicking on a button in
* something like a menu or a dropdown.
*/
class CommandUsagePackageJsonMenuItem extends CommandUsage, JsonObject {
CommandUsagePackageJsonMenuItem() {
exists(this.getPropValue("command")) and
exists(PackageJson packageJson, string menuName |
packageJson
.getPropValue("contributes")
.getPropValue("menus")
.getPropValue(menuName)
.getElementValue(_) = this and
menuName != "commandPalette"
)
}
override string getCommandName() { result = this.getPropValue("command").getStringValue() }
}
/**
* Is the given command disabled for use in the command palette by
* a block with a `"when": "false"` field.
*/
predicate isDisabledInCommandPalette(string commandName) {
exists(PackageJson packageJson, JsonObject commandPaletteObject |
packageJson
.getPropValue("contributes")
.getPropValue("menus")
.getPropValue("commandPalette")
.getElementValue(_) = commandPaletteObject and
commandPaletteObject.getPropValue("command").getStringValue() = commandName and
commandPaletteObject.getPropValue("when").getStringValue() = "false"
)
}
/**
* Represents a command being usable from the command palette.
* This means that a user could choose to manually invoke the command.
*/
class CommandUsagePackageJsonCommandPalette extends CommandUsage, JsonObject {
CommandUsagePackageJsonCommandPalette() {
this.getFile().getBaseName() = "package.json" and
exists(this.getPropValue("command")) and
exists(PackageJson packageJson |
packageJson.getPropValue("contributes").getPropValue("commands").getElementValue(_) = this
) and
not isDisabledInCommandPalette(this.getPropValue("command").getStringValue())
}
override string getCommandName() { result = this.getPropValue("command").getStringValue() }
}
from CommandName c
where c.getNumberOfUsages() > 1
select c.getFirstUsage(),
"The " + c + " command is used from " + c.getNumberOfUsages() + " locations"

View File

@@ -11,7 +11,7 @@ updates:
- dependency-name: "*"
update-types: ["version-update:semver-minor", "version-update:semver-patch"]
- package-ecosystem: "github-actions"
directory: ".github"
directory: "/"
schedule:
interval: "weekly"
day: "thursday" # Thursday is arbitrary

61
.github/workflows/bump-cli.yml vendored Normal file
View File

@@ -0,0 +1,61 @@
name: Bump CLI version
on:
workflow_dispatch:
inputs:
option:
description: "Option"
required: true
default: 'replace'
type: choice
options:
- prepend
- replace
version:
description: |
The version to prepend to the supported versions file. This should be in the form: `vA.B.C`.
required: false
type: string
pull_request:
branches: [main]
paths:
- .github/actions/create-pr/action.yml
- .github/workflows/bump-cli.yml
schedule:
- cron: 0 0 */14 * * # run every 14 days
permissions:
contents: write
pull-requests: write
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Bump CLI
if: ${{ inputs.option == 'replace' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
scripts/replace-cli-version.sh
- name: Prepend another version
if: ${{ inputs.option == 'prepend' }}
run: |
cat extensions/ql-vscode/supported_cli_versions.json | jq '. |= ["${{ inputs.version }}"] + .' > supported_cli_versions_temp.json
mv supported_cli_versions_temp.json extensions/ql-vscode/supported_cli_versions.json
echo "LATEST_VERSION=${{ inputs.version }}" >> $GITHUB_ENV
echo "PREVIOUS_VERSION=`jq -r '.[1]' extensions/ql-vscode/supported_cli_versions.json`" >> $GITHUB_ENV
- name: Commit, Push and Open a PR
uses: ./.github/actions/create-pr
with:
token: ${{ secrets.GITHUB_TOKEN }}
base-branch: main
head-branch: github-action/bump-cli
commit-message: Bump CLI version from ${{ env.PREVIOUS_VERSION }} to ${{ env.LATEST_VERSION }} for integration tests
title: Bump CLI Version to ${{ env.LATEST_VERSION }} for integration tests
body: >
Bumps CLI version from ${{ env.PREVIOUS_VERSION }} to ${{ env.LATEST_VERSION }}

View File

@@ -19,7 +19,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@main

View File

@@ -1,11 +1,10 @@
name: 'Dependency Review'
on:
on:
- pull_request
- workflow_dispatch
permissions:
actions: read
pull-requests: read
contents: read
jobs:
dependency-review:
@@ -14,4 +13,4 @@ jobs:
- name: 'Checkout Repository'
uses: actions/checkout@v3
- name: 'Dependency Review'
uses: dsp-testing/dependency-review-action@main
uses: actions/dependency-review-action@v3

View File

@@ -16,18 +16,20 @@ jobs:
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-node@v1
- uses: actions/setup-node@v3
with:
node-version: '16.13.0'
node-version: '16.14.2'
cache: 'npm'
cache-dependency-path: extensions/ql-vscode/package-lock.json
- name: Install dependencies
working-directory: extensions/ql-vscode
run: |
npm install
npm ci
shell: bash
- name: Build
@@ -45,7 +47,7 @@ jobs:
cp dist/*.vsix artifacts
- name: Upload artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-latest'
with:
name: vscode-codeql-extension
@@ -65,29 +67,105 @@ jobs:
# This workflow step gets an unstable testing version of the CodeQL CLI. It should not be used outside of these tests.
run: |
LATEST=`gh api repos/dsp-testing/codeql-cli-nightlies/releases --jq '.[].tag_name' --method GET --raw-field 'per_page=1'`
echo "::set-output name=nightly-url::https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/$LATEST"
echo "nightly-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/$LATEST" >> "$GITHUB_OUTPUT"
test:
name: Test
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-node@v3
with:
node-version: '16.14.2'
cache: 'npm'
cache-dependency-path: extensions/ql-vscode/package-lock.json
- name: Install dependencies
working-directory: extensions/ql-vscode
run: |
npm ci
shell: bash
- name: Check types
working-directory: extensions/ql-vscode
run: |
npm run check-types
- name: Lint
working-directory: extensions/ql-vscode
run: |
npm run lint
- name: Lint Markdown
working-directory: extensions/ql-vscode
run: |
npm run lint:markdown
- name: Lint scenarios
working-directory: extensions/ql-vscode
run: |
npm run lint:scenarios
unit-test:
name: Unit Test
runs-on: ${{ matrix.os }}
needs: [find-nightly]
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-node@v1
- uses: actions/setup-node@v3
with:
node-version: '16.13.0'
node-version: '16.14.2'
cache: 'npm'
cache-dependency-path: extensions/ql-vscode/package-lock.json
- name: Install dependencies
working-directory: extensions/ql-vscode
run: |
npm install
npm ci
shell: bash
- name: Run unit tests
working-directory: extensions/ql-vscode
run: |
npm run test:unit
- name: Run view tests
working-directory: extensions/ql-vscode
run: |
npm run test:view
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-node@v3
with:
node-version: '16.14.2'
cache: 'npm'
cache-dependency-path: extensions/ql-vscode/package-lock.json
- name: Install dependencies
working-directory: extensions/ql-vscode
run: |
npm ci
shell: bash
- name: Build
@@ -98,44 +176,44 @@ jobs:
npm run build
shell: bash
- name: Lint
working-directory: extensions/ql-vscode
run: |
npm run lint
- name: Run unit tests (Linux)
working-directory: extensions/ql-vscode
if: matrix.os == 'ubuntu-latest'
run: |
npm run test
- name: Run unit tests (Windows)
if: matrix.os == 'windows-latest'
working-directory: extensions/ql-vscode
run: |
npm run test
- name: Run integration tests (Linux)
if: matrix.os == 'ubuntu-latest'
working-directory: extensions/ql-vscode
env:
VSCODE_CODEQL_GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
run: |
sudo apt-get install xvfb
/usr/bin/xvfb-run npm run integration
unset DBUS_SESSION_BUS_ADDRESS
/usr/bin/xvfb-run npm run test:vscode-integration
- name: Run integration tests (Windows)
if: matrix.os == 'windows-latest'
working-directory: extensions/ql-vscode
env:
VSCODE_CODEQL_GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
run: |
npm run integration
npm run test:vscode-integration
set-matrix:
name: Set Matrix for cli-test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set the variables
id: set-variables
run: echo "cli-versions=$(cat ./extensions/ql-vscode/supported_cli_versions.json | jq -rc)" >> $GITHUB_OUTPUT
outputs:
cli-versions: ${{ steps.set-variables.outputs.cli-versions }}
cli-test:
name: CLI Test
runs-on: ${{ matrix.os }}
needs: [find-nightly]
needs: [find-nightly, set-matrix]
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
version: ['v2.3.3', 'v2.4.6', 'v2.5.9', 'v2.6.3', 'v2.7.6', 'v2.8.4', 'nightly']
version: ${{ fromJson(needs.set-matrix.outputs.cli-versions) }}
fail-fast: false
env:
CLI_VERSION: ${{ matrix.version }}
NIGHTLY_URL: ${{ needs.find-nightly.outputs.url }}
@@ -143,16 +221,18 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- uses: actions/setup-node@v1
- uses: actions/setup-node@v3
with:
node-version: '16.13.0'
node-version: '16.14.2'
cache: 'npm'
cache-dependency-path: extensions/ql-vscode/package-lock.json
- name: Install dependencies
working-directory: extensions/ql-vscode
run: |
npm install
npm ci
shell: bash
- name: Build
@@ -168,16 +248,13 @@ jobs:
if [[ "${{ matrix.version }}" == "nightly" ]]
then
REF="codeql-cli/latest"
elif [[ "${{ matrix.version }}" == "v2.2.6" || "${{ matrix.version }}" == "v2.3.3" ]]
then
REF="codeql-cli/v2.4.5"
else
REF="codeql-cli/${{ matrix.version }}"
fi
echo "::set-output name=ref::$REF"
echo "ref=$REF" >> "$GITHUB_OUTPUT"
- name: Checkout QL
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: github/codeql
ref: ${{ steps.choose-ref.outputs.ref }}
@@ -187,10 +264,11 @@ jobs:
working-directory: extensions/ql-vscode
if: matrix.os == 'ubuntu-latest'
run: |
/usr/bin/xvfb-run npm run cli-integration
unset DBUS_SESSION_BUS_ADDRESS
/usr/bin/xvfb-run npm run test:cli-integration
- name: Run CLI tests (Windows)
working-directory: extensions/ql-vscode
if: matrix.os == 'windows-latest'
run: |
npm run cli-integration
npm run test:cli-integration

View File

@@ -18,11 +18,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- uses: actions/setup-node@v1
- uses: actions/setup-node@v3
with:
node-version: '16.13.0'
node-version: '16.14.2'
- name: Install dependencies
run: |
@@ -47,46 +47,39 @@ jobs:
# 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"
echo "vsix_path=$VSIX_PATH" >> "$GITHUB_OUTPUT"
# Transform the GitHub ref so it can be used in a filename.
# The last sed invocation is used for testing branches that modify this workflow.
REF_NAME="$(echo ${{ github.ref }} | sed -e 's:^refs/tags/::' | sed -e 's:/:-:g')"
echo "::set-output name=ref_name::$REF_NAME"
echo "ref_name=$REF_NAME" >> "$GITHUB_OUTPUT"
- name: Upload artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: vscode-codeql-extension
path: artifacts
- name: Upload source maps
uses: actions/upload-artifact@v3
with:
name: vscode-codeql-sourcemaps
path: dist/vscode-codeql/out/*.map
# TODO Run tests, or check that a test run on the same branch succeeded.
- name: Create sourcemap ZIP file
run: |
cd dist/vscode-codeql/out
zip -r ../../vscode-codeql-sourcemaps.zip *.map
- name: Create release
id: create-release
uses: actions/create-release@v1.0.0
run: |
gh release create ${{ github.ref_name }} --draft --title "Release ${{ github.ref_name }}" \
'${{ steps.prepare-artifacts.outputs.vsix_path }}#${{ format('vscode-codeql-{0}.vsix', steps.prepare-artifacts.outputs.ref_name) }}' \
'dist/vscode-codeql-sourcemaps.zip#${{ format('vscode-codeql-sourcemaps-{0}.zip', steps.prepare-artifacts.outputs.ref_name) }}'
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
###
# Do Post release work: version bump and changelog PR
@@ -107,7 +100,7 @@ jobs:
# Bump to the next patch version. Major or minor version bumps will have to be done manually.
# Record the next version number as an output of this step.
NEXT_VERSION="$(npm version patch)"
echo "::set-output name=next_version::$NEXT_VERSION"
echo "next_version=$NEXT_VERSION" >> "$GITHUB_OUTPUT"
- name: Add changelog for next release
if: success()
@@ -116,16 +109,15 @@ jobs:
perl -i -pe 's/^/## \[UNRELEASED\]\n\n/ if($.==3)' CHANGELOG.md
- name: Create version bump PR
uses: peter-evans/create-pull-request@c7f493a8000b8aeb17a1332e326ba76b57cb83eb # v3.4.1
uses: ./.github/actions/create-pr
if: success()
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Bump version to ${{ steps.bump-patch-version.outputs.next_version }}
title: Bump version to ${{ steps.bump-patch-version.outputs.next_version }}
body: This PR was automatically generated by the GitHub Actions release workflow in this repository.
branch: ${{ format('version/bump-to-{0}', steps.bump-patch-version.outputs.next_version) }}
base: main
draft: true
head-branch: ${{ format('version/bump-to-{0}', steps.bump-patch-version.outputs.next_version) }}
base-branch: main
vscode-publish:
name: Publish to VS Code Marketplace
@@ -136,29 +128,24 @@ jobs:
VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }}
steps:
- name: Download artifact
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: vscode-codeql-extension
- name: Publish to Registry
run: |
npx vsce publish -p $VSCE_TOKEN --packagePath *.vsix || \
echo "Failed to publish to VS Code Marketplace. \
If this was an authentication problem, please make sure the \
auth token hasn't expired."
npx vsce publish -p $VSCE_TOKEN --packagePath *.vsix
# TODO This job is currently broken and is blocked on https://github.com/github/vscode-codeql/issues/1085
open-vsx-publish:
name: Publish to Open VSX Registry
needs: build
environment: publish-open-vsx
runs-on: ubuntu-latest
if: 1 == 0
env:
OPEN_VSX_TOKEN: ${{ secrets.OPEN_VSX_TOKEN }}
steps:
- name: Download artifact
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: vscode-codeql-extension

7
.gitignore vendored
View File

@@ -16,7 +16,6 @@ artifacts/
# Visual Studio workspace state
.vs/
# Rush files
/common/temp/**
package-deps.json
**/.rush/temp
# CodeQL metadata
.cache/
.codeql/

4
.husky/pre-commit Executable file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
cd extensions/ql-vscode && npm run format-staged

4
.husky/pre-push Executable file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
cd extensions/ql-vscode && ./scripts/forbid-test-only

4
.markdownlint.json Normal file
View File

@@ -0,0 +1,4 @@
{
"MD013": false,
"MD041": false
}

View File

@@ -4,8 +4,11 @@
// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"amodio.tsl-problem-matcher",
"DavidAnson.vscode-markdownlint",
"dbaeumer.vscode-eslint",
"eternalphane.tsfmt-vscode"
"esbenp.prettier-vscode",
"firsttris.vscode-jest-runner",
"Orta.vscode-jest",
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []

143
.vscode/launch.json vendored
View File

@@ -11,8 +11,8 @@
"--extensionDevelopmentPath=${workspaceRoot}/extensions/ql-vscode",
// Add a reference to a workspace to open. Eg-
// "${workspaceRoot}/../vscode-codeql-starter/vscode-codeql-starter.code-workspace"
// "${workspaceRoot}/../codespaces-codeql/tutorial.code-workspace"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/extensions/ql-vscode/out/**/*.js",
@@ -30,23 +30,57 @@
"name": "Launch Unit Tests (vscode-codeql)",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/extensions/ql-vscode/node_modules/mocha/bin/_mocha",
"program": "${workspaceFolder}/extensions/ql-vscode/node_modules/jest/bin/jest.js",
"showAsyncStacks": true,
"cwd": "${workspaceFolder}/extensions/ql-vscode",
"runtimeArgs": [
"--inspect=9229"
],
"env": {
"LANG": "en-US",
"TZ": "UTC"
},
"args": [
"--exit",
"-u",
"bdd",
"--colors",
"--diff",
"-r",
"ts-node/register",
"test/pure-tests/**/*.ts"
"--projects",
"test/unit-tests"
],
"stopOnEntry": false,
"sourceMaps": true,
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"name": "Launch Selected Unit Test (vscode-codeql)",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/extensions/ql-vscode/node_modules/jest/bin/jest.js",
"showAsyncStacks": true,
"cwd": "${workspaceFolder}/extensions/ql-vscode",
"env": {
"LANG": "en-US",
"TZ": "UTC"
},
"args": [
"--projects",
"test",
"-i",
"${relativeFile}",
"-t",
"${selectedText}"
],
"stopOnEntry": false,
"sourceMaps": true,
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"name": "Launch Unit Tests - React (vscode-codeql)",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/extensions/ql-vscode/node_modules/jest/bin/jest.js",
"showAsyncStacks": true,
"cwd": "${workspaceFolder}/extensions/ql-vscode",
"args": [
"--projects",
"src/view"
],
"port": 9229,
"stopOnEntry": false,
"sourceMaps": true,
"console": "integratedTerminal",
@@ -54,59 +88,46 @@
},
{
"name": "Launch Integration Tests - No Workspace (vscode-codeql)",
"type": "extensionHost",
"type": "node",
"request": "launch",
"runtimeExecutable": "${execPath}",
"program": "${workspaceFolder}/extensions/ql-vscode/node_modules/jest/bin/jest.js",
"showAsyncStacks": true,
"cwd": "${workspaceFolder}/extensions/ql-vscode",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}/extensions/ql-vscode",
"--extensionTestsPath=${workspaceRoot}/extensions/ql-vscode/out/vscode-tests/no-workspace/index",
"--disable-extensions",
"--disable-gpu"
"--projects",
"test/vscode-tests/no-workspace"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/extensions/ql-vscode/out/**/*.js",
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"attachSimplePort": 9223,
},
{
"name": "Launch Integration Tests - Minimal Workspace (vscode-codeql)",
"type": "extensionHost",
"type": "node",
"request": "launch",
"runtimeExecutable": "${execPath}",
"program": "${workspaceFolder}/extensions/ql-vscode/node_modules/jest/bin/jest.js",
"showAsyncStacks": true,
"cwd": "${workspaceFolder}/extensions/ql-vscode",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}/extensions/ql-vscode",
"--extensionTestsPath=${workspaceRoot}/extensions/ql-vscode/out/vscode-tests/minimal-workspace/index",
"--disable-extensions",
"--disable-gpu",
"${workspaceRoot}/extensions/ql-vscode/test/data"
"--projects",
"test/vscode-tests/minimal-workspace"
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/extensions/ql-vscode/out/**/*.js",
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"attachSimplePort": 9223,
},
{
"name": "Launch Integration Tests - With CLI",
"type": "extensionHost",
"type": "node",
"request": "launch",
"runtimeExecutable": "${execPath}",
"program": "${workspaceFolder}/extensions/ql-vscode/node_modules/jest/bin/jest.js",
"showAsyncStacks": true,
"cwd": "${workspaceFolder}/extensions/ql-vscode",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}/extensions/ql-vscode",
"--extensionTestsPath=${workspaceRoot}/extensions/ql-vscode/out/vscode-tests/cli-integration/index",
"--disable-gpu",
"--disable-extension",
"eamodio.gitlens",
"--disable-extension",
"github.codespaces",
"--disable-extension",
"github.copilot",
"${workspaceRoot}/extensions/ql-vscode/src/vscode-tests/cli-integration/data",
// Uncomment the last line and modify the path to a checked out
// instance of the codeql repository so the libraries are
// available in the workspace for the tests.
// "${workspaceRoot}/../codeql"
"--projects",
"test/vscode-tests/cli-integration"
],
"env": {
// Optionally, set the version to use for the integration tests.
@@ -120,12 +141,24 @@
// If not specified, one will be downloaded automatically.
// This option overrides the CLI_VERSION option.
// "CLI_PATH": "${workspaceRoot}/../semmle-code/target/intree/codeql/codeql",
// Uncomment the last line and modify the path to a checked out
// instance of the codeql repository so the libraries are
// available in the workspace for the tests.
// "TEST_CODEQL_PATH": "${workspaceRoot}/../codeql",
},
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/extensions/ql-vscode/out/**/*.js",
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"attachSimplePort": 9223,
},
{
"name": "Launch Storybook",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}/extensions/ql-vscode",
"runtimeExecutable": "npm",
"runtimeArgs": ["run-script", "storybook"]
}
]
}

83
.vscode/settings.json vendored
View File

@@ -30,12 +30,85 @@
"typescript",
"typescriptreact"
],
"eslint.options": {
// This is necessary so that eslint can properly resolve its plugins
"resolvePluginsRelativeTo": "./extensions/ql-vscode"
},
// This is necessary to ensure that ESLint can find the correct configuration files and plugins.
"eslint.workingDirectories": ["./extensions/ql-vscode"],
"editor.formatOnSave": false,
"typescript.preferences.quoteStyle": "single",
"javascript.preferences.quoteStyle": "single",
"editor.wordWrapColumn": 100
"editor.wordWrapColumn": 100,
"jest.rootPath": "./extensions/ql-vscode",
"jest.autoRun": "off",
"jest.nodeEnv": {
"LANG": "en-US",
"TZ": "UTC"
},
// These custom rules are read in extensions/ql-vscode/.markdownlint-cli2.cjs
// but markdownlint only considers that config when linting files in
// extensions/ql-vscode/ or its subfolders. Therefore, we have to explicitly
// load the custom rules here too.
"markdownlint.customRules": [
"./extensions/ql-vscode/node_modules/@github/markdownlint-github/src/rules/no-default-alt-text.js",
"./extensions/ql-vscode/node_modules/@github/markdownlint-github/src/rules/no-generic-link-text.js"
],
// This ensures that the accessibility rule enablement done by github-markdownlint is
// considered by the extension too.
//
// Unfortunately, we can only specify a single extends, so the config here isn't
// identical since it can't also consider @github/markdownlint-github/style/base.json
// That's not as bad as it could be since the full config is considered for anything
// in extensions/ql-vscode/ or its subfolders anyway.
//
// Additional nonfiguration of the default rules is done in .markdownlint.json,
// which is picked up by the extension automatically, and read explicitly in
// .markdownlint-cli2.cjs
"markdownlint.config": {
"extends": "./extensions/ql-vscode/node_modules/@github/markdownlint-github/style/accessibility.json"
},
// These options are used by the `jestrunner.debug` command.
// They are not used by the `jestrunner.run` command.
// After clicking "debug" over a test, continually invoke the
// "Debug: Attach to Node Process" command until you see a
// process named "Code Helper (Plugin)". Then click "attach".
// This will attach the debugger to the test process.
"jestrunner.debugOptions": {
// Uncomment to debug integration tests
"attachSimplePort": 9223,
"env": {
"LANG": "en-US",
"TZ": "UTC",
// Uncomment to set a custom path to a CodeQL checkout.
// "TEST_CODEQL_PATH": "/absolute/path/to/checkout/of/codeql",
// Uncomment to set a custom path to a CodeQL CLI executable.
// This is the CodeQL version that will be used in the tests.
// "CLI_PATH": "/absolute/path/to/custom/codeql",
// Uncomment to debug integration tests
"VSCODE_WAIT_FOR_DEBUGGER": "true",
}
},
"terminal.integrated.env.linux": {
"LANG": "en-US",
"TZ": "UTC"
},
"terminal.integrated.env.osx": {
"LANG": "en-US",
"TZ": "UTC"
},
"terminal.integrated.env.windows": {
"LANG": "en-US",
"TZ": "UTC"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
},
}

View File

@@ -1,2 +1,4 @@
**/* @github/codeql-vscode-reviewers
/extensions/ql-vscode/src/remote-queries/ @github/code-scanning-secexp-reviewers
**/variant-analysis/ @github/code-scanning-secexp-reviewers
**/databases/ @github/code-scanning-secexp-reviewers
**/data-extensions-editor/ @github/code-scanning-secexp-reviewers

View File

@@ -67,10 +67,7 @@ members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
This Code of Conduct is adapted from the [Contributor Covenant, version 1.4](https://www.contributor-covenant.org/version/1/4/code-of-conduct.html).
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
[the Contributor Covenant FAQ](https://www.contributor-covenant.org/faq). For more about Contributor Covenant, see [the Contributor Covenant website](https://www.contributor-covenant.org).

View File

@@ -2,7 +2,7 @@
[fork]: https://github.com/github/vscode-codeql/fork
[pr]: https://github.com/github/vscode-codeql/compare
[style]: https://primer.style
[style]: https://github.com/microsoft/vscode-webview-ui-toolkit
[code-of-conduct]: CODE_OF_CONDUCT.md
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.
@@ -23,13 +23,17 @@ Please note that this project is released with a [Contributor Code of Conduct][c
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
* Follow the [style guide][style].
* Write tests. Tests that don't require the VS Code API are located [here](extensions/ql-vscode/test). Integration tests that do require the VS Code API are located [here](extensions/ql-vscode/src/vscode-tests).
* Write tests:
* [Tests that don't require the VS Code API are located here](extensions/ql-vscode/test).
* [Integration tests that do require the VS Code API are located here](extensions/ql-vscode/src/vscode-tests).
* Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests.
* Write a [good commit message](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
## Setting up a local build
Make sure you have installed recent versions of vscode (>= v1.52), node (>=12.16), and npm (>= 7.5.2). Earlier versions will probably work, but we no longer test against them.
Make sure you have installed recent versions of vscode, node, and npm. Check the `engines` block in [`package.json`](https://github.com/github/vscode-codeql/blob/main/extensions/ql-vscode/package.json) file for compatible versions. Earlier versions may work, but we no longer test against them.
To automatically switch to the correct version of node, we recommend using [nvm](https://github.com/nvm-sh/nvm), which will pick-up the node version from `.nvmrc`.
### Installing all packages
@@ -52,12 +56,10 @@ Alternatively, you can build the extension within VS Code via `Terminal > Run Bu
Before running any of the launch commands, be sure to have run the `build` command to ensure that the JavaScript is compiled and the resources are copied to the proper location.
We recommend that you keep `npm run watch` running in the backgound and you only need to re-run `npm run build` in the following situations:
We recommend that you keep `npm run watch` running in the background and you only need to re-run `npm run build` in the following situations:
1. on first checkout
2. whenever any of the non-TypeScript resources have changed
3. on any change to files included in one of the webviews
- **Important**: This is easy to forget. You must explicitly run `npm run build` whenever one of the files in the webview is changed. These are the files in the `src/view` and `src/compare/view` folders.
### Installing the extension
@@ -77,74 +79,23 @@ $ vscode/scripts/code-cli.sh --install-extension dist/vscode-codeql-*.vsix # if
You can use VS Code to debug the extension without explicitly installing it. Just open this directory as a workspace in VS Code, and hit `F5` to start a debugging session.
### Running the unit tests and integration tests that do not require a CLI instance
### Storybook
Unit tests and many integration tests do not require a copy of the CodeQL CLI.
Outside of vscode, in the `extensions/ql-vscode` directory, run:
You can use [Storybook](https://storybook.js.org/) to preview React components outside VSCode. Inside the `extensions/ql-vscode` directory, run:
```shell
npm run test && npm run integration
npm run storybook
```
Alternatively, you can run the tests inside of vscode. There are several vscode launch configurations defined that run the unit and integration tests. They can all be found in the debug view.
Your browser should automatically open to the Storybook UI. Stories live in the `src/stories` directory.
Only the _With CLI_ tests require a CLI instance to run. See below on how to do that.
Alternatively, you can start Storybook inside of VSCode. There is a VSCode launch configuration for starting Storybook. It can be found in the debug view.
Running from a terminal, you _must_ set the `TEST_CODEQL_PATH` variable to point to a checkout of the `github/codeql` repository. The appropriate CLI version will be downloaded as part of the test.
More information about Storybook can be found inside the **Overview** page once you have launched Storybook.
### Running the integration tests
### Testing
The _Launch Integration Tests - With CLI_ tests require a CLI instance in order to run. There are several environment variables you can use to configure this.
From inside of VSCode, open the `launch.json` file and in the _Launch Integration Tests - With CLI_ uncomment and change the environment variables appropriate for your purpose.
## Releasing (write access required)
1. Double-check the `CHANGELOG.md` contains all desired change comments and has the version to be released with date at the top.
* Go through all recent PRs and make sure they are properly accounted for.
* Make sure all changelog entries have links back to their PR(s) if appropriate.
1. Double-check that the extension `package.json` and `package-lock.json` have the version you intend to release. If you are doing a patch release (as opposed to minor or major version) this should already be correct.
1. Create a PR for this release:
* This PR will contain any missing bits from steps 1 and 2. Most of the time, this will just be updating `CHANGELOG.md` with today's date.
* Create a new branch for the release named after the new version. For example: `v1.3.6`
* Create a new commit with a message the same as the branch name.
* Create a PR for this branch.
* Wait for the PR to be merged into `main`
1. Trigger a release build on Actions by adding a new tag on branch `main` named after the release, as above. Note that when you push to upstream, you will need to fully qualify the ref. A command like this will work:
```bash
git push upstream refs/tags/v1.3.6
```
* **IMPORTANT** Make sure you are on the `main` branch and your local checkout is fully updated when you add the tag.
* If you accidentally add the tag to the wrong ref, you can just force push it to the right one later.
1. Monitor the status of the release build in the `Release` workflow in the Actions tab.
1. Download the VSIX from the draft GitHub release at the top of [the releases page](https://github.com/github/vscode-codeql/releases) that is created when the release build finishes.
1. Unzip the `.vsix` and inspect its `package.json` to make sure the version is what you expect,
or look at the source if there's any doubt the right code is being shipped.
1. Install the `.vsix` file into your vscode IDE and ensure the extension can load properly. Run a single command (like run query, or add database).
1. Go to the actions tab of the vscode-codeql repository and select the [Release workflow](https://github.com/github/vscode-codeql/actions?query=workflow%3ARelease).
- If there is an authentication failure when publishing, be sure to check that the authentication keys haven't expired. See below.
1. Approve the deployments of the correct Release workflow. This will automatically publish to Open VSX and VS Code Marketplace.
1. Go to the draft GitHub release in [the releases tab of the repository](https://github.com/github/vscode-codeql/releases), click 'Edit', add some summary description, and publish it.
1. Confirm the new release is marked as the latest release at <https://github.com/github/vscode-codeql/releases>.
1. If documentation changes need to be published, notify documentation team that release has been made.
1. Review and merge the version bump PR that is automatically created by Actions.
## Secrets and authentication for publishing
Repository administrators, will need to manage the authentication keys for publishing to the VS Code marketplace and Open VSX. Each requires an authentication token. The VS Code marketplace token expires yearly.
To regenerate the Open VSX token:
1. Log in to the [user settings page on Open VSX](https://open-vsx.org/user-settings/namespaces).
1. Make sure you are a member of the GitHub namespace.
1. Go to the [Access Tokens](https://open-vsx.org/user-settings/tokens) page and generate a new token.
1. Update the secret in the `publish-open-vsx` environment in the project settings.
To regenerate the VSCode Marketplace token, please see our internal documentation. Note that Azure DevOps PATs expire every 90 days and must be regenerated.
[Information about testing can be found here](./docs/testing.md).
## Resources

View File

@@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -7,7 +7,7 @@ The extension is released. You can download it from the [Visual Studio Marketpla
To see what has changed in the last few versions of the extension, see the [Changelog](https://github.com/github/vscode-codeql/blob/main/extensions/ql-vscode/CHANGELOG.md).
[![CI status badge](https://github.com/github/vscode-codeql/workflows/Build%20Extension/badge.svg)](https://github.com/github/vscode-codeql/actions?query=workflow%3A%22Build+Extension%22+branch%3Amaster)
[![VS Marketplace badge](https://vsmarketplacebadge.apphb.com/version/github.vscode-codeql.svg)](https://marketplace.visualstudio.com/items?itemName=github.vscode-codeql)
[![VS Marketplace badge](https://vsmarketplacebadges.dev/version/github.vscode-codeql.svg)](https://marketplace.visualstudio.com/items?itemName=github.vscode-codeql)
## Features
@@ -15,11 +15,19 @@ To see what has changed in the last few versions of the extension, see the [Chan
* Shows the flow of data through the results of path queries, which is essential for triaging security results.
* Provides an easy way to run queries from the large, open source repository of [CodeQL security queries](https://github.com/github/codeql).
* Adds IntelliSense to support you writing and editing your own CodeQL query and library files.
* Supports you running CodeQL queries against thousands of repositories on GitHub using multi-repository variant analysis.
## Project goals and scope
This project will track new feature development in CodeQL and, whenever appropriate, bring that functionality to the Visual Studio Code experience.
## Dependencies
This extension depends on the following two extensions for required functionality. They will be installed automatically when you install VS Code CodeQL.
* [Test Adapter Converter](https://marketplace.visualstudio.com/items?itemName=ms-vscode.test-adapter-converter)
* [Test Explorer UI](https://marketplace.visualstudio.com/items?itemName=hbenl.vscode-test-explorer)
## Contributing
This project welcomes contributions. See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to build, install, and contribute.

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

92
docs/releasing.md Normal file
View File

@@ -0,0 +1,92 @@
# Releasing (write access required)
1. Double-check the `CHANGELOG.md` contains all desired change comments and has the version to be released with date at the top.
* Go through all recent PRs and make sure they are properly accounted for.
* Make sure all changelog entries have links back to their PR(s) if appropriate.
* For picking the new version number, we default to increasing the patch version number, but make our own judgement about whether a change is big enough to warrant a minor version bump. Common reasons for a minor bump could include:
* Making substantial new features available to all users. This can include lifting a feature flag.
* Breakage in compatibility with recent versions of the CLI.
* Minimum required version of VS Code is increased.
* New telemetry events are added.
* Deprecation or removal of commands.
* Accumulation of many changes, none of which are individually big enough to warrant a minor bump, but which together are. This does not include changes which are purely internal to the extension, such as refactoring, or which are only available behind a feature flag.
1. Double-check that the node version we're using matches the one used for VS Code. If it doesn't, you will then need to update the node version in the following files:
* `.nvmrc` - this will enable `nvm` to automatically switch to the correct node version when you're in the project folder
* `.github/workflows/main.yml` - all the "node-version: '[VERSION]'" settings
* `.github/workflows/release.yml` - the "node-version: '[VERSION]'" setting
1. Double-check that the extension `package.json` and `package-lock.json` have the version you intend to release. If you are doing a patch release (as opposed to minor or major version) this should already be correct.
1. Create a PR for this release:
* This PR will contain any missing bits from steps 1, 2 and 3. Most of the time, this will just be updating `CHANGELOG.md` with today's date.
* Create a new branch for the release named after the new version. For example: `v1.3.6`
* Create a new commit with a message the same as the branch name.
* Create a PR for this branch.
* Wait for the PR to be merged into `main`
1. Switch to `main` branch and pull latest changes
1. Lock the `main` branch.
* Go to the [branch protection rules for the `main` branch](https://github.com/github/vscode-codeql/settings/branch_protection_rules/16447115)
* Select "Lock branch"
* Click "Save changes"
1. Ensure that no PRs have been merged since the release PR that you merged. If there were, you might need to unlock `main` temporarily and update the CHANGELOG again.
1. Build the extension `npm run build` and install it on your VS Code using "Install from VSIX".
1. Go through [our test plan](./test-plan.md) to ensure that the extension is working as expected.
1. Switch to `main` and add a new tag on the `main` branch with your new version (named after the release), e.g.
```bash
git checkout main
git tag v1.3.6
```
If you've accidentally created a badly named tag, you can delete it via
```bash
git tag -d badly-named-tag
```
1. Unlock the main branch
* Go to the [branch protection rules for the `main` branch](https://github.com/github/vscode-codeql/settings/branch_protection_rules/16447115)
* Deselect "Lock branch"
* Click "Save changes"
1. Push the new tag up:
a. If you're using a fork of the repo:
```bash
git push upstream refs/tags/v1.3.6
```
b. If you're working straight in this repo:
```bash
git push origin refs/tags/v1.3.6
```
This will trigger [a release build](https://github.com/github/vscode-codeql/releases) on Actions.
* **IMPORTANT** Make sure you are on the `main` branch and your local checkout is fully updated when you add the tag.
* If you accidentally add the tag to the wrong ref, you can just force push it to the right one later.
1. Monitor the status of the release build in the `Release` workflow in the Actions tab.
* DO NOT approve the "publish" stages of the workflow yet.
1. Download the VSIX from the draft GitHub release at the top of [the releases page](https://github.com/github/vscode-codeql/releases) that is created when the release build finishes.
1. Unzip the `.vsix` and inspect its `package.json` to make sure the version is what you expect,
or look at the source if there's any doubt the right code is being shipped.
1. Install the `.vsix` file into your vscode IDE and ensure the extension can load properly. Run a single command (like run query, or add database).
1. Go to the actions tab of the vscode-codeql repository and select the [Release workflow](https://github.com/github/vscode-codeql/actions?query=workflow%3ARelease).
* If there is an authentication failure when publishing, be sure to check that the authentication keys haven't expired. See below.
1. Approve the deployments of the correct Release workflow. This will automatically publish to Open VSX and VS Code Marketplace.
1. Go to the draft GitHub release in [the releases tab of the repository](https://github.com/github/vscode-codeql/releases), click 'Edit', add some summary description, and publish it.
1. Confirm the new release is marked as the latest release at <https://github.com/github/vscode-codeql/releases>.
1. If documentation changes need to be published, notify documentation team that release has been made.
1. Review and merge the version bump PR that is automatically created by Actions.
## Secrets and authentication for publishing
Repository administrators, will need to manage the authentication keys for publishing to the VS Code marketplace and Open VSX. Each requires an authentication token. The VS Code marketplace token expires yearly.
To regenerate the Open VSX token:
1. Log in to the [user settings page on Open VSX](https://open-vsx.org/user-settings/namespaces).
1. Make sure you are a member of the GitHub namespace.
1. Go to the [Access Tokens](https://open-vsx.org/user-settings/tokens) page and generate a new token.
1. Update the secret in the `publish-open-vsx` environment in the project settings.
To regenerate the VSCode Marketplace token, please see our internal documentation. Note that Azure DevOps PATs expire every 90 days and must be regenerated.

339
docs/test-plan.md Normal file
View File

@@ -0,0 +1,339 @@
# Test Plan
This document describes the manual test plan for the QL extension for Visual Studio Code.
The plan will be executed manually to start with but the goal is to eventually automate parts of the process (based on
effort vs value basis).
## What this doesn't cover
We don't need to test features (and permutations of features) that are covered by automated tests.
## Before releasing the VS Code extension
- Go through the required test cases listed below
- Check major PRs since the previous release for specific one-off things to test. Based on that, you might want to
choose to go through some of the Optional Test Cases.
- Run a query using the existing version of the extension (to generate an "old" query history item)
## Required Test Cases
### Test Case 1: MRVA - Running a problem path query and viewing results
1. Open the [UnsafeJQueryPlugin query](https://github.com/github/codeql/blob/main/javascript/ql/src/Security/CWE-079/UnsafeJQueryPlugin.ql).
2. Run a MRVA against the following repo list:
```json
{
"name": "test-repo-list",
"repositories": [
"angular-cn/ng-nice",
"apache/hadoop",
"apache/hive"
]
}
```
3. Check that a notification message pops up and the results view is opened.
4. Check the query history. It should:
- Show that an item has been added to the query history
- The item should be marked as "in progress".
5. Once the query starts:
- Check the results view
- Check the code paths view, including the code paths drop down menu.
- Check that the repository filter box works
- Click links to files/locations on GitHub
- Check that the query history item is updated to show the number of results
6. Once the query completes:
- Check that the query history item is updated to show the query status as "complete"
### Test Case 2: MRVA - Running a problem query and viewing results
1. Open the [ReDoS query](https://github.com/github/codeql/blob/main/javascript/ql/src/Performance/ReDoS.ql).
2. Run a MRVA against the "Top 10" repositories.
3. Check that there is a notification message.
4. Check the query history. It should:
- Show that an item has been added to the query history
- The item should be marked as "in progress".
5. Once the query starts:
- Check that a notification is shown with a link to the results view
- Check that the results are rendered with an alert message and a highlighted code snippet:
![highlighted-code-snippet](images/highlighted-code-snippet.png)
### Test Case 3: MRVA - Running a non-problem query and viewing results
1. Open the [FunLinesOfCode query](https://github.com/github/codeql/blob/main/cpp/ql/src/Metrics/Functions/FunLinesOfCode.ql).
2. Run a MRVA against a single repository (e.g. `google/brotli`).
3. Once the query starts:
- Open the query results
- Check that the results show up in a table:
![results-table](images/results-table.png)
### Test Case 4: MRVA - Interacting with query history
1. Click a history item (for MRVA):
- Check that exporting results works
- Check that sorting results works
- Check that copying repo lists works
2. Open the query results directory:
- Check that the correct directory is opened and there are results in it
3. View logs
- Check that the correct workflow is opened
### Test Case 5: MRVA - Canceling a variant analysis run
Run one of the above MRVAs, but cancel it from within VS Code:
- Check that the query is canceled and the query history item is updated.
- Check that the workflow run is also canceled.
- Check that any available results are visible in VS Code.
### Test Case 6: MRVA - Change to a different colour theme
Open one of the above MRVAs, try changing to a different colour theme and check that everything looks sensible.
Are there any components that are not showing up?
## Optional Test Cases
These are mostly aimed at MRVA, but some of them are also applicable to non-MRVA queries.
### Selecting repositories to run on
#### Test case 1: Running a query on a single repository
1. When the repository exists and is public
1. Has a CodeQL database for the correct language
2. Has a CodeQL database for another language
3. Does not have any CodeQL databases
2. When the repository exists and is private
1. Is accessible and has a CodeQL database
2. Is not accessible
3. When the repository does not exist
#### Test case 2: Running a query on a custom repository list
1. The repository list is non-empty
1. All repositories in the list have a CodeQL database
2. Some but not all repositories in the list have a CodeQL database
3. No repositories in the list have a CodeQL database
2. The repository list is empty
#### Test case 3: Running a query on all repositories in an organization
1. The org exists
1. The org contains repositories that have CodeQL databases
2. The org contains repositories of the right language but without CodeQL databases
3. The org contains repositories not of the right language
4. The org contains private repositories that are inaccessible
2. The org does not exist
### Using different types of controller repos
#### Test case 1: Running a query when the controller repository is public
1. Can run queries on public repositories
2. Can not run queries on private repositories
#### Test case 2: Running a query when the controller repository is private
1. Can run queries on public repositories
2. Can run queries on private repositories
#### Test case 3: Running a query when the controller repo exists but you do not have write access
1. Cannot run queries
#### Test case 4: Running a query when the controller repo doesnt exist
1. Cannot run queries
#### Test case 5: Running a query when the "config field" for the controller repo is not set
1. Cannot run queries
### Query History
This requires running a MRVA query and viewing the query history.
The first test case specifies actions that you can do when the query is first run and is in "pending" state. We start
with this since it has quite a limited number of actions you can do.
#### Test case 1: When variant analysis state is "pending"
1. Starts monitoring variant analysis
2. Cannot open query history item
3. Can delete a query history item
1. Item is removed from list in UI
2. Files on dist are deleted (can get to files using "open query directory")
4. Can sort query history items
1. By name
2. By query date
3. By result count
5. Cannot open query directory
6. Can open query that produced these results
1. When the file still exists and has not moved
2. When the file does not exist
7. Cannot view logs
8. Cannot copy repository list
9. Cannot export results
10. Cannot select to create a gist
11. Cannot select to save as markdown
12. Cannot cancel analysis
#### Test case 2: When the variant analysis state is not "pending"
1. Query history is loaded when VSCode starts
2. Handles when action workflow was canceled while VSCode was closed
3. Can open query history item
1. Manually by clicking on them
2. Automatically when VSCode starts (if they were open when VSCode was last used)
4. Can delete a query history item
1. Item is removed from list in UI
2. Files on dist are deleted (can get to files using "open query directory")
5. Can sort query history items
1. By name
2. By query date
3. By result count
6. Can open query directory
7. Can open query that produced these results
1. When the file still exists and has not moved
2. When the file does not exist
8. Can view logs
9. Can copy repository list
1. Text is copied to clipboard
2. Text is a valid repository list
10. Can export results
11. Can select to create gist
1. A gist is created
2. The first thing in the gist is a summary
3. Contains a file for each repository with results
4. A popup links you to the gist
12. Can select to save as markdown
1. A directory is created on disk
2. Contains a summary file
3. Contains a file for each repository with results
4. A popup allows you to open the directory
#### Test case 3: When variant analysis state is "in_progress"
1. Starts monitoring variant analysis
1. Ready results are downloaded
2. Can cancel analysis
1. Causes the actions run to be canceled
#### Test case 4: When variant analysis state is in final state ("succeeded"/"failed"/"canceled")
1. Stops monitoring variant analysis
1. All results are downloaded if state is succeeded
2. Otherwise, ready results are downloaded, if any are available
2. Cannot cancel analysis
### MRVA results view
This requires running a MRVA query and seeing the results view.
<!-- markdownlint-disable-next-line MD024 -->
#### Test case 1: When variant analysis state is "pending"
1. Can open a results view
2. Results view opens automatically
- When starting variant analysis run
- When VSCode opens (if view was open when VSCode was closed)
3. Results view is empty
#### Test case 2: When variant analysis state is not "pending"
1. Can open a results view
2. Results view opens automatically
1. When starting variant analysis run
2. When VSCode opens (if view was open when VSCode was closed)
3. Can copy repository list
1. Text is copied to clipboard
2. Text is a valid repository list
4. Can export results
1. Only includes repos that you have selected (also see section from query history)
5. Can cancel analysis
6. Can open query file
1. When the file still exists and has not moved
2. When the file does not exist
7. Can open query text
8. Can sort repos
1. By name
2. By results
3. By stars
4. By last updated
9. Can filter repos
10. Shows correct statistics
1. Total number of results
2. Total number of repositories
3. Duration
11. Can see live results
1. Results appear in extension as soon as each query is completed
12. Can view interpreted results (i.e. for a "problem" query)
1. Can view non-path results
2. Can view code paths for "path-problem" queries
13. Can view raw results (i.e. for a non "problem" query)
1. Renders a table
14. Can see skipped repositories
1. Can see repos with no db in a tab
1. Shown warning that explains the tab
2. Can see repos with no access in a tab
1. Shown warning that explains the tab
3. Only shows tab when there are skipped repos
15. Result downloads
1. All results are downloaded automatically
2. Download status is indicated by a spinner (Not currently any indication of progress beyond "downloading" and "not downloading")
3. Only 3 items are downloaded at a time
4. Results for completed queries are still downloaded when
1. Some but not all queries failed
2. The variant analysis was canceled after some queries completed
#### Test case 3: When variant analysis state is in "succeeded" state
1. Can view logs
2. All results are downloaded
#### Test case 4: When variant analysis is in "failed" or "canceled" state
1. Can view logs
1. Results for finished queries are still downloaded.
### MRVA repositories panel
1. Add a list
1. Add a database at the top level
1. Add a database to a list
1. Add a the same database at a top-level and in a list
1. Delete a list
1. Delete a database from the top level
1. Delete a database from a list
1. Add an owner
1. Remove an owner
1. Rename a list
1. Open on GitHub
1. Select a list (via "Select" button and via context menu action)
1. Run MRVA against a user-defined list
1. Run MRVA against a top-N list
1. Run MRVA against an owner
1. Run MRVA against a database
1. Copy repo list
1. Open config file
1. Make changes via config file (ensure JSON schema is helping out)
1. Close and re-open VS Code (ensure lists are there)
1. Collapse/expand tree nodes
Error cases that trigger an error notification:
1. Try to add a list with a name that already exists
1. Try to add a top-level database that already exists
1. Try to add a database in a list that already exists in the list
Error cases that show an error in the panel (and only the edit button should be visible):
1. Edit the db config file directly and save invalid JSON
1. Edit the db config file directly and save valid JSON but invalid config (e.g. add an unknown property)
1. Edit the db config file directly and save two lists with the same name
Cases where there the welcome view is shown:
1. No controller repo is set in the user's settings JSON.

136
docs/testing.md Normal file
View File

@@ -0,0 +1,136 @@
# Testing
We have several types of tests:
* Unit tests: these live in the `tests/unit-tests/` directory
* View tests: these live in `src/view/variant-analysis/__tests__/`
* VSCode integration tests:
* `test/vscode-tests/activated-extension` tests: These are intended to cover functionality that require the full extension to be activated but don't require the CLI. This suite is not run against multiple versions of the CLI in CI.
* `test/vscode-tests/no-workspace` tests: These are intended to cover functionality around not having a workspace. The extension is not activated in these tests.
* `test/vscode-tests/minimal-workspace` tests: These are intended to cover functionality that need a workspace but don't require the full extension to be activated.
* CLI integration tests: these live in `test/vscode-tests/cli-integration`
* These tests are intended to cover functionality that is related to the integration between the CodeQL CLI and the extension. These tests are run against each supported versions of the CLI in CI.
The CLI integration tests require an instance of the CodeQL CLI to run so they will require some extra setup steps. When adding new tests to our test suite, please be mindful of whether they need to be in the cli-integration folder. If the tests don't depend on the CLI, they are better suited to being a VSCode integration test.
Any test data you're using (sample projects, config files, etc.) must go in a `test/vscode-tests/*/data` directory. When you run the tests, the test runner will copy the data directory to `out/vscode-tests/*/data`.
## Running the tests
Pre-requisites:
1. Run `npm run build`.
2. You will need to have `npm run watch` running in the background.
### 1. From the terminal
Then, from the `extensions/ql-vscode` directory, use the appropriate command to run the tests:
* Unit tests: `npm run test:unit`
* View Tests: `npm test:view`
* VSCode integration tests: `npm run test:vscode-integration`
#### Running CLI integration tests from the terminal
The CLI integration tests require the CodeQL standard libraries in order to run so you will need to clone a local copy of the `github/codeql` repository.
1. Set the `TEST_CODEQL_PATH` environment variable: running from a terminal, you _must_ set the `TEST_CODEQL_PATH` variable to point to a checkout of the `github/codeql` repository. The appropriate CLI version will be downloaded as part of the test.
2. Run your test command:
```shell
cd extensions/ql-vscode && npm run test:cli-integration
```
### 2. From VSCode
Alternatively, you can run the tests inside of VSCode. There are several VSCode launch configurations defined that run the unit and integration tests.
You will need to run tests using a task from inside of VS Code, under the "Run and Debug" view:
* Unit tests: run the _Launch Unit Tests - React_ task
* View Tests: run the _Launch Unit Tests_ task
* VSCode integration tests: run the _Launch Unit Tests - No Workspace_ and _Launch Unit Tests - Minimal Workspace_ tasks
#### Running CLI integration tests from VSCode
The CLI integration tests require the CodeQL standard libraries in order to run so you will need to clone a local copy of the `github/codeql` repository.
1. Set the `TEST_CODEQL_PATH` environment variable: running from a terminal, you _must_ set the `TEST_CODEQL_PATH` variable to point to a checkout of the `github/codeql` repository. The appropriate CLI version will be downloaded as part of the test.
2. Set the codeql path in VSCode's launch configuration: open `launch.json` and under the _Launch Integration Tests - With CLI_ section, uncomment the `"${workspaceRoot}/../codeql"` line. If you've cloned the `github/codeql` repo to a different path, replace the value with the correct path.
3. Run the VSCode task from the "Run and Debug" view called _Launch Integration Tests - With CLI_.
## Running a single test
### 1. Running a single test from the terminal
The easiest way to run a single test is to change the `it` of the test to `it.only` and then run the test command with some additional options
to only run tests for this specific file. For example, to run the test `test/vscode-tests/cli-integration/run-queries.test.ts`:
```shell
npm run test:cli-integration -- --runTestsByPath test/vscode-tests/cli-integration/run-queries.test.ts
```
You can also use the `--testNamePattern` option to run a specific test within a file. For example, to run the test `test/vscode-tests/cli-integration/run-queries.test.ts`:
```shell
npm run test:cli-integration -- --runTestsByPath test/vscode-tests/cli-integration/run-queries.test.ts --testNamePattern "should create a QueryEvaluationInfo"
```
### 2. Running a single test from VSCode
Alternatively, you can run a single test inside VSCode. To do so, install the [Jest Runner](https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner) extension. Then,
you will have quicklinks to run a single test from within test files. To run a single unit or integration test, click the "Run" button. Debugging a single test is currently only supported
for unit tests by default. To debug integration tests, open the `.vscode/settings.json` file and uncomment the `jestrunner.debugOptions` lines. This will allow you to debug integration tests.
Please make sure to revert this change before committing; with this setting enabled, it is not possible to debug unit tests.
Without the Jest Runner extension, you can also use the "Launch Selected Unit Test (vscode-codeql)" launch configuration to run a single unit test.
## Using a mock GitHub API server
Multi-Repo Variant Analyses (MRVA) rely on the GitHub API. In order to make development and testing easy, we have functionality that allows us to intercept requests to the GitHub API and provide mock responses.
### Using a pre-recorded test scenario
To run a mock MRVA scenario, follow these steps:
1. Enable the mock GitHub API server by adding the following in your VS Code user settings (which can be found by running the `Preferences: Open User Settings (JSON)` VS Code command):
```json
"codeQL.mockGitHubApiServer": {
"enabled": true
}
```
1. Run the `CodeQL: Mock GitHub API Server: Load Scenario` command from the command pallet, and choose one of the scenarios to load.
1. Execute a normal MRVA. At this point you should see the scenario being played out, rather than an actual MRVA running.
1. Once you're done, you can stop using the mock scenario with `CodeQL: Mock GitHub API Server: Unload Scenario`
If you want to replay the same scenario you should unload and reload it so requests are replayed from the start.
### Recording a new test scenario
To record a new mock MRVA scenario, follow these steps:
1. Enable the mock GitHub API server by adding the following in your VS Code user settings (which can be found by running the `Preferences: Open User Settings (JSON)` VS Code command):
```json
"codeQL.mockGitHubApiServer": {
"enabled": true
}
```
1. Run the `CodeQL: Mock GitHub API Server: Start Scenario Recording` VS Code command from the command pallet.
1. Execute a normal MRVA.
1. Once what you wanted to record is done (e.g. the MRVA has finished), then run the `CodeQL: Mock GitHub API Server: Save Scenario` command from the command pallet.
1. The scenario should then be available for replaying.
If you want to cancel recording, run the `CodeQL: Mock GitHub API Server: Cancel Scenario Recording` command.
Once the scenario has been recorded, it's often useful to remove some of the requests to speed up the replay, particularly ones that fetch the variant analysis status. Once some of the request files have manually been removed, the [fix-scenario-file-numbering script](../extensions/ql-vscode/scripts/fix-scenario-file-numbering.ts) can be used to update the number of the files. See the script file for details on how to use.
### Scenario data location
Pre-recorded scenarios are stored in `./src/mocks/scenarios`. However, it's possible to configure the location, by setting the `codeQL.mockGitHubApiServer.scenariosPath` configuration property in the VS Code user settings.

View File

@@ -0,0 +1,16 @@
{
"sourceType": "unambiguous",
"presets": [
[
"@babel/preset-env",
{
"targets": {
"chrome": 100
}
}
],
"@babel/preset-typescript",
"@babel/preset-react"
],
"plugins": []
}

View File

@@ -0,0 +1,7 @@
.vscode-test/
node_modules/
out/
build/
# Include the Storybook config
!.storybook

View File

@@ -1,17 +1,35 @@
module.exports = {
const { resolve } = require("path");
const baseConfig = {
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2018,
sourceType: "module",
project: ["tsconfig.json", "./src/**/tsconfig.json", "./gulpfile.ts/tsconfig.json"],
project: [
resolve(__dirname, "tsconfig.lint.json"),
resolve(__dirname, "src/**/tsconfig.json"),
resolve(__dirname, "test/**/tsconfig.json"),
resolve(__dirname, "gulpfile.ts/tsconfig.json"),
resolve(__dirname, "scripts/tsconfig.json"),
resolve(__dirname, ".storybook/tsconfig.json"),
],
},
plugins: ["@typescript-eslint"],
plugins: ["github", "@typescript-eslint", "etc"],
env: {
node: true,
es6: true,
},
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
extends: [
"eslint:recommended",
"plugin:github/react",
"plugin:github/recommended",
"plugin:github/typescript",
"plugin:jest-dom/recommended",
"plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended",
],
rules: {
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/no-use-before-define": 0,
"@typescript-eslint/no-unused-vars": [
"warn",
@@ -25,13 +43,136 @@ module.exports = {
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-floating-promises": [ "error", { ignoreVoid: true } ],
"@typescript-eslint/no-floating-promises": ["error", { ignoreVoid: true }],
"@typescript-eslint/no-invalid-this": "off",
"@typescript-eslint/no-shadow": "off",
"prefer-const": ["warn", { destructuring: "all" }],
indent: "off",
"@typescript-eslint/indent": "off",
"@typescript-eslint/no-throw-literal": "error",
"no-useless-escape": 0,
semi: 2,
quotes: ["warn", "single"]
camelcase: "off",
"escompat/no-regexp-lookbehind": "off",
"etc/no-implicit-any-catch": "error",
"filenames/match-regex": "off",
"filenames/match-regexp": "off",
"func-style": "off",
"i18n-text/no-en": "off",
"import/named": "off",
"import/no-dynamic-require": "off",
"import/no-dynamic-required": "off",
"import/no-anonymous-default-export": "off",
"import/no-commonjs": "off",
"import/no-mutable-exports": "off",
"import/no-namespace": "off",
"import/no-unresolved": "off",
"import/no-webpack-loader-syntax": "off",
"jsx-a11y/anchor-is-valid": "off",
"jsx-a11y/no-noninteractive-element-interactions": "off",
"jsx-a11y/no-static-element-interactions": "off",
"jsx-a11y/click-events-have-key-events": "off",
"no-invalid-this": "off",
"no-fallthrough": "off",
"no-console": "off",
"no-shadow": "off",
"github/array-foreach": "off",
"github/no-then": "off",
},
};
module.exports = {
root: true,
...baseConfig,
overrides: [
{
files: ["src/stories/**/*"],
parserOptions: {
project: resolve(__dirname, "src/stories/tsconfig.json"),
},
extends: [
...baseConfig.extends,
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:storybook/recommended",
],
rules: {
...baseConfig.rules,
},
settings: {
react: {
version: "detect",
},
},
},
{
files: ["src/view/**/*"],
parserOptions: {
project: resolve(__dirname, "src/view/tsconfig.json"),
},
extends: [
...baseConfig.extends,
"plugin:react/recommended",
"plugin:react-hooks/recommended",
],
rules: {
...baseConfig.rules,
},
settings: {
react: {
version: "detect",
},
},
},
{
files: ["test/**/*"],
parserOptions: {
project: resolve(__dirname, "test/tsconfig.json"),
},
env: {
jest: true,
},
},
{
files: ["test/vscode-tests/**/*"],
parserOptions: {
project: resolve(__dirname, "test/tsconfig.json"),
},
env: {
jest: true,
},
rules: {
...baseConfig.rules,
"@typescript-eslint/ban-types": [
"error",
{
// For a full list of the default banned types, see:
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-types.md
extendDefaults: true,
types: {
// Don't complain about the `Function` type in test files. (Default is `true`.)
Function: false,
},
},
],
},
},
{
files: [
".eslintrc.js",
"test/**/jest-runner-vscode.config.js",
"test/**/jest-runner-vscode.config.base.js",
],
parser: undefined,
plugins: ["github"],
extends: [
"eslint:recommended",
"plugin:github/recommended",
"plugin:prettier/recommended",
],
rules: {
"import/no-commonjs": "off",
"prefer-template": "off",
"filenames/match-regex": "off",
"@typescript-eslint/no-var-requires": "off",
},
},
],
};

View File

@@ -0,0 +1,16 @@
// Having the base options in a top-level config file means
// that the VS Code markdownlint extension can pick them up
// too, since that only considers _this_ file when looking
// at files in this directory or below.
base_options = require('../../.markdownlint.json')
const options = require('@github/markdownlint-github').init(
base_options
)
module.exports = {
config: options,
customRules: ["@github/markdownlint-github"],
outputFormatters: [
[ "markdownlint-cli2-formatter-pretty", { "appendLink": true } ] // ensures the error message includes a link to the rule documentation
]
}

View File

@@ -0,0 +1,2 @@
# Storybook requires this option to be set. See https://github.com/storybookjs/storybook/issues/18298
legacy-peer-deps=true

View File

@@ -0,0 +1 @@
v16.14.2

View File

@@ -0,0 +1,10 @@
.vscode-test/
node_modules/
out/
# This file gets written by an actions workflow.
# Don't try to format it.
supported_cli_versions.json
# Include the Storybook config
!.storybook

View File

@@ -0,0 +1,3 @@
{
"trailingComma": "all"
}

View File

@@ -0,0 +1,20 @@
import type { StorybookConfig } from "@storybook/core-common";
const config: StorybookConfig = {
stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
"./vscode-theme-addon/preset.ts",
],
framework: "@storybook/react",
core: {
builder: "@storybook/builder-webpack5",
},
features: {
babelModeV7: true,
},
};
module.exports = config;

View File

@@ -0,0 +1,7 @@
import { addons } from "@storybook/addons";
import { themes } from "@storybook/theming";
addons.setConfig({
theme: themes.dark,
enableShortcuts: false,
});

View File

@@ -0,0 +1,31 @@
import { themes } from "@storybook/theming";
import { action } from "@storybook/addon-actions";
// Allow all stories/components to use Codicons
import "@vscode/codicons/dist/codicon.css";
// https://storybook.js.org/docs/react/configure/overview#configure-story-rendering
export const parameters = {
// All props starting with `on` will automatically receive an action as a prop
actions: { argTypesRegex: "^on[A-Z].*" },
// All props matching these names will automatically get the correct control
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
// Use a dark theme to be aligned with VSCode
docs: {
theme: themes.dark,
},
backgrounds: {
// The background is injected by our theme CSS files
disable: true,
},
};
(window as any).acquireVsCodeApi = () => ({
postMessage: action("post-vscode-message"),
setState: action("set-vscode-state"),
});

View File

@@ -12,7 +12,8 @@
"noUnusedLocals": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"experimentalDecorators": true
"experimentalDecorators": true,
"skipLibCheck": true
},
"exclude": ["node_modules"]
}

View File

@@ -0,0 +1,61 @@
import * as React from "react";
import { FunctionComponent, useCallback } from "react";
import { useGlobals } from "@storybook/api";
import {
IconButton,
Icons,
WithTooltip,
TooltipLinkList,
Link,
WithHideFn,
} from "@storybook/components";
import { themeNames, VSCodeTheme } from "./theme";
export const ThemeSelector: FunctionComponent = () => {
const [{ vscodeTheme }, updateGlobals] = useGlobals();
const changeTheme = useCallback(
(theme: VSCodeTheme) => {
updateGlobals({
vscodeTheme: theme,
});
},
[updateGlobals],
);
const createLinks = useCallback(
(onHide: () => void): Link[] =>
Object.values(VSCodeTheme).map((theme) => ({
id: theme,
onClick() {
changeTheme(theme);
onHide();
},
title: themeNames[theme],
value: theme,
active: vscodeTheme === theme,
})),
[vscodeTheme, changeTheme],
);
return (
<WithTooltip
placement="top"
trigger="click"
closeOnClick
tooltip={({ onHide }: WithHideFn) => (
<TooltipLinkList links={createLinks(onHide)} />
)}
>
<IconButton
key="theme"
title="Change the theme of the preview"
active={vscodeTheme !== VSCodeTheme.Dark}
>
<Icons icon="dashboard" />
</IconButton>
</WithTooltip>
);
};

View File

@@ -0,0 +1,14 @@
import * as React from "react";
import { addons, types } from "@storybook/addons";
import { ThemeSelector } from "./ThemeSelector";
const ADDON_ID = "vscode-theme-addon";
addons.register(ADDON_ID, () => {
addons.add(ADDON_ID, {
title: "VSCode Themes",
type: types.TOOL,
match: ({ viewMode }) => !!(viewMode && viewMode.match(/^(story|docs)$/)),
render: () => <ThemeSelector />,
});
});

View File

@@ -0,0 +1,7 @@
export function config(entry = []) {
return [...entry, require.resolve("./preview.ts")];
}
export function managerEntries(entry = []) {
return [...entry, require.resolve("./manager.tsx")];
}

View File

@@ -0,0 +1,8 @@
import { withTheme } from "./withTheme";
import { VSCodeTheme } from "./theme";
export const decorators = [withTheme];
export const globals = {
vscodeTheme: VSCodeTheme.Dark,
};

View File

@@ -0,0 +1,17 @@
export enum VSCodeTheme {
Dark = "dark",
Light = "light",
LightHighContrast = "light-high-contrast",
DarkHighContrast = "dark-high-contrast",
GitHubLightDefault = "github-light-default",
GitHubDarkDefault = "github-dark-default",
}
export const themeNames: { [key in VSCodeTheme]: string } = {
[VSCodeTheme.Dark]: "Dark+",
[VSCodeTheme.Light]: "Light+",
[VSCodeTheme.LightHighContrast]: "Light High Contrast",
[VSCodeTheme.DarkHighContrast]: "Dark High Contrast",
[VSCodeTheme.GitHubLightDefault]: "GitHub Light Default",
[VSCodeTheme.GitHubDarkDefault]: "GitHub Dark Default",
};

View File

@@ -0,0 +1,64 @@
import { useEffect, useGlobals } from "@storybook/addons";
import type {
AnyFramework,
PartialStoryFn as StoryFunction,
StoryContext,
} from "@storybook/csf";
import { VSCodeTheme } from "./theme";
const themeFiles: { [key in VSCodeTheme]: string } = {
[VSCodeTheme.Dark]:
// eslint-disable-next-line @typescript-eslint/no-var-requires
require("!file-loader?modules!../../src/stories/vscode-theme-dark.css")
.default,
[VSCodeTheme.Light]:
// eslint-disable-next-line @typescript-eslint/no-var-requires
require("!file-loader?modules!../../src/stories/vscode-theme-light.css")
.default,
[VSCodeTheme.LightHighContrast]:
// eslint-disable-next-line @typescript-eslint/no-var-requires
require("!file-loader?modules!../../src/stories/vscode-theme-light-high-contrast.css")
.default,
[VSCodeTheme.DarkHighContrast]:
// eslint-disable-next-line @typescript-eslint/no-var-requires
require("!file-loader?modules!../../src/stories/vscode-theme-dark-high-contrast.css")
.default,
[VSCodeTheme.GitHubLightDefault]:
// eslint-disable-next-line @typescript-eslint/no-var-requires
require("!file-loader?modules!../../src/stories/vscode-theme-github-light-default.css")
.default,
[VSCodeTheme.GitHubDarkDefault]:
// eslint-disable-next-line @typescript-eslint/no-var-requires
require("!file-loader?modules!../../src/stories/vscode-theme-github-dark-default.css")
.default,
};
export const withTheme = (
StoryFn: StoryFunction<AnyFramework>,
context: StoryContext<AnyFramework>,
) => {
const [{ vscodeTheme }] = useGlobals();
useEffect(() => {
const styleSelectorId =
context.viewMode === "docs"
? `addon-vscode-theme-docs-${context.id}`
: "addon-vscode-theme-theme";
const theme = Object.values(VSCodeTheme).includes(vscodeTheme)
? (vscodeTheme as VSCodeTheme)
: VSCodeTheme.Dark;
document.getElementById(styleSelectorId)?.remove();
const link = document.createElement("link");
link.id = styleSelectorId;
link.href = themeFiles[theme];
link.rel = "stylesheet";
document.head.appendChild(link);
}, [vscodeTheme]);
return StoryFn();
};

View File

@@ -12,5 +12,6 @@ src/**
.gitignore
gulpfile.js/**
tsconfig.json
tsfmt.json
.prettierrc
vsc-extension-quickstart.md
node_modules/**

View File

@@ -1,5 +1,112 @@
# CodeQL for Visual Studio Code: Changelog
## 1.8.2 - 12 April 2023
- Fix bug where users could end up with the mananged CodeQL CLI getting uninstalled during upgrades and not reinstalled. [#2294](https://github.com/github/vscode-codeql/pull/2294)
- Fix bug that was causing code flows to not get updated when switching between results. [#2288](https://github.com/github/vscode-codeql/pull/2288)
- Restart the CodeQL language server whenever the _CodeQL: Restart Query Server_ command is invoked. This avoids bugs where the CLI version changes to support new language features, but the language server is not updated. [#2238](https://github.com/github/vscode-codeql/pull/2238)
## 1.8.1 - 23 March 2023
- Show data flow paths of a variant analysis in a new tab. [#2172](https://github.com/github/vscode-codeql/pull/2172) & [#2182](https://github.com/github/vscode-codeql/pull/2182)
- Show labels of entities in exported CSV results. [#2170](https://github.com/github/vscode-codeql/pull/2170)
## 1.8.0 - 9 March 2023
- Send telemetry about unhandled errors happening within the extension. [#2125](https://github.com/github/vscode-codeql/pull/2125)
- Enable multi-repository variant analysis. [#2144](https://github.com/github/vscode-codeql/pull/2144)
## 1.7.11 - 1 March 2023
- Enable collection of telemetry concerning interactions with UI elements, including buttons, links, and other inputs. [#2114](https://github.com/github/vscode-codeql/pull/2114)
- Prevent the automatic installation of CodeQL CLI version 2.12.3 to avoid a bug in the language server. CodeQL CLI 2.12.2 will be used instead. [#2126](https://github.com/github/vscode-codeql/pull/2126)
## 1.7.10 - 23 February 2023
- Fix bug that was causing unwanted error notifications.
## 1.7.9 - 20 February 2023
No user facing changes.
## 1.7.8 - 2 February 2023
- Renamed command "CodeQL: Run Query" to "CodeQL: Run Query on Selected Database". [#1962](https://github.com/github/vscode-codeql/pull/1962)
- Remove support for CodeQL CLI versions older than 2.7.6. [#1788](https://github.com/github/vscode-codeql/pull/1788)
## 1.7.7 - 13 December 2022
- Increase the required version of VS Code to 1.67.0. [#1662](https://github.com/github/vscode-codeql/pull/1662)
## 1.7.6 - 21 November 2022
- Warn users when their VS Code version is too old to support all features in the vscode-codeql extension. [#1674](https://github.com/github/vscode-codeql/pull/1674)
## 1.7.5 - 8 November 2022
- Fix a bug where the AST Viewer was not working unless the associated CodeQL library pack is in the workspace. [#1735](https://github.com/github/vscode-codeql/pull/1735)
## 1.7.4 - 29 October 2022
No user facing changes.
## 1.7.3 - 28 October 2022
- Fix a bug where databases may be lost if VS Code is restarted while the extension is being started up. [#1638](https://github.com/github/vscode-codeql/pull/1638)
- Add commands for navigating up, down, left, or right in the result viewer. Previously there were only commands for moving up and down the currently-selected path. We suggest binding keyboard shortcuts to these commands, for navigating the result viewer using the keyboard. [#1568](https://github.com/github/vscode-codeql/pull/1568)
## 1.7.2 - 14 October 2022
- Fix a bug where results created in older versions were thought to be unsuccessful. [#1605](https://github.com/github/vscode-codeql/pull/1605)
## 1.7.1 - 12 October 2022
- Fix a bug where it was not possible to add a database folder if the folder name starts with `db-`. [#1565](https://github.com/github/vscode-codeql/pull/1565)
- Ensure the results view opens in an editor column beside the currently active editor. [#1557](https://github.com/github/vscode-codeql/pull/1557)
## 1.7.0 - 20 September 2022
- Remove ability to download databases from LGTM. [#1467](https://github.com/github/vscode-codeql/pull/1467)
- Remove the ability to manually upgrade databases from the context menu on databases. Databases are non-destructively upgraded automatically so for most users this was not needed. For advanced users this is still available in the Command Palette. [#1501](https://github.com/github/vscode-codeql/pull/1501)
- Always restart the query server after a manual database upgrade. This avoids a bug in the query server where an invalid dbscheme was being retained in memory after an upgrade. [#1519](https://github.com/github/vscode-codeql/pull/1519)
## 1.6.12 - 1 September 2022
- Add ability for users to download databases directly from GitHub. [#1485](https://github.com/github/vscode-codeql/pull/1485)
- Fix a race condition that could cause a failure to open the evaluator log when running a query. [#1490](https://github.com/github/vscode-codeql/pull/1490)
- Fix an error when running a query with an older version of the CodeQL CLI. [#1490](https://github.com/github/vscode-codeql/pull/1490)
## 1.6.11 - 25 August 2022
No user facing changes.
## 1.6.10 - 9 August 2022
No user facing changes.
## 1.6.9 - 20 July 2022
No user facing changes.
## 1.6.8 - 29 June 2022
- Fix a bug where quick queries cannot be compiled if the core libraries are not in the workspace. [#1411](https://github.com/github/vscode-codeql/pull/1411)
- Fix a bug where quick evaluation of library files would display an error message when using CodeQL CLI v2.10.0. [#1412](https://github.com/github/vscode-codeql/pull/1412)
## 1.6.7 - 15 June 2022
- Prints end-of-query evaluator log summaries to the Query Log. [#1349](https://github.com/github/vscode-codeql/pull/1349)
- Be consistent about casing in Query History menu. [#1369](https://github.com/github/vscode-codeql/pull/1369)
- Fix quoting string columns in exported CSV results. [#1379](https://github.com/github/vscode-codeql/pull/1379)
## 1.6.6 - 17 May 2022
No user facing changes.
## 1.6.5 - 25 April 2022
- Re-enable publishing to open-vsx. [#1285](https://github.com/github/vscode-codeql/pull/1285)
## 1.6.4 - 6 April 2022
No user facing changes.

View File

@@ -16,17 +16,19 @@ For information about other configurations, see the separate [CodeQL help](https
### Quick start: Installing and configuring the extension
1. [Install the extension](#installing-the-extension).
1. [Install the extension](#installing-the-extension).
*Note: vscode-codeql installs the following dependencies for required functionality: [Test Adapter Converter](https://marketplace.visualstudio.com/items?itemName=ms-vscode.test-adapter-converter), [Test Explorer UI](https://marketplace.visualstudio.com/items?itemName=hbenl.vscode-test-explorer).*
1. [Check access to the CodeQL CLI](#checking-access-to-the-codeql-cli).
1. [Clone the CodeQL starter workspace](#cloning-the-codeql-starter-workspace).
### Quick start: Using CodeQL
1. [Import a database from LGTM](#importing-a-database-from-lgtm).
1. [Import a database from GitHub](#importing-a-database-from-github).
1. [Run a query](#running-a-query).
---
<!-- markdownlint-disable-next-line MD024 -->
## Quick start: Installing and configuring the extension
### Installing the extension
@@ -69,35 +71,41 @@ in the starter workspace directory.
If you're using your own clone of the CodeQL standard libraries, you can do a `git pull` from where you have the libraries checked out.
<!-- markdownlint-disable-next-line MD024 -->
## Quick start: Using CodeQL
You can find all the commands contributed by the extension in the Command Palette (**Ctrl+Shift+P** or **Cmd+Shift+P**) by typing `CodeQL`, many of them are also accessible through the interface, and via keyboard shortcuts.
### Importing a database from LGTM
### Importing a database from GitHub
While you can use the [CodeQL CLI to create your own databases](https://codeql.github.com/docs/codeql-cli/creating-codeql-databases/), the simplest way to start is by downloading a database from LGTM.com.
While you can use the [CodeQL CLI to create your own databases](https://codeql.github.com/docs/codeql-cli/creating-codeql-databases/), the simplest way to start is by downloading a database from GitHub.com.
1. Open [LGTM.com](https://lgtm.com/#explore) in your browser.
1. Search for a project you're interested in, for example [Apache Kafka](https://lgtm.com/projects/g/apache/kafka).
1. Copy the link to that project, for example `https://lgtm.com/projects/g/apache/kafka`.
1. In VS Code, open the Command Palette and choose the **CodeQL: Download Database from LGTM** command.
1. Find a project that you're interested in on GitHub.com, for example [Apache Kafka](https://github.com/apache/kafka).
1. Copy the link to that project, for example `https://github.com/apache/kafka`.
1. In VS Code, open the Command Palette and choose the **CodeQL: Download Database from GitHub** command.
1. Paste the link you copied earlier.
1. Select the language for the database you want to download (only required if the project has databases for multiple languages).
1. Once the CodeQL database has been imported, it is displayed in the Databases view.
For more information, see [Choosing a database](https://codeql.github.com/docs/codeql-for-visual-studio-code/analyzing-your-projects/#choosing-a-database) on codeql.github.com.
### Running a query
The instructions below assume that you're using the CodeQL starter workspace, or that you've added the CodeQL libraries and queries repository to your workspace.
1. Expand the `ql` folder and locate a query to run. The standard queries are grouped by target language and then type, for example: `ql/java/ql/src/Likely Bugs`.
1. Open a query (`.ql`) file.
1. Right-click in the query window and select **CodeQL: Run Query**. Alternatively, open the Command Palette (**Ctrl+Shift+P** or **Cmd+Shift+P**), type `Run Query`, then select **CodeQL: Run Query**.
1. Right-click in the query window and select **CodeQL: Run Query on Selected Database**. Alternatively, open the Command Palette (**Ctrl+Shift+P** or **Cmd+Shift+P**), type `Run Query`, then select **CodeQL: Run Query on Selected Database**.
The CodeQL extension runs the query on the current database using the CLI and reports progress in the bottom right corner of the application.
When the results are ready, they're displayed in the CodeQL Query Results view. Use the dropdown menu to choose between different forms of result output.
If there are any problems running a query, a notification is displayed in the bottom right corner of the application. In addition to the error message, the notification includes details of how to fix the problem.
### Keyboard navigation
If you wish to navigate the query results from your keyboard, you can bind shortcuts to the **CodeQL: Navigate Up/Down/Left/Right in Result Viewer** commands.
## What next?
For more information about the CodeQL extension, [see the documentation](https://codeql.github.com/docs/codeql-for-visual-studio-code/). Otherwise, you could:

View File

@@ -0,0 +1,127 @@
{
"type": "object",
"properties": {
"$schema": {
"type": "string"
},
"version": {
"type": "integer"
},
"databases": {
"type": "object",
"properties": {
"variantAnalysis": {
"type": "object",
"properties": {
"repositoryLists": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 1
},
"repositories": {
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-zA-Z0-9-_\\.]+/[a-zA-Z0-9-_\\.]+$"
}
}
},
"required": ["name", "repositories"],
"additionalProperties": false
}
},
"owners": {
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-zA-Z0-9-_\\.]+$"
}
},
"repositories": {
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-zA-Z0-9-_\\.]+/[a-zA-Z0-9-_\\.]+$"
}
}
},
"required": ["repositoryLists", "owners", "repositories"],
"additionalProperties": false
}
},
"required": ["variantAnalysis"],
"additionalProperties": false
},
"selected": {
"type": "object",
"oneOf": [
{
"properties": {
"kind": {
"type": "string",
"enum": ["variantAnalysisSystemDefinedList"]
},
"listName": {
"type": "string",
"minLength": 1
}
},
"required": ["kind", "listName"],
"additionalProperties": false
},
{
"properties": {
"kind": {
"type": "string",
"enum": ["variantAnalysisUserDefinedList"]
},
"listName": {
"type": "string",
"minLength": 1
}
},
"required": ["kind", "listName"],
"additionalProperties": false
},
{
"properties": {
"kind": {
"type": "string",
"enum": ["variantAnalysisOwner"]
},
"ownerName": {
"type": "string",
"minLength": 1
}
},
"required": ["kind", "ownerName"],
"additionalProperties": false
},
{
"properties": {
"kind": {
"type": "string",
"enum": ["variantAnalysisRepository"]
},
"repositoryName": {
"type": "string",
"minLength": 1
},
"listName": {
"type": "string",
"minLength": 1
}
},
"required": ["kind", "repositoryName"],
"additionalProperties": false
}
]
}
},
"required": ["databases", "version"],
"additionalProperties": false
}

View File

@@ -1,17 +1,19 @@
import * as gulp from 'gulp';
import { src, dest } from "gulp";
// eslint-disable-next-line @typescript-eslint/no-var-requires
const replace = require('gulp-replace');
const replace = require("gulp-replace");
/** Inject the application insights key into the telemetry file */
export function injectAppInsightsKey() {
if (!process.env.APP_INSIGHTS_KEY) {
// noop
console.log('APP_INSIGHTS_KEY environment variable is not set. So, cannot inject it into the application.');
console.log(
"APP_INSIGHTS_KEY environment variable is not set. So, cannot inject it into the application.",
);
return Promise.resolve();
}
// replace the key
return gulp.src(['out/telemetry.js'])
return src(["out/extension.js"])
.pipe(replace(/REPLACE-APP-INSIGHTS-KEY/, process.env.APP_INSIGHTS_KEY))
.pipe(gulp.dest('out/'));
.pipe(dest("out/"));
}

View File

@@ -1,6 +1,14 @@
import * as fs from 'fs-extra';
import * as jsonc from 'jsonc-parser';
import * as path from 'path';
import {
copy,
readFile,
mkdirs,
readdir,
unlinkSync,
remove,
writeFile,
} from "fs-extra";
import { resolve, join } from "path";
import { isDevBuild } from "./dev";
export interface DeployedPackage {
distPath: string;
@@ -9,64 +17,88 @@ export interface DeployedPackage {
}
const packageFiles = [
'.vscodeignore',
'CHANGELOG.md',
'README.md',
'language-configuration.json',
'snippets.json',
'media',
'node_modules',
'out'
".vscodeignore",
"CHANGELOG.md",
"README.md",
"language-configuration.json",
"snippets.json",
"media",
"out",
"databases-schema.json",
];
async function copyPackage(sourcePath: string, destPath: string): Promise<void> {
for (const file of packageFiles) {
console.log(`copying ${path.resolve(sourcePath, file)} to ${path.resolve(destPath, file)}`);
await fs.copy(path.resolve(sourcePath, file), path.resolve(destPath, file));
}
async function copyDirectory(
sourcePath: string,
destPath: string,
): Promise<void> {
console.log(`copying ${sourcePath} to ${destPath}`);
await copy(sourcePath, destPath);
}
export async function deployPackage(packageJsonPath: string): Promise<DeployedPackage> {
try {
const packageJson: any = jsonc.parse(await fs.readFile(packageJsonPath, 'utf8'));
async function copyPackage(
sourcePath: string,
destPath: string,
): Promise<void> {
await Promise.all(
packageFiles.map((file) =>
copyDirectory(resolve(sourcePath, file), resolve(destPath, file)),
),
);
}
// Default to development build; use flag --release to indicate release build.
const isDevBuild = !process.argv.includes('--release');
const distDir = path.join(__dirname, '../../../dist');
await fs.mkdirs(distDir);
export async function deployPackage(
packageJsonPath: string,
): Promise<DeployedPackage> {
try {
const packageJson: any = JSON.parse(
await readFile(packageJsonPath, "utf8"),
);
const distDir = join(__dirname, "../../../dist");
await mkdirs(distDir);
if (isDevBuild) {
// NOTE: rootPackage.name had better not have any regex metacharacters
const oldDevBuildPattern = new RegExp('^' + packageJson.name + '[^/]+-dev[0-9.]+\\.vsix$');
const oldDevBuildPattern = new RegExp(
`^${packageJson.name}[^/]+-dev[0-9.]+\\.vsix$`,
);
// Dev package filenames are of the form
// vscode-codeql-0.0.1-dev.2019.9.27.19.55.20.vsix
(await fs.readdir(distDir)).filter(name => name.match(oldDevBuildPattern)).map(build => {
console.log(`Deleting old dev build ${build}...`);
fs.unlinkSync(path.join(distDir, build));
});
(await readdir(distDir))
.filter((name) => name.match(oldDevBuildPattern))
.map((build) => {
console.log(`Deleting old dev build ${build}...`);
unlinkSync(join(distDir, build));
});
const now = new Date();
packageJson.version = packageJson.version +
`-dev.${now.getUTCFullYear()}.${now.getUTCMonth() + 1}.${now.getUTCDate()}` +
packageJson.version =
`${packageJson.version}-dev.${now.getUTCFullYear()}.${
now.getUTCMonth() + 1
}.${now.getUTCDate()}` +
`.${now.getUTCHours()}.${now.getUTCMinutes()}.${now.getUTCSeconds()}`;
}
const distPath = path.join(distDir, packageJson.name);
await fs.remove(distPath);
await fs.mkdirs(distPath);
const distPath = join(distDir, packageJson.name);
await remove(distPath);
await mkdirs(distPath);
await fs.writeFile(path.join(distPath, 'package.json'), JSON.stringify(packageJson, null, 2));
await writeFile(
join(distPath, "package.json"),
JSON.stringify(packageJson, null, 2),
);
const sourcePath = path.join(__dirname, '..');
console.log(`Copying package '${packageJson.name}' and its dependencies to '${distPath}'...`);
const sourcePath = join(__dirname, "..");
console.log(
`Copying package '${packageJson.name}' and its dependencies to '${distPath}'...`,
);
await copyPackage(sourcePath, distPath);
return {
distPath: distPath,
distPath,
name: packageJson.name,
version: packageJson.version
version: packageJson.version,
};
}
catch (e) {
} catch (e) {
console.error(e);
throw e;
}

View File

@@ -0,0 +1,2 @@
// Default to development build; use flag --release to indicate release build.
export const isDevBuild = !process.argv.includes("--release");

View File

@@ -1,28 +1,44 @@
import * as gulp from 'gulp';
import { compileTypeScript, watchTypeScript, copyViewCss, cleanOutput, watchCss } from './typescript';
import { compileTextMateGrammar } from './textmate';
import { copyTestData } from './tests';
import { compileView, watchView } from './webpack';
import { packageExtension } from './package';
import { injectAppInsightsKey } from './appInsights';
import { parallel, series } from "gulp";
import {
compileEsbuild,
watchEsbuild,
checkTypeScript,
watchCheckTypeScript,
cleanOutput,
copyWasmFiles,
} from "./typescript";
import { compileTextMateGrammar } from "./textmate";
import { compileView, watchView } from "./webpack";
import { packageExtension } from "./package";
import { injectAppInsightsKey } from "./appInsights";
export const buildWithoutPackage =
gulp.series(
cleanOutput,
gulp.parallel(
compileTypeScript, compileTextMateGrammar, compileView, copyTestData, copyViewCss
)
);
export const buildWithoutPackage = series(
cleanOutput,
parallel(
compileEsbuild,
copyWasmFiles,
checkTypeScript,
compileTextMateGrammar,
compileView,
),
);
export const watch = parallel(watchEsbuild, watchCheckTypeScript, watchView);
export {
cleanOutput,
compileTextMateGrammar,
watchTypeScript,
watchEsbuild,
watchCheckTypeScript,
watchView,
compileTypeScript,
copyTestData,
compileEsbuild,
copyWasmFiles,
checkTypeScript,
injectAppInsightsKey,
compileView,
watchCss
};
export default gulp.series(buildWithoutPackage, injectAppInsightsKey, packageExtension);
export default series(
buildWithoutPackage,
injectAppInsightsKey,
packageExtension,
);

View File

@@ -1,21 +1,31 @@
import * as path from 'path';
import { deployPackage } from './deploy';
import * as childProcess from 'child-process-promise';
import { resolve } from "path";
import { deployPackage } from "./deploy";
import { spawn } from "child-process-promise";
export async function packageExtension(): Promise<void> {
const deployedPackage = await deployPackage(path.resolve('package.json'));
console.log(`Packaging extension '${deployedPackage.name}@${deployedPackage.version}'...`);
const deployedPackage = await deployPackage(
resolve(__dirname, "../package.json"),
);
console.log(
`Packaging extension '${deployedPackage.name}@${deployedPackage.version}'...`,
);
const args = [
'package',
'--out', path.resolve(deployedPackage.distPath, '..', `${deployedPackage.name}-${deployedPackage.version}.vsix`)
"package",
"--out",
resolve(
deployedPackage.distPath,
"..",
`${deployedPackage.name}-${deployedPackage.version}.vsix`,
),
"--no-dependencies",
];
const proc = childProcess.spawn('./node_modules/.bin/vsce', args, {
cwd: deployedPackage.distPath
const proc = spawn(resolve(__dirname, "../node_modules/.bin/vsce"), args, {
cwd: deployedPackage.distPath,
});
proc.childProcess.stdout!.on('data', (data) => {
proc.childProcess.stdout!.on("data", (data) => {
console.log(data.toString());
});
proc.childProcess.stderr!.on('data', (data) => {
proc.childProcess.stderr!.on("data", (data) => {
console.error(data.toString());
});

View File

@@ -1,17 +0,0 @@
import * as gulp from 'gulp';
export function copyTestData() {
copyNoWorkspaceData();
copyCliIntegrationData();
return Promise.resolve();
}
function copyNoWorkspaceData() {
return gulp.src('src/vscode-tests/no-workspace/data/**/*')
.pipe(gulp.dest('out/vscode-tests/no-workspace/data'));
}
function copyCliIntegrationData() {
return gulp.src('src/vscode-tests/cli-integration/data/**/*')
.pipe(gulp.dest('out/vscode-tests/cli-integration/data'));
}

View File

@@ -1,8 +1,8 @@
import * as gulp from 'gulp';
import * as jsYaml from 'js-yaml';
import * as through from 'through2';
import * as PluginError from 'plugin-error';
import * as Vinyl from 'vinyl';
import { dest, src } from "gulp";
import { load } from "js-yaml";
import { obj } from "through2";
import PluginError from "plugin-error";
import * as Vinyl from "vinyl";
/**
* Replaces all rule references with the match pattern of the referenced rule.
@@ -11,7 +11,10 @@ import * as Vinyl from 'vinyl';
* @param replacements Map from rule name to match text.
* @returns The new regex after replacement.
*/
function replaceReferencesWithStrings(value: string, replacements: Map<string, string>): string {
function replaceReferencesWithStrings(
value: string,
replacements: Map<string, string>,
): string {
let result = value;
// eslint-disable-next-line no-constant-condition
while (true) {
@@ -52,21 +55,19 @@ function getNodeMatchText(rule: any): string {
if (rule.match !== undefined) {
// For a match string, just use that string as the replacement.
return rule.match;
}
else if (rule.patterns !== undefined) {
} else if (rule.patterns !== undefined) {
const patterns: string[] = [];
// For a list of patterns, use the disjunction of those patterns.
for (const patternIndex in rule.patterns) {
const pattern = rule.patterns[patternIndex];
if (pattern.include !== null) {
patterns.push('(?' + pattern.include + ')');
patterns.push(`(?${pattern.include})`);
}
}
return '(?:' + patterns.join('|') + ')';
}
else {
return '';
return `(?:${patterns.join("|")})`;
} else {
return "";
}
}
@@ -109,7 +110,7 @@ function visitAllRulesInFile(yaml: any, action: (rule: any) => void) {
function visitAllRulesInRuleMap(ruleMap: any, action: (rule: any) => void) {
for (const key in ruleMap) {
const rule = ruleMap[key];
if ((typeof rule) === 'object') {
if (typeof rule === "object") {
action(rule);
if (rule.patterns !== undefined) {
visitAllRulesInRuleMap(rule.patterns, action);
@@ -127,10 +128,10 @@ function visitAllRulesInRuleMap(ruleMap: any, action: (rule: any) => void) {
function visitAllMatchesInRule(rule: any, action: (match: any) => any) {
for (const key in rule) {
switch (key) {
case 'begin':
case 'end':
case 'match':
case 'while':
case "begin":
case "end":
case "match":
case "while":
rule[key] = action(rule[key]);
break;
@@ -147,21 +148,21 @@ function visitAllMatchesInRule(rule: any, action: (match: any) => any) {
* @param rule Rule to be transformed.
* @param key Base key of the property to be transformed.
*/
function expandPatternMatchProperties(rule: any, key: 'begin' | 'end') {
const patternKey = key + 'Pattern';
const capturesKey = key + 'Captures';
function expandPatternMatchProperties(rule: any, key: "begin" | "end") {
const patternKey = `${key}Pattern`;
const capturesKey = `${key}Captures`;
const pattern = rule[patternKey];
if (pattern !== undefined) {
const patterns: string[] = Array.isArray(pattern) ? pattern : [pattern];
rule[key] = patterns.map(p => `((?${p}))`).join('|');
rule[key] = patterns.map((p) => `((?${p}))`).join("|");
const captures: { [index: string]: any } = {};
for (const patternIndex in patterns) {
captures[(Number(patternIndex) + 1).toString()] = {
patterns: [
{
include: patterns[patternIndex]
}
]
include: patterns[patternIndex],
},
],
};
}
rule[capturesKey] = captures;
@@ -177,20 +178,19 @@ function expandPatternMatchProperties(rule: any, key: 'begin' | 'end') {
function transformFile(yaml: any) {
const macros = gatherMacros(yaml);
visitAllRulesInFile(yaml, (rule) => {
expandPatternMatchProperties(rule, 'begin');
expandPatternMatchProperties(rule, 'end');
expandPatternMatchProperties(rule, "begin");
expandPatternMatchProperties(rule, "end");
});
// Expand macros in matches.
visitAllRulesInFile(yaml, (rule) => {
visitAllMatchesInRule(rule, (match) => {
if ((typeof match) === 'object') {
if (typeof match === "object") {
for (const key in match) {
return macros.get(key)!.replace('(?#)', `(?:${match[key]})`);
return macros.get(key)!.replace("(?#)", `(?:${match[key]})`);
}
throw new Error('No key in macro map.');
}
else {
throw new Error("No key in macro map.");
} else {
return match;
}
});
@@ -207,7 +207,7 @@ function transformFile(yaml: any) {
});
if (yaml.regexOptions !== undefined) {
const regexOptions = '(?' + yaml.regexOptions + ')';
const regexOptions = `(?${yaml.regexOptions})`;
visitAllRulesInFile(yaml, (rule) => {
visitAllMatchesInRule(rule, (match) => {
return regexOptions + match;
@@ -219,28 +219,35 @@ function transformFile(yaml: any) {
}
export function transpileTextMateGrammar() {
return through.obj((file: Vinyl, _encoding: string, callback: Function): void => {
if (file.isNull()) {
callback(null, file);
}
else if (file.isBuffer()) {
const buf: Buffer = file.contents;
const yamlText: string = buf.toString('utf8');
const jsonData: any = jsYaml.safeLoad(yamlText);
transformFile(jsonData);
return obj(
(
file: Vinyl,
_encoding: string,
callback: (err: string | null, file: Vinyl | PluginError) => void,
): void => {
if (file.isNull()) {
callback(null, file);
} else if (file.isBuffer()) {
const buf: Buffer = file.contents;
const yamlText: string = buf.toString("utf8");
const jsonData: any = load(yamlText);
transformFile(jsonData);
file.contents = Buffer.from(JSON.stringify(jsonData, null, 2), 'utf8');
file.extname = '.json';
callback(null, file);
}
else {
callback('error', new PluginError('transpileTextMateGrammar', 'Format not supported.'));
}
});
file.contents = Buffer.from(JSON.stringify(jsonData, null, 2), "utf8");
file.extname = ".json";
callback(null, file);
} else {
callback(
"error",
new PluginError("transpileTextMateGrammar", "Format not supported."),
);
}
},
);
}
export function compileTextMateGrammar() {
return gulp.src('syntaxes/*.tmLanguage.yml')
return src("syntaxes/*.tmLanguage.yml")
.pipe(transpileTextMateGrammar())
.pipe(gulp.dest('out/syntaxes'));
.pipe(dest("out/syntaxes"));
}

View File

@@ -1,23 +1,8 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "../tsconfig.json",
"compilerOptions": {
"declaration": true,
"strict": true,
"module": "commonjs",
"target": "es2017",
"lib": ["ES2021"],
"moduleResolution": "node",
"sourceMap": true,
"rootDir": ".",
"strictNullChecks": true,
"noFallthroughCasesInSwitch": true,
"preserveWatchOutput": true,
"newLine": "lf",
"noImplicitReturns": true,
"experimentalDecorators": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"esModuleInterop": true
"rootDir": "."
},
"include": ["*.ts"]
}

View File

@@ -1,51 +1,80 @@
import * as colors from 'ansi-colors';
import * as gulp from 'gulp';
import * as sourcemaps from 'gulp-sourcemaps';
import * as ts from 'gulp-typescript';
import * as del from 'del';
import { gray, red } from "ansi-colors";
import { dest, src, watch } from "gulp";
import esbuild from "gulp-esbuild";
import ts from "gulp-typescript";
import del from "del";
function goodReporter(): ts.reporter.Reporter {
return {
error: (error, typescript) => {
if (error.tsFile) {
console.log('[' + colors.gray('gulp-typescript') + '] ' + colors.red(error.fullFilename
+ '(' + (error.startPosition!.line + 1) + ',' + error.startPosition!.character + '): ')
+ 'error TS' + error.diagnostic.code + ': ' + typescript.flattenDiagnosticMessageText(error.diagnostic.messageText, '\n'));
}
else {
console.log(
`[${gray("gulp-typescript")}] ${red(
`${error.fullFilename}(${error.startPosition!.line + 1},${
error.startPosition!.character
}): `,
)}error TS${
error.diagnostic.code
}: ${typescript.flattenDiagnosticMessageText(
error.diagnostic.messageText,
"\n",
)}`,
);
} else {
console.log(error.message);
}
},
};
}
const tsProject = ts.createProject('tsconfig.json');
const tsProject = ts.createProject("tsconfig.json");
export function cleanOutput() {
return tsProject.projectDirectory ? del(tsProject.projectDirectory + '/out/*') : Promise.resolve();
return tsProject.projectDirectory
? del(`${tsProject.projectDirectory}/out/*`)
: Promise.resolve();
}
export function compileTypeScript() {
return tsProject.src()
.pipe(sourcemaps.init())
.pipe(tsProject(goodReporter()))
.pipe(sourcemaps.write('.', {
includeContent: false,
sourceRoot: '.',
}))
.pipe(gulp.dest('out'));
export function compileEsbuild() {
return src("./src/extension.ts")
.pipe(
esbuild({
outfile: "extension.js",
bundle: true,
external: ["vscode", "fsevents"],
format: "cjs",
platform: "node",
target: "es2020",
sourcemap: "linked",
sourceRoot: "..",
loader: {
".node": "copy",
},
}),
)
.pipe(dest("out"));
}
export function watchTypeScript() {
gulp.watch('src/**/*.ts', compileTypeScript);
export function watchEsbuild() {
watch("src/**/*.ts", compileEsbuild);
}
export function watchCss() {
gulp.watch('src/**/*.css', copyViewCss);
export function checkTypeScript() {
// This doesn't actually output the TypeScript files, it just
// runs the TypeScript compiler and reports any errors.
return tsProject.src().pipe(tsProject(goodReporter()));
}
/** Copy CSS files for the results view into the output directory. */
export function copyViewCss() {
return gulp.src('src/**/view/*.css')
.pipe(gulp.dest('out'));
export function watchCheckTypeScript() {
watch("src/**/*.ts", checkTypeScript);
}
export function copyWasmFiles() {
// We need to copy this file for the source-map package to work. Without this fie, the source-map
// package is not able to load the WASM file because we are not including the full node_modules
// directory. In version 0.7.4, it is not possible to call SourceMapConsumer.initialize in Node environments
// to configure the path to the WASM file. So, source-map will always load the file from `__dirname/mappings.wasm`.
// In version 0.8.0, it may be possible to do this properly by calling SourceMapConsumer.initialize by
// using the "browser" field in source-map's package.json to load the WASM file from a given file path.
return src("node_modules/source-map/lib/mappings.wasm").pipe(dest("out"));
}

View File

@@ -1,69 +1,84 @@
import * as path from 'path';
import * as webpack from 'webpack';
import { resolve } from "path";
import * as webpack from "webpack";
import MiniCssExtractPlugin from "mini-css-extract-plugin";
import { isDevBuild } from "./dev";
export const config: webpack.Configuration = {
mode: 'development',
mode: isDevBuild ? "development" : "production",
entry: {
resultsView: './src/view/results.tsx',
compareView: './src/compare/view/Compare.tsx',
remoteQueriesView: './src/remote-queries/view/RemoteQueries.tsx',
webview: "./src/view/webview.tsx",
},
output: {
path: path.resolve(__dirname, '..', 'out'),
filename: '[name].js'
path: resolve(__dirname, "..", "out"),
filename: "[name].js",
},
devtool: 'inline-source-map',
devtool: isDevBuild ? "inline-source-map" : "source-map",
resolve: {
extensions: ['.js', '.ts', '.tsx', '.json'],
extensions: [".js", ".ts", ".tsx", ".json"],
fallback: {
path: require.resolve('path-browserify')
}
path: require.resolve("path-browserify"),
},
},
module: {
rules: [
{
test: /\.(ts|tsx)$/,
loader: 'ts-loader',
loader: "ts-loader",
options: {
configFile: 'src/view/tsconfig.json',
}
configFile: "src/view/tsconfig.json",
},
},
{
test: /\.less$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'style-loader'
},
{
loader: 'css-loader',
loader: "css-loader",
options: {
importLoaders: 1,
sourceMap: true
}
sourceMap: true,
},
},
{
loader: 'less-loader',
loader: "less-loader",
options: {
javascriptEnabled: true,
sourceMap: true
}
}
]
sourceMap: true,
},
},
],
},
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'style-loader'
loader: "css-loader",
options: {
sourceMap: true,
},
},
],
},
{
test: /\.(woff(2)?|ttf|eot)$/,
use: [
{
loader: 'css-loader'
}
]
}
]
loader: "file-loader",
options: {
name: "[name].[ext]",
outputPath: "fonts/",
// We need this to make Webpack use the correct path for the fonts.
// Without this, the CSS file will use `url([object Module])`
esModule: false,
},
},
],
},
],
},
performance: {
hints: false
}
hints: false,
},
plugins: [new MiniCssExtractPlugin()],
};

View File

@@ -1,5 +1,5 @@
import * as webpack from 'webpack';
import { config } from './webpack.config';
import webpack from "webpack";
import { config } from "./webpack.config";
export function compileView(cb: (err?: Error) => void) {
doWebpack(config, true, cb);
@@ -12,35 +12,41 @@ export function watchView(cb: (err?: Error) => void) {
watchOptions: {
aggregateTimeout: 200,
poll: 1000,
}
},
};
doWebpack(watchConfig, false, cb);
}
function doWebpack(internalConfig: webpack.Configuration, failOnError: boolean, cb: (err?: Error) => void) {
function doWebpack(
internalConfig: webpack.Configuration,
failOnError: boolean,
cb: (err?: Error) => void,
) {
const resultCb = (error: Error | undefined, stats?: webpack.Stats) => {
if (error) {
cb(error);
}
if (stats) {
console.log(stats.toString({
errorDetails: true,
colors: true,
assets: false,
builtAt: false,
version: false,
hash: false,
entrypoints: false,
timings: false,
modules: false,
errors: true
}));
console.log(
stats.toString({
errorDetails: true,
colors: true,
assets: false,
builtAt: false,
version: false,
hash: false,
entrypoints: false,
timings: false,
modules: false,
errors: true,
}),
);
if (stats.hasErrors()) {
if (failOnError) {
cb(new Error('Compilation errors detected.'));
cb(new Error("Compilation errors detected."));
return;
} else {
console.error('Compilation errors detected.');
console.error("Compilation errors detected.");
}
}
cb();

View File

@@ -0,0 +1,16 @@
/*
* For a detailed explanation regarding each configuration property and type check, visit:
* https://jestjs.io/docs/configuration
*/
/** @type {import('@jest/types').Config.InitialOptions} */
module.exports = {
projects: [
"<rootDir>/src/view",
"<rootDir>/test/unit-tests",
"<rootDir>/test/vscode-tests/activated-extension",
"<rootDir>/test/vscode-tests/cli-integration",
"<rootDir>/test/vscode-tests/no-workspace",
"<rootDir>/test/vscode-tests/minimal-workspace",
],
};

View File

@@ -1,56 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
height="30px"
width="30px"
fill="#000000"
version="1.1"
x="0px"
y="0px"
viewBox="0 0 100 100"
style="enable-background:new 0 0 100 100;"
xml:space="preserve"
id="svg3895"
sodipodi:docname="check-dark-mode.svg"
inkscape:version="0.92.3 (2405546, 2018-03-11)"><metadata
id="metadata3901"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs3899" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1179"
inkscape:window-height="701"
id="namedview3897"
showgrid="false"
inkscape:zoom="7.8666667"
inkscape:cx="-22.881356"
inkscape:cy="15"
inkscape:window-x="0"
inkscape:window-y="28"
inkscape:window-maximized="0"
inkscape:current-layer="svg3895" /><g
transform="translate(-452.57627,-74.457627)"
id="g3893"
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1"><g
id="g3891"
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1"><g
id="g3889"
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1"><path
d="M 457.98136,131.82373 488.80508,163.49492 548.8661,92.416949 535.93729,81.60678 487.85763,144.41695 468.2678,120.58983 Z"
id="path3887"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccc"
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1" /></g></g></g></svg>

Before

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M13.23 1H11.77L3.52002 9.25L3.35999 9.46997L1 13.59L2.41003 15L6.53003 12.64L6.75 12.48L15 4.22998V2.77002L13.23 1ZM2.41003 13.59L3.92004 10.59L5.37 12.04L2.41003 13.59ZM6.23999 11.53L4.46997 9.76001L12.47 1.76001L14.24 3.53003L6.23999 11.53Z" fill="#C5C5C5"/>
</svg>

Before

Width:  |  Height:  |  Size: 372 B

View File

@@ -1,5 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32" fill="none">
<path d="M16.010 6.49c-3.885 0-7.167 0.906-9.328 2.813-0.063-0.12-0.109-0.219-0.188-0.339-0.224-0.365-0.438-0.776-1.104-1.188-0.411-0.26-0.87-0.438-1.349-0.516-0.208-0.021-0.422-0.021-0.63 0l0.135-0.016c-1.214 0-1.922 0.724-2.385 1.354-0.458 0.625-0.755 1.328-0.948 2.099-0.38 1.542-0.385 3.536 1.083 5.026 0.766 0.781 1.667 1.151 2.484 1.37 0.156 0.042 0.297 0.052 0.448 0.083 0.531 2.521 2.104 4.656 4.208 5.839v0.005c1.24 0.693 2.417 1.010 3.297 1.349 1.234 0.479 2.536 1 4.052 1.135l0.078 0.005h0.198c1.745 0 3.063-0.703 4.203-1.141 0.875-0.333 2.052-0.641 3.302-1.344 0.578-0.323 1.115-0.719 1.594-1.172 1.318-1.234 2.229-2.839 2.625-4.599 1.115-0.182 2.141-0.719 2.922-1.536 1.464-1.484 1.458-3.479 1.078-5.021-0.193-0.771-0.49-1.474-0.948-2.099-0.458-0.63-1.172-1.354-2.385-1.354l0.135 0.016c-0.208-0.021-0.422-0.021-0.63 0-0.479 0.078-0.938 0.255-1.344 0.516-0.667 0.411-0.88 0.823-1.104 1.182-0.073 0.12-0.12 0.219-0.188 0.333-2.156-1.901-5.432-2.802-9.313-2.802zM16.042 8.313c4.745 0 8.016 1.422 9.411 3.964 0.839-0.323 1.453-2.521 2.146-2.948 0.563-0.344 0.885-0.26 0.885-0.26 1.271 0 2.578 3.729 0.953 5.38-0.859 0.875-2.443 1.12-3.229 1.057-0.063 2.542-1.542 4.833-3.5 5.932-1 0.563-2.068 0.854-3.063 1.234-1.229 0.469-2.38 1.016-3.547 1.016h-0.125c-1.161-0.099-2.318-0.542-3.547-1.016-0.995-0.38-2.068-0.682-3.063-1.24-1.948-1.099-3.427-3.391-3.49-5.927-0.781 0.068-2.385-0.177-3.245-1.057-1.625-1.651-0.318-5.38 0.948-5.38 0 0 0.328-0.083 0.885 0.26 0.698 0.427 1.318 2.646 2.161 2.953 1.391-2.547 4.667-3.969 9.417-3.969zM10.875 11.422c-2.276-0.042-4.146 1.792-4.146 4.068 0 2.281 1.87 4.115 4.146 4.073 5.328-0.099 5.328-8.047 0-8.141zM21.208 11.422c-5.427 0-5.427 8.141 0 8.141s5.427-8.141 0-8.141zM11.453 13.708c2.349 0.063 2.349 3.552 0 3.615-1.182 0-2.042-1.115-1.75-2.255 0.318 0.771 1.469 0.547 1.464-0.292 0-0.406-0.318-0.745-0.729-0.76 0.302-0.203 0.656-0.313 1.016-0.307zM20.641 13.708c2.344 0.063 2.344 3.552 0 3.615-1.182 0-2.047-1.115-1.755-2.255 0.229 0.552 0.979 0.641 1.328 0.146 0.344-0.49 0.010-1.167-0.589-1.193 0.297-0.208 0.651-0.313 1.016-0.313zM15.359 19.906c-0.318 0.026-0.5 0.193-0.5 0.635 0 0.281 0.182 0.484 0.5 0.484 0.229 0 0.266-0.323 0.047-0.375-0.031-0.005-0.172-0.057-0.172-0.182 0-0.12 0-0.167 0.24-0.198 0.104-0.016 0.156-0.141 0.125-0.24s-0.125-0.135-0.24-0.125zM16.724 19.906c-0.115-0.005-0.208 0.026-0.24 0.125s0.021 0.224 0.125 0.24c0.24 0.031 0.24 0.078 0.24 0.198 0 0.125-0.141 0.177-0.172 0.182-0.219 0.052-0.182 0.375 0.042 0.375 0.323 0 0.51-0.203 0.51-0.484 0-0.443-0.188-0.609-0.505-0.635z" fill="#C5C5C5"/>
<line y2="24" x2="16" y1="26" x1="32" stroke-width="2" stroke="green" fill="none"/>
<line y2="16" x2="24" y1="32" x1="24" stroke-width="1" stroke="green" fill="none"/>
</svg>

Before

Width:  |  Height:  |  Size: 2.8 KiB

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 2H14L15 3V13L14 14H2L1 13V3L2 2ZM2 13H14V3H2V13ZM13 4H3V7H13V4ZM12 6H4V5H12V6ZM9 12H13V8H9V12ZM10 9H12V11H10V9ZM7 8H3V9H7V8ZM3 11H7V12H3V11Z" fill="#C5C5C5"/>
</svg>

Before

Width:  |  Height:  |  Size: 313 B

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" fill="none"
viewBox="0 0 432 432" style="enable-background:new 0 0 432 432;" xml:space="preserve">
<g>
<g>
<g>
<polygon points="234.24,9.067 183.893,59.413 284.587,59.413" fill="#C5C5C5"/>
<path d="m 259.24622,341.40906 v -32.34375 q 13.35937,6.32812 27.07031,9.66797 13.71094,3.33984 26.89453,3.33984 35.15625,0 53.61328,-23.55469 18.63282,-23.73047 21.26953,-71.89453 -10.19531,15.11719 -25.83984,23.20313 -15.64453,8.08593 -34.62891,8.08593 -39.375,0 -62.40234,-23.73046 -22.85156,-23.90625 -22.85156,-65.21485 0,-40.42969 23.90625,-64.86328 23.90625,-24.433594 63.63281,-24.433594 45.52734,0 69.43359,34.980474 24.08204,34.80468 24.08204,101.25 0,62.05078 -29.53125,99.14062 -29.35547,36.91406 -79.10157,36.91406 -13.35937,0 -27.07031,-2.63672 -13.71094,-2.63671 -28.47656,-7.91015 z m 70.66406,-111.26953 q 23.90625,0 37.79297,-16.34766 14.0625,-16.34766 14.0625,-44.82422 0,-28.30078 -14.0625,-44.64844 -13.88672,-16.52343 -37.79297,-16.52343 -23.90625,0 -37.96875,16.52343 -13.88672,16.34766 -13.88672,44.64844 0,28.47656 13.88672,44.82422 14.0625,16.34766 37.96875,16.34766 z" fill="#C5C5C5" />
<polygon points="234.24,422.933 283.947,373.227 184.533,373.227" fill="#C5C5C5"/>
<path d="M 35.300905,316.97546 H 93.308718 V 116.76062 L 30.203249,129.41687 V 97.07312 L 92.957155,84.41687 h 35.507815 v 232.55859 h 58.00781 v 29.88282 H 35.300905 Z" fill="#C5C5C5"/>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M10 3H12H13V4H12V13L11 14H4L3 13V4H2V3H5V2C5 1.73478 5.10531 1.48038 5.29285 1.29285C5.48038 1.10531 5.73478 1 6 1H9C9.26522 1 9.51962 1.10531 9.70715 1.29285C9.89469 1.48038 10 1.73478 10 2V3ZM9 2H6V3H9V2ZM4 13H11V4H4V13ZM6 5H5V12H6V5ZM7 5H8V12H7V5ZM9 5H10V12H9V5Z" fill="#C5C5C5"/>
</svg>

Before

Width:  |  Height:  |  Size: 435 B

View File

@@ -1,7 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.5 12.1952C15.5 12.9126 14.9137 13.4996 14.1957 13.4996H1.80435C1.08696 13.4996 0.5 12.9126 0.5 12.1952L0.5 9.80435C0.5 9.08696 1.08696 8.5 1.80435 8.5H14.1956C14.9137 8.5 15.5 9.08696 15.5 9.80435L15.5 12.1952Z" stroke="#959DA5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M2.45654 11.5H13.5435" stroke="#959DA5" stroke-linecap="round" stroke-linejoin="round"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.5 9.5C13.224 9.5 13 9.725 13 10C13 10.275 13.224 10.5 13.5 10.5C13.776 10.5 14 10.275 14 10C14 9.725 13.776 9.5 13.5 9.5" fill="#959DA5"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.5 9.5C11.224 9.5 11 9.725 11 10C11 10.275 11.224 10.5 11.5 10.5C11.776 10.5 12 10.275 12 10C12 9.725 11.776 9.5 11.5 9.5" fill="#959DA5"/>
<path d="M15.5 9.81464L13.8728 2.76261C13.6922 2.06804 12.9572 1.5 12.2391 1.5H3.76087C3.04348 1.5 2.30848 2.06804 2.12783 2.76261L0.5 9.8" stroke="#959DA5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1,16 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="7.5" cy="7.5" r="7" stroke="#959DA5"/>
<mask id="mask0_394_2982" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="15" height="15">
<circle cx="7.5" cy="7.5" r="7.5" fill="#C4C4C4"/>
</mask>
<g mask="url(#mask0_394_2982)">
<path d="M14.5 7.5C14.5 9.42971 13.6822 11.1907 12.5493 12.4721C11.4035 13.7683 10.0054 14.5 8.90625 14.5C7.84644 14.5 6.81131 13.8113 6.01569 12.5383C5.22447 11.2724 4.71875 9.49235 4.71875 7.5C4.71875 5.50765 5.22447 3.72765 6.01569 2.4617C6.81131 1.1887 7.84644 0.5 8.90625 0.5C10.0054 0.5 11.4035 1.23172 12.5493 2.52786C13.6822 3.80934 14.5 5.57029 14.5 7.5Z" stroke="#959DA5"/>
</g>
<mask id="mask1_394_2982" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="1" y="0" width="16" height="15">
<circle cx="9.375" cy="7.5" r="7.5" fill="#C4C4C4"/>
</mask>
<g mask="url(#mask1_394_2982)">
<path d="M10.2812 7.5C10.2812 9.49235 9.77553 11.2724 8.98431 12.5383C8.18869 13.8113 7.15356 14.5 6.09375 14.5C4.99456 14.5 3.5965 13.7683 2.45067 12.4721C1.31781 11.1907 0.5 9.42971 0.5 7.5C0.5 5.57029 1.31781 3.80934 2.45067 2.52786C3.5965 1.23172 4.99456 0.5 6.09375 0.5C7.15356 0.5 8.18869 1.1887 8.98431 2.4617C9.77553 3.72765 10.2812 5.50765 10.2812 7.5Z" stroke="#959DA5"/>
</g>
<line y1="7.5" x2="15" y2="7.5" stroke="#959DA5"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -1,57 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
height="30px"
width="30px"
fill="#000000"
version="1.1"
x="0px"
y="0px"
viewBox="0 0 100 100"
style="enable-background:new 0 0 100 100;"
xml:space="preserve"
id="svg3895"
sodipodi:docname="check.svg"
inkscape:version="0.92.3 (2405546, 2018-03-11)"><metadata
id="metadata3901"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs3899" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1179"
inkscape:window-height="701"
id="namedview3897"
showgrid="false"
inkscape:zoom="7.8666667"
inkscape:cx="15"
inkscape:cy="15"
inkscape:window-x="0"
inkscape:window-y="28"
inkscape:window-maximized="0"
inkscape:current-layer="svg3895" /><g
transform="translate(-452.57627,-74.457627)"
id="g3893"
style="fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-opacity:1"><g
id="g3891"
style="fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-opacity:1"><g
id="g3889"
style="fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-opacity:1"><path
d="M 457.98136,131.82373 488.80508,163.49492 548.8661,92.416949 535.93729,81.60678 487.85763,144.41695 468.2678,120.58983 Z"
id="path3887"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccc"
style="fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-opacity:1" /></g></g></g></svg>

Before

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M13.2302 1H11.7703L3.52026 9.25L3.36023 9.46997L1.00024 13.59L2.41028 15L6.53027 12.64L6.75024 12.48L15.0002 4.22998V2.77002L13.2302 1ZM2.41028 13.59L3.92029 10.59L5.37024 12.04L2.41028 13.59ZM6.24023 11.53L4.47021 9.76001L12.4702 1.76001L14.2402 3.53003L6.24023 11.53Z" fill="#424242"/>
</svg>

Before

Width:  |  Height:  |  Size: 399 B

View File

@@ -1,5 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32" fill="none">
<path d="M16.010 6.49c-3.885 0-7.167 0.906-9.328 2.813-0.063-0.12-0.109-0.219-0.188-0.339-0.224-0.365-0.438-0.776-1.104-1.188-0.411-0.26-0.87-0.438-1.349-0.516-0.208-0.021-0.422-0.021-0.63 0l0.135-0.016c-1.214 0-1.922 0.724-2.385 1.354-0.458 0.625-0.755 1.328-0.948 2.099-0.38 1.542-0.385 3.536 1.083 5.026 0.766 0.781 1.667 1.151 2.484 1.37 0.156 0.042 0.297 0.052 0.448 0.083 0.531 2.521 2.104 4.656 4.208 5.839v0.005c1.24 0.693 2.417 1.010 3.297 1.349 1.234 0.479 2.536 1 4.052 1.135l0.078 0.005h0.198c1.745 0 3.063-0.703 4.203-1.141 0.875-0.333 2.052-0.641 3.302-1.344 0.578-0.323 1.115-0.719 1.594-1.172 1.318-1.234 2.229-2.839 2.625-4.599 1.115-0.182 2.141-0.719 2.922-1.536 1.464-1.484 1.458-3.479 1.078-5.021-0.193-0.771-0.49-1.474-0.948-2.099-0.458-0.63-1.172-1.354-2.385-1.354l0.135 0.016c-0.208-0.021-0.422-0.021-0.63 0-0.479 0.078-0.938 0.255-1.344 0.516-0.667 0.411-0.88 0.823-1.104 1.182-0.073 0.12-0.12 0.219-0.188 0.333-2.156-1.901-5.432-2.802-9.313-2.802zM16.042 8.313c4.745 0 8.016 1.422 9.411 3.964 0.839-0.323 1.453-2.521 2.146-2.948 0.563-0.344 0.885-0.26 0.885-0.26 1.271 0 2.578 3.729 0.953 5.38-0.859 0.875-2.443 1.12-3.229 1.057-0.063 2.542-1.542 4.833-3.5 5.932-1 0.563-2.068 0.854-3.063 1.234-1.229 0.469-2.38 1.016-3.547 1.016h-0.125c-1.161-0.099-2.318-0.542-3.547-1.016-0.995-0.38-2.068-0.682-3.063-1.24-1.948-1.099-3.427-3.391-3.49-5.927-0.781 0.068-2.385-0.177-3.245-1.057-1.625-1.651-0.318-5.38 0.948-5.38 0 0 0.328-0.083 0.885 0.26 0.698 0.427 1.318 2.646 2.161 2.953 1.391-2.547 4.667-3.969 9.417-3.969zM10.875 11.422c-2.276-0.042-4.146 1.792-4.146 4.068 0 2.281 1.87 4.115 4.146 4.073 5.328-0.099 5.328-8.047 0-8.141zM21.208 11.422c-5.427 0-5.427 8.141 0 8.141s5.427-8.141 0-8.141zM11.453 13.708c2.349 0.063 2.349 3.552 0 3.615-1.182 0-2.042-1.115-1.75-2.255 0.318 0.771 1.469 0.547 1.464-0.292 0-0.406-0.318-0.745-0.729-0.76 0.302-0.203 0.656-0.313 1.016-0.307zM20.641 13.708c2.344 0.063 2.344 3.552 0 3.615-1.182 0-2.047-1.115-1.755-2.255 0.229 0.552 0.979 0.641 1.328 0.146 0.344-0.49 0.010-1.167-0.589-1.193 0.297-0.208 0.651-0.313 1.016-0.313zM15.359 19.906c-0.318 0.026-0.5 0.193-0.5 0.635 0 0.281 0.182 0.484 0.5 0.484 0.229 0 0.266-0.323 0.047-0.375-0.031-0.005-0.172-0.057-0.172-0.182 0-0.12 0-0.167 0.24-0.198 0.104-0.016 0.156-0.141 0.125-0.24s-0.125-0.135-0.24-0.125zM16.724 19.906c-0.115-0.005-0.208 0.026-0.24 0.125s0.021 0.224 0.125 0.24c0.24 0.031 0.24 0.078 0.24 0.198 0 0.125-0.141 0.177-0.172 0.182-0.219 0.052-0.182 0.375 0.042 0.375 0.323 0 0.51-0.203 0.51-0.484 0-0.443-0.188-0.609-0.505-0.635z" fill="#424242"/>
<line y2="24" x2="16" y1="26" x1="32" stroke-width="2" stroke="green" fill="none"/>
<line y2="16" x2="24" y1="32" x1="24" stroke-width="1" stroke="green" fill="none"/>
</svg>

Before

Width:  |  Height:  |  Size: 2.8 KiB

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.00024 2H14.0002L15.0002 3V13L14.0002 14H2.00024L1.00024 13V3L2.00024 2ZM2.00024 13H14.0002V3H2.00024V13ZM13.0002 4H3.00024V7H13.0002V4ZM12.0002 6H4.00024V5H12.0002V6ZM9.00024 12H13.0002V8H9.00024V12ZM10.0002 9H12.0002V11H10.0002V9ZM7.00024 8H3.00024V9H7.00024V8ZM3.00024 11H7.00024V12H3.00024V11Z" fill="#424242"/>
</svg>

Before

Width:  |  Height:  |  Size: 469 B

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 432 432" style="enable-background:new 0 0 432 432;" xml:space="preserve">
<g>
<g>
<g>
<polygon points="234.24,9.067 183.893,59.413 284.587,59.413" />
<path d="m 259.24622,341.40906 v -32.34375 q 13.35937,6.32812 27.07031,9.66797 13.71094,3.33984 26.89453,3.33984 35.15625,0 53.61328,-23.55469 18.63282,-23.73047 21.26953,-71.89453 -10.19531,15.11719 -25.83984,23.20313 -15.64453,8.08593 -34.62891,8.08593 -39.375,0 -62.40234,-23.73046 -22.85156,-23.90625 -22.85156,-65.21485 0,-40.42969 23.90625,-64.86328 23.90625,-24.433594 63.63281,-24.433594 45.52734,0 69.43359,34.980474 24.08204,34.80468 24.08204,101.25 0,62.05078 -29.53125,99.14062 -29.35547,36.91406 -79.10157,36.91406 -13.35937,0 -27.07031,-2.63672 -13.71094,-2.63671 -28.47656,-7.91015 z m 70.66406,-111.26953 q 23.90625,0 37.79297,-16.34766 14.0625,-16.34766 14.0625,-44.82422 0,-28.30078 -14.0625,-44.64844 -13.88672,-16.52343 -37.79297,-16.52343 -23.90625,0 -37.96875,16.52343 -13.88672,16.34766 -13.88672,44.64844 0,28.47656 13.88672,44.82422 14.0625,16.34766 37.96875,16.34766 z" />
<polygon points="234.24,422.933 283.947,373.227 184.533,373.227" />
<path d="M 35.300905,316.97546 H 93.308718 V 116.76062 L 30.203249,129.41687 V 97.07312 L 92.957155,84.41687 h 35.507815 v 232.55859 h 58.00781 v 29.88282 H 35.300905 Z" />
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.0002 3H12.0002H13.0002V4H12.0002V13L11.0002 14H4.00024L3.00024 13V4H2.00024V3H5.00024V2C5.00024 1.73478 5.10555 1.48038 5.29309 1.29285C5.48063 1.10531 5.73503 1 6.00024 1H9.00024C9.26546 1 9.51986 1.10531 9.7074 1.29285C9.89493 1.48038 10.0002 1.73478 10.0002 2V3ZM9.00024 2H6.00024V3H9.00024V2ZM4.00024 13H11.0002V4H4.00024V13ZM6.00024 5H5.00024V12H6.00024V5ZM7.00024 5H8.00024V12H7.00024V5ZM9.00024 5H10.0002V12H9.00024V5Z" fill="#424242"/>
</svg>

Before

Width:  |  Height:  |  Size: 599 B

View File

@@ -1,58 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
height="30px"
width="30px"
fill="#000000"
version="1.1"
x="0px"
y="0px"
viewBox="0 0 100 100"
style="enable-background:new 0 0 100 100;"
xml:space="preserve"
id="svg3895"
sodipodi:docname="red-x.svg"
inkscape:version="0.92.3 (2405546, 2018-03-11)"><metadata
id="metadata3901"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs3899" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1179"
inkscape:window-height="701"
id="namedview3897"
showgrid="false"
inkscape:zoom="7.8666667"
inkscape:cx="-22.881356"
inkscape:cy="15"
inkscape:window-x="33"
inkscape:window-y="36"
inkscape:window-maximized="0"
inkscape:current-layer="svg3895" /><rect
style="opacity:1;vector-effect:none;fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:2.24023867;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect29"
width="15.499873"
height="88.381233"
x="-8.3491764"
y="27.119303"
transform="matrix(-0.70710678,0.70710678,0.70710678,0.70710678,0,0)" /><rect
style="fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:2.24023867;stroke-opacity:1"
id="rect29-6"
width="15.499873"
height="88.381233"
x="63.559982"
y="-44.789856"
transform="rotate(45)" /></svg>

Before

Width:  |  Height:  |  Size: 2.1 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,155 @@
diff --git a/node_modules/jest-runner-vscode/dist/child/environment.js b/node_modules/jest-runner-vscode/dist/child/environment.js
index 1ac28d5..f91f216 100644
--- a/node_modules/jest-runner-vscode/dist/child/environment.js
+++ b/node_modules/jest-runner-vscode/dist/child/environment.js
@@ -10,6 +10,21 @@ const wrap_io_1 = __importDefault(require("./wrap-io"));
const load_pnp_1 = __importDefault(require("./load-pnp"));
const ipc = new ipc_client_1.default('env');
class VSCodeEnvironment extends jest_environment_node_1.default {
+ constructor(config, context) {
+ super(config, context);
+ // The _VSCODE_NODE_MODULES is a proxy which will require a module if any property
+ // on it is accessed. This is a workaround for the fact that jest will call
+ // _isMockFunction on the module, which will cause that function to be required.
+ this.global._VSCODE_NODE_MODULES = new Proxy(this.global._VSCODE_NODE_MODULES, {
+ get(target, prop) {
+ if (prop === '_isMockFunction') {
+ return undefined;
+ }
+ return target[prop];
+ },
+ });
+ }
+
async setup() {
await super.setup();
await (0, load_pnp_1.default)();
diff --git a/node_modules/jest-runner-vscode/dist/child/runner.js b/node_modules/jest-runner-vscode/dist/child/runner.js
index 0663c5c..4991663 100644
--- a/node_modules/jest-runner-vscode/dist/child/runner.js
+++ b/node_modules/jest-runner-vscode/dist/child/runner.js
@@ -18,10 +18,13 @@ async function run() {
const ipc = new ipc_client_1.default('child');
const disconnected = new Promise(resolve => ipc.on('disconnect', resolve));
try {
- const { PARENT_JEST_OPTIONS } = process_1.default.env;
+ const { PARENT_JEST_OPTIONS, PARENT_CWD } = process_1.default.env;
if (!PARENT_JEST_OPTIONS) {
throw new Error('PARENT_JEST_OPTIONS is not defined');
}
+ if (PARENT_CWD) {
+ process_1.default.chdir(PARENT_CWD);
+ }
const options = JSON.parse(PARENT_JEST_OPTIONS);
const jestOptions = [
...options.args,
diff --git a/node_modules/jest-runner-vscode/dist/public-types.d.ts b/node_modules/jest-runner-vscode/dist/public-types.d.ts
index 57716e5..d8614af 100644
--- a/node_modules/jest-runner-vscode/dist/public-types.d.ts
+++ b/node_modules/jest-runner-vscode/dist/public-types.d.ts
@@ -59,4 +59,5 @@ export interface RunnerOptions {
* code, or download progress. Defaults to `false`.
*/
quiet?: boolean;
+ retries?: number;
}
diff --git a/node_modules/jest-runner-vscode/dist/run-vscode.d.ts b/node_modules/jest-runner-vscode/dist/run-vscode.d.ts
index 8657ace..4d35409 100644
--- a/node_modules/jest-runner-vscode/dist/run-vscode.d.ts
+++ b/node_modules/jest-runner-vscode/dist/run-vscode.d.ts
@@ -16,5 +16,7 @@ export declare type RunVSCodeOptions = {
onFailure: JestRunner.OnTestFailure;
ipc: InstanceType<typeof IPC>;
quiet?: boolean;
+ attempt?: number;
+ maxRetries?: number;
};
-export default function runVSCode({ vscodePath, args, jestArgs, env, tests, globalConfig, filterOutput, onStart, onResult, onFailure, ipc, quiet, }: RunVSCodeOptions): Promise<void>;
+export default function runVSCode(options: RunVSCodeOptions): Promise<void>;
diff --git a/node_modules/jest-runner-vscode/dist/run-vscode.js b/node_modules/jest-runner-vscode/dist/run-vscode.js
index 5d8e513..7e556ee 100644
--- a/node_modules/jest-runner-vscode/dist/run-vscode.js
+++ b/node_modules/jest-runner-vscode/dist/run-vscode.js
@@ -5,8 +5,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true });
const child_process_1 = __importDefault(require("child_process"));
const console_1 = __importDefault(require("console"));
-async function runVSCode({ vscodePath, args, jestArgs, env, tests, globalConfig, filterOutput, onStart, onResult, onFailure, ipc, quiet, }) {
- return await new Promise(resolve => {
+const fs_1 = __importDefault(require("fs"));
+const path_1 = __importDefault(require("path"));
+const os_1 = __importDefault(require("os"));
+async function runVSCode(options) {
+ const { vscodePath, args, jestArgs, env, tests, globalConfig, filterOutput, onStart, onResult, onFailure, ipc, quiet, attempt, maxRetries, } = options;
+ const tempUserDir = await fs_1.default.promises.mkdtemp(path_1.default.resolve(os_1.default.tmpdir(), 'jest-runner-vscode-user-data-'));
+ return await new Promise(promiseResolve => {
+ const resolve = () => {
+ fs_1.default.rm(tempUserDir, { recursive: true }, () => {
+ promiseResolve();
+ });
+ };
const useStdErr = globalConfig.json || globalConfig.useStderr;
const log = useStdErr
? console_1.default.error.bind(console_1.default)
@@ -82,7 +92,11 @@ async function runVSCode({ vscodePath, args, jestArgs, env, tests, globalConfig,
ipc.server.on('stdout', onStdout);
ipc.server.on('stderr', onStderr);
ipc.server.on('error', onError);
- const vscode = child_process_1.default.spawn(vscodePath, args, { env: environment });
+ const launchArgs = args;
+ if (!hasArg('user-data-dir', launchArgs)) {
+ launchArgs.push(`--user-data-dir=${tempUserDir}`);
+ }
+ const vscode = child_process_1.default.spawn(vscodePath, launchArgs, { env: environment });
if (!silent && !filterOutput) {
vscode.stdout.pipe(process.stdout);
vscode.stderr.pipe(process.stderr);
@@ -99,6 +113,29 @@ async function runVSCode({ vscodePath, args, jestArgs, env, tests, globalConfig,
exited = true;
const exit = code ?? signal ?? '<unknown>';
const message = `VS Code exited with exit code ${exit}`;
+ const currentAttempt = attempt ?? 0;
+ const incompleteTests = tests.some(test => !completedTests.has(test));
+ if (maxRetries &&
+ maxRetries > 0 &&
+ currentAttempt < maxRetries &&
+ incompleteTests) {
+ silent || quiet || log(message);
+ const newAttempt = currentAttempt + 1;
+ const newTests = tests.filter(test => !completedTests.has(test));
+ ipc.server.off('testFileResult', onTestFileResult);
+ ipc.server.off('testStart', onTestStart);
+ ipc.server.off('testFileStart', onTestStart);
+ ipc.server.off('stdout', onStdout);
+ ipc.server.off('stderr', onStderr);
+ ipc.server.off('error', onError);
+ await runVSCode({
+ ...options,
+ tests: newTests,
+ attempt: newAttempt,
+ });
+ resolve();
+ return;
+ }
if (typeof code !== 'number' || code !== 0) {
silent || quiet || console_1.default.error(message);
const error = vscodeError ?? childError ?? new Error(message);
@@ -138,3 +175,6 @@ async function runVSCode({ vscodePath, args, jestArgs, env, tests, globalConfig,
});
}
exports.default = runVSCode;
+function hasArg(argName, argList) {
+ return argList.some(a => a === `--${argName}` || a.startsWith(`--${argName}=`));
+}
diff --git a/node_modules/jest-runner-vscode/dist/runner.js b/node_modules/jest-runner-vscode/dist/runner.js
index e24c976..c374022 100644
--- a/node_modules/jest-runner-vscode/dist/runner.js
+++ b/node_modules/jest-runner-vscode/dist/runner.js
@@ -107,6 +107,7 @@ class VSCodeTestRunner {
onFailure,
ipc,
quiet: vscodeOptions.quiet,
+ maxRetries: vscodeOptions.retries,
});
}
catch (error) {

View File

@@ -0,0 +1,142 @@
/**
* This scripts helps after adding a new field in the GitHub API. You will
* need to modify this script to add the new field to the scenarios. This
* is just a template and should not be used as-is since it has already been
* applied.
*
* Depending on the actual implementation of the script, you might run into
* rate limits. If that happens, you can set a `GITHUB_TOKEN` environment
* variable. For example, use: ``export GITHUB_TOKEN=`gh auth token```.
*
* Usage: npx ts-node scripts/add-fields-to-scenarios.ts
*/
import { pathExists, readJson, writeJson } from "fs-extra";
import { resolve, relative } from "path";
import { Octokit, type RestEndpointMethodTypes } from "@octokit/rest";
import { throttling } from "@octokit/plugin-throttling";
import { getFiles } from "./util/files";
import type { GitHubApiRequest } from "../src/mocks/gh-api-request";
import { isGetVariantAnalysisRequest } from "../src/mocks/gh-api-request";
import { VariantAnalysis } from "../src/variant-analysis/gh-api/variant-analysis";
import { RepositoryWithMetadata } from "../src/variant-analysis/gh-api/repository";
const extensionDirectory = resolve(__dirname, "..");
const scenariosDirectory = resolve(extensionDirectory, "src/mocks/scenarios");
// Make sure we don't run into rate limits by automatically waiting until we can
// make another request.
const MyOctokit = Octokit.plugin(throttling);
const auth = process.env.GITHUB_TOKEN;
const octokit = new MyOctokit({
auth,
throttle: {
onRateLimit: (
retryAfter: number,
options: any,
octokit: Octokit,
): boolean => {
octokit.log.warn(
`Request quota exhausted for request ${options.method} ${options.url}. Retrying after ${retryAfter} seconds!`,
);
return true;
},
onSecondaryRateLimit: (
_retryAfter: number,
options: any,
octokit: Octokit,
): void => {
octokit.log.warn(
`SecondaryRateLimit detected for request ${options.method} ${options.url}`,
);
},
},
});
const repositories = new Map<
number,
RestEndpointMethodTypes["repos"]["get"]["response"]["data"]
>();
async function addFieldsToRepository(repository: RepositoryWithMetadata) {
if (!repositories.has(repository.id)) {
const [owner, repo] = repository.full_name.split("/");
const apiRepository = await octokit.repos.get({
owner,
repo,
});
repositories.set(repository.id, apiRepository.data);
}
const apiRepository = repositories.get(repository.id)!;
repository.stargazers_count = apiRepository.stargazers_count;
repository.updated_at = apiRepository.updated_at;
}
async function addFieldsToScenarios() {
if (!(await pathExists(scenariosDirectory))) {
console.error(`Scenarios directory does not exist: ${scenariosDirectory}`);
return;
}
for await (const file of getFiles(scenariosDirectory)) {
if (!file.endsWith(".json")) {
continue;
}
const data: GitHubApiRequest = await readJson(file);
if (!isGetVariantAnalysisRequest(data)) {
continue;
}
if (!data.response.body || !("controller_repo" in data.response.body)) {
continue;
}
console.log(`Adding fields to '${relative(scenariosDirectory, file)}'`);
const variantAnalysis = data.response.body as VariantAnalysis;
if (variantAnalysis.scanned_repositories) {
for (const item of variantAnalysis.scanned_repositories) {
await addFieldsToRepository(item.repository);
}
}
if (variantAnalysis.skipped_repositories?.access_mismatch_repos) {
for (const item of variantAnalysis.skipped_repositories
.access_mismatch_repos.repositories) {
await addFieldsToRepository(item);
}
}
if (variantAnalysis.skipped_repositories?.no_codeql_db_repos) {
for (const item of variantAnalysis.skipped_repositories.no_codeql_db_repos
.repositories) {
await addFieldsToRepository(item);
}
}
if (variantAnalysis.skipped_repositories?.over_limit_repos) {
for (const item of variantAnalysis.skipped_repositories.over_limit_repos
.repositories) {
await addFieldsToRepository(item);
}
}
await writeJson(file, data, { spaces: 2 });
}
}
addFieldsToScenarios().catch((e: unknown) => {
console.error(e);
process.exit(2);
});

View File

@@ -0,0 +1,78 @@
/**
* This scripts helps after recording a scenario to be used for replaying
* with the mock GitHub API server.
*
* Once the scenario has been recorded, it's often useful to remove some of
* the requests to speed up the replay, particularly ones that fetch the
* variant analysis status. Once some of the requests have manually been
* removed, this script can be used to update the numbering of the files.
*
* Usage: npx ts-node scripts/fix-scenario-file-numbering.ts <scenario-name>
*/
import { pathExists, readdir, rename, readJson, writeJSON } from "fs-extra";
import { resolve, extname, basename, join } from "path";
if (process.argv.length !== 3) {
console.error("Expected 1 argument - the scenario name");
}
const scenarioName = process.argv[2];
const extensionDirectory = resolve(__dirname, "..");
const scenariosDirectory = resolve(extensionDirectory, "src/mocks/scenarios");
const scenarioDirectory = resolve(scenariosDirectory, scenarioName);
async function fixScenarioFiles() {
console.log(scenarioDirectory);
if (!(await pathExists(scenarioDirectory))) {
console.error(`Scenario directory does not exist: ${scenarioDirectory}`);
return;
}
const files = await readdir(scenarioDirectory);
const orderedFiles = files.sort((a, b) => {
const aNum = parseInt(a.split("-")[0]);
const bNum = parseInt(b.split("-")[0]);
return aNum - bNum;
});
let index = 0;
for (const file of orderedFiles) {
const ext = extname(file);
if (ext === ".json") {
const fileName = basename(file, ext);
const fileCurrentIndex = parseInt(fileName.split("-")[0]);
const fileNameWithoutIndex = fileName.split("-")[1];
if (fileCurrentIndex !== index) {
const newFileName = `${index}-${fileNameWithoutIndex}${ext}`;
const oldFilePath = join(scenarioDirectory, file);
const newFilePath = join(scenarioDirectory, newFileName);
console.log(`Rename: ${oldFilePath} -> ${newFilePath}`);
await rename(oldFilePath, newFilePath);
if (fileNameWithoutIndex === "getVariantAnalysisRepoResult") {
const oldZipFileName = `${fileCurrentIndex}-getVariantAnalysisRepoResult.body.zip`;
const newZipFileName = `${index}-getVariantAnalysisRepoResult.body.zip`;
const oldZipFilePath = join(scenarioDirectory, oldZipFileName);
const newZipFilePath = join(scenarioDirectory, newZipFileName);
console.log(`Rename: ${oldZipFilePath} -> ${newZipFilePath}`);
await rename(oldZipFilePath, newZipFilePath);
const json = await readJson(newFilePath);
json.response.body = `file:${newZipFileName}`;
console.log(`Response.body change to ${json.response.body}`);
await writeJSON(newFilePath, json);
}
}
index++;
}
}
}
fixScenarioFiles().catch((e: unknown) => {
console.error(e);
process.exit(2);
});

View File

@@ -0,0 +1,72 @@
import { pathExists, readFile } from "fs-extra";
import { resolve, relative } from "path";
import Ajv from "ajv";
import { createGenerator } from "ts-json-schema-generator";
import { getFiles } from "./util/files";
const extensionDirectory = resolve(__dirname, "..");
const rootDirectory = resolve(extensionDirectory, "../..");
const scenariosDirectory = resolve(extensionDirectory, "src/mocks/scenarios");
const debug = process.env.RUNNER_DEBUG || process.argv.includes("--debug");
async function lintScenarios() {
const schema = createGenerator({
path: resolve(extensionDirectory, "src/mocks/gh-api-request.ts"),
tsconfig: resolve(extensionDirectory, "tsconfig.json"),
type: "GitHubApiRequest",
skipTypeCheck: true,
topRef: true,
additionalProperties: true,
}).createSchema("GitHubApiRequest");
const ajv = new Ajv();
if (!ajv.validateSchema(schema)) {
throw new Error(`Invalid schema: ${ajv.errorsText()}`);
}
const validate = ajv.compile(schema);
let invalidFiles = 0;
if (!(await pathExists(scenariosDirectory))) {
console.error(`Scenarios directory does not exist: ${scenariosDirectory}`);
// Do not exit with a non-zero status code, as this is not a fatal error.
return;
}
for await (const file of getFiles(scenariosDirectory)) {
if (!file.endsWith(".json")) {
continue;
}
const contents = await readFile(file, "utf8");
const data = JSON.parse(contents);
if (!validate(data)) {
validate.errors?.forEach((error) => {
// https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-error-message
console.log(
`::error file=${relative(rootDirectory, file)}::${
error.instancePath
}: ${error.message}`,
);
});
invalidFiles++;
} else if (debug) {
console.log(`File '${relative(rootDirectory, file)}' is valid`);
}
}
if (invalidFiles > 0) {
process.exit(1);
}
}
lintScenarios().catch((e: unknown) => {
console.error(e);
process.exit(2);
});

View File

@@ -0,0 +1,241 @@
/**
* This scripts helps finding the original source file and line number for a
* given file and line number in the compiled extension. It currently only
* works with released extensions.
*
* Usage: npx ts-node scripts/source-map.ts <version-number> <filename>:<line>:<column>
* For example: npx ts-node scripts/source-map.ts v1.7.8 "/Users/user/.vscode/extensions/github.vscode-codeql-1.7.8/out/extension.js:131164:13"
*
* Alternative usage: npx ts-node scripts/source-map.ts <version-number> <multi-line-stacktrace>
* For example: npx ts-node scripts/source-map.ts v1.7.8 'Error: Failed to find CodeQL distribution.
* at CodeQLCliServer.getCodeQlPath (/Users/user/.vscode/extensions/github.vscode-codeql-1.7.8/out/extension.js:131164:13)
* at CodeQLCliServer.launchProcess (/Users/user/.vscode/extensions/github.vscode-codeql-1.7.8/out/extension.js:131169:24)
* at CodeQLCliServer.runCodeQlCliInternal (/Users/user/.vscode/extensions/github.vscode-codeql-1.7.8/out/extension.js:131194:24)
* at CodeQLCliServer.runJsonCodeQlCliCommand (/Users/user/.vscode/extensions/github.vscode-codeql-1.7.8/out/extension.js:131330:20)
* at CodeQLCliServer.resolveRam (/Users/user/.vscode/extensions/github.vscode-codeql-1.7.8/out/extension.js:131455:12)
* at QueryServerClient2.startQueryServerImpl (/Users/user/.vscode/extensions/github.vscode-codeql-1.7.8/out/extension.js:138618:21)'
*/
import { spawnSync } from "child_process";
import { basename, resolve } from "path";
import { pathExists, readJSON } from "fs-extra";
import { RawSourceMap, SourceMapConsumer } from "source-map";
import { Open } from "unzipper";
if (process.argv.length !== 4) {
console.error(
"Expected 2 arguments - the version number and the filename:line number",
);
}
const stackLineRegex =
/at (?<name>.*)? \((?<file>.*):(?<line>\d+):(?<column>\d+)\)/gm;
const versionNumber = process.argv[2].startsWith("v")
? process.argv[2]
: `v${process.argv[2]}`;
const stacktrace = process.argv[3];
async function extractSourceMap() {
const releaseAssetsDirectory = resolve(
__dirname,
"..",
"release-assets",
versionNumber,
);
const sourceMapsDirectory = resolve(
__dirname,
"..",
"artifacts",
"source-maps",
versionNumber,
);
if (!(await pathExists(sourceMapsDirectory))) {
console.log("Downloading source maps...");
const release = runGhJSON<Release>([
"release",
"view",
versionNumber,
"--json",
"id,name,assets",
]);
const sourcemapAsset = release.assets.find(
(asset) => asset.name === `vscode-codeql-sourcemaps-${versionNumber}.zip`,
);
if (sourcemapAsset) {
// This downloads a ZIP file of the source maps
runGh([
"release",
"download",
versionNumber,
"--pattern",
sourcemapAsset.name,
"--dir",
releaseAssetsDirectory,
]);
const file = await Open.file(
resolve(releaseAssetsDirectory, sourcemapAsset.name),
);
await file.extract({ path: sourceMapsDirectory });
} else {
const workflowRuns = runGhJSON<WorkflowRunListItem[]>([
"run",
"list",
"--workflow",
"release.yml",
"--branch",
versionNumber,
"--json",
"databaseId,number",
]);
if (workflowRuns.length !== 1) {
throw new Error(
`Expected exactly one workflow run for ${versionNumber}, got ${workflowRuns.length}`,
);
}
const workflowRun = workflowRuns[0];
runGh([
"run",
"download",
workflowRun.databaseId.toString(),
"--name",
"vscode-codeql-sourcemaps",
"--dir",
sourceMapsDirectory,
]);
}
}
if (stacktrace.includes("at")) {
const rawSourceMaps = new Map<string, RawSourceMap>();
const mappedStacktrace = await replaceAsync(
stacktrace,
stackLineRegex,
async (match, name, file, line, column) => {
if (!rawSourceMaps.has(file)) {
const rawSourceMap: RawSourceMap = await readJSON(
resolve(sourceMapsDirectory, `${basename(file)}.map`),
);
rawSourceMaps.set(file, rawSourceMap);
}
const originalPosition = await SourceMapConsumer.with(
rawSourceMaps.get(file) as RawSourceMap,
null,
async function (consumer) {
return consumer.originalPositionFor({
line: parseInt(line, 10),
column: parseInt(column, 10),
});
},
);
if (!originalPosition.source) {
return match;
}
const originalFilename = resolve(file, "..", originalPosition.source);
return `at ${originalPosition.name ?? name} (${originalFilename}:${
originalPosition.line
}:${originalPosition.column})`;
},
);
console.log(mappedStacktrace);
} else {
// This means it's just a filename:line:column
const [filename, line, column] = stacktrace.split(":", 3);
const fileBasename = basename(filename);
const sourcemapName = `${fileBasename}.map`;
const sourcemapPath = resolve(sourceMapsDirectory, sourcemapName);
if (!(await pathExists(sourcemapPath))) {
throw new Error(`No source map found for ${fileBasename}`);
}
const rawSourceMap: RawSourceMap = await readJSON(sourcemapPath);
const originalPosition = await SourceMapConsumer.with(
rawSourceMap,
null,
async function (consumer) {
return consumer.originalPositionFor({
line: parseInt(line, 10),
column: parseInt(column, 10),
});
},
);
if (!originalPosition.source) {
throw new Error(`No source found for ${stacktrace}`);
}
const originalFilename = resolve(filename, "..", originalPosition.source);
console.log(
`${originalFilename}:${originalPosition.line}:${originalPosition.column}`,
);
}
}
extractSourceMap().catch((e: unknown) => {
console.error(e);
process.exit(2);
});
function runGh(args: readonly string[]): string {
const gh = spawnSync("gh", args);
if (gh.status !== 0) {
throw new Error(
`Failed to get the source map for ${versionNumber}: ${gh.stderr}`,
);
}
return gh.stdout.toString("utf-8");
}
function runGhJSON<T>(args: readonly string[]): T {
return JSON.parse(runGh(args));
}
type ReleaseAsset = {
id: string;
name: string;
};
type Release = {
id: string;
name: string;
assets: ReleaseAsset[];
};
type WorkflowRunListItem = {
databaseId: number;
number: number;
};
async function replaceAsync(
str: string,
regex: RegExp,
replacer: (substring: string, ...args: any[]) => Promise<string>,
) {
const promises: Array<Promise<string>> = [];
str.replace(regex, (match, ...args) => {
const promise = replacer(match, ...args);
promises.push(promise);
return match;
});
const data = await Promise.all(promises);
return str.replace(regex, () => data.shift() as string);
}

View File

@@ -0,0 +1,10 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "../tsconfig.json",
"include": ["**/*.ts"],
"exclude": [],
"compilerOptions": {
"rootDir": "..",
"noEmit": true
}
}

View File

@@ -0,0 +1,15 @@
import { readdir } from "fs-extra";
import { resolve } from "path";
// https://stackoverflow.com/a/45130990
export async function* getFiles(dir: string): AsyncGenerator<string> {
const dirents = await readdir(dir, { withFileTypes: true });
for (const dirent of dirents) {
const res = resolve(dir, dirent.name);
if (dirent.isDirectory()) {
yield* getFiles(res);
} else {
yield res;
}
}
}

View File

@@ -0,0 +1,165 @@
import {
WebviewPanel,
ExtensionContext,
window as Window,
ViewColumn,
Uri,
WebviewPanelOptions,
WebviewOptions,
} from "vscode";
import { join } from "path";
import { DisposableObject, DisposeHandler } from "./pure/disposable-object";
import { tmpDir } from "./helpers";
import {
getHtmlForWebview,
WebviewMessage,
WebviewView,
} from "./interface-utils";
export type WebviewPanelConfig = {
viewId: string;
title: string;
viewColumn: ViewColumn;
view: WebviewView;
preserveFocus?: boolean;
additionalOptions?: WebviewPanelOptions & WebviewOptions;
allowWasmEval?: boolean;
};
export abstract class AbstractWebview<
ToMessage extends WebviewMessage,
FromMessage extends WebviewMessage,
> extends DisposableObject {
protected panel: WebviewPanel | undefined;
protected panelLoaded = false;
protected panelLoadedCallBacks: Array<() => void> = [];
private panelResolves?: Array<(panel: WebviewPanel) => void>;
constructor(protected readonly ctx: ExtensionContext) {
super();
}
public async restoreView(panel: WebviewPanel): Promise<void> {
this.panel = panel;
const config = await this.getPanelConfig();
this.setupPanel(panel, config);
}
protected get isShowingPanel() {
return !!this.panel;
}
protected async getPanel(): Promise<WebviewPanel> {
if (this.panel === undefined) {
const { ctx } = this;
// This is an async method, so in theory this method can be called concurrently. To ensure that we don't
// create two panels, we use a promise that resolves when the panel is created. This way, if the panel is
// being created, the promise will resolve when it is done.
if (this.panelResolves !== undefined) {
return new Promise((resolve) => {
if (this.panel !== undefined) {
resolve(this.panel);
return;
}
this.panelResolves?.push(resolve);
});
}
this.panelResolves = [];
const config = await this.getPanelConfig();
const panel = Window.createWebviewPanel(
config.viewId,
config.title,
{ viewColumn: config.viewColumn, preserveFocus: config.preserveFocus },
{
enableScripts: true,
enableFindWidget: true,
retainContextWhenHidden: true,
...config.additionalOptions,
localResourceRoots: [
...(config.additionalOptions?.localResourceRoots ?? []),
Uri.file(tmpDir.name),
Uri.file(join(ctx.extensionPath, "out")),
],
},
);
this.panel = panel;
this.setupPanel(panel, config);
this.panelResolves.forEach((resolve) => resolve(panel));
this.panelResolves = undefined;
}
return this.panel;
}
protected setupPanel(panel: WebviewPanel, config: WebviewPanelConfig): void {
this.push(
panel.onDidDispose(
() => {
this.panel = undefined;
this.panelLoaded = false;
this.onPanelDispose();
},
null,
this.ctx.subscriptions,
),
);
panel.webview.html = getHtmlForWebview(
this.ctx,
panel.webview,
config.view,
{
allowInlineStyles: true,
allowWasmEval: !!config.allowWasmEval,
},
);
this.push(
panel.webview.onDidReceiveMessage(
async (e) => this.onMessage(e),
undefined,
this.ctx.subscriptions,
),
);
}
protected abstract getPanelConfig():
| WebviewPanelConfig
| Promise<WebviewPanelConfig>;
protected abstract onPanelDispose(): void;
protected abstract onMessage(msg: FromMessage): Promise<void>;
protected waitForPanelLoaded(): Promise<void> {
return new Promise((resolve) => {
if (this.panelLoaded) {
resolve();
} else {
this.panelLoadedCallBacks.push(resolve);
}
});
}
protected onWebViewLoaded(): void {
this.panelLoaded = true;
this.panelLoadedCallBacks.forEach((cb) => cb());
this.panelLoadedCallBacks = [];
}
protected async postMessage(msg: ToMessage): Promise<boolean> {
const panel = await this.getPanel();
return panel.webview.postMessage(msg);
}
public dispose(disposeHandler?: DisposeHandler) {
this.panel?.dispose();
super.dispose(disposeHandler);
}
}

View File

@@ -1,12 +1,12 @@
import * as fs from 'fs-extra';
import * as unzipper from 'unzipper';
import * as vscode from 'vscode';
import { logger } from './logging';
import { pathExists } from "fs-extra";
import * as unzipper from "unzipper";
import * as vscode from "vscode";
import { extLogger } from "./common";
// All path operations in this file must be on paths *within* the zip
// archive.
import * as _path from 'path';
const path = _path.posix;
import { posix } from "path";
const path = posix;
export class File implements vscode.FileStat {
type: vscode.FileType;
@@ -72,19 +72,20 @@ export function encodeSourceArchiveUri(ref: ZipFileReference): vscode.Uri {
// Since we will use an authority component, we add a leading slash if necessary
// (paths on Windows usually start with the drive letter).
let sourceArchiveZipPathStartIndex: number;
if (encodedPath.startsWith('/')) {
if (encodedPath.startsWith("/")) {
sourceArchiveZipPathStartIndex = 0;
} else {
encodedPath = '/' + encodedPath;
encodedPath = `/${encodedPath}`;
sourceArchiveZipPathStartIndex = 1;
}
// The authority component of the URI records the 0-based inclusive start and exclusive end index
// of the source archive zip path within the path component of the resulting URI.
// This lets us separate the paths, ignoring the leading slash if we added one.
const sourceArchiveZipPathEndIndex = sourceArchiveZipPathStartIndex + sourceArchiveZipPath.length;
const sourceArchiveZipPathEndIndex =
sourceArchiveZipPathStartIndex + sourceArchiveZipPath.length;
const authority = `${sourceArchiveZipPathStartIndex}-${sourceArchiveZipPathEndIndex}`;
return vscode.Uri.parse(zipArchiveScheme + ':/', true).with({
return vscode.Uri.parse(`${zipArchiveScheme}:/`, true).with({
path: encodedPath,
authority,
});
@@ -99,7 +100,7 @@ export function encodeSourceArchiveUri(ref: ZipFileReference): vscode.Uri {
export function encodeArchiveBasePath(sourceArchiveZipPath: string) {
return encodeSourceArchiveUri({
sourceArchiveZipPath,
pathWithinSourceArchive: ''
pathWithinSourceArchive: "",
});
}
@@ -107,7 +108,9 @@ const sourceArchiveUriAuthorityPattern = /^(\d+)-(\d+)$/;
class InvalidSourceArchiveUriError extends Error {
constructor(uri: vscode.Uri) {
super(`Can't decode uri ${uri}: authority should be of the form startIndex-endIndex (where both indices are integers).`);
super(
`Can't decode uri ${uri}: authority should be of the form startIndex-endIndex (where both indices are integers).`,
);
}
}
@@ -115,22 +118,26 @@ class InvalidSourceArchiveUriError extends Error {
export function decodeSourceArchiveUri(uri: vscode.Uri): ZipFileReference {
if (!uri.authority) {
// Uri is malformed, but this is recoverable
void logger.log(`Warning: ${new InvalidSourceArchiveUriError(uri).message}`);
void extLogger.log(
`Warning: ${new InvalidSourceArchiveUriError(uri).message}`,
);
return {
pathWithinSourceArchive: '/',
sourceArchiveZipPath: uri.path
pathWithinSourceArchive: "/",
sourceArchiveZipPath: uri.path,
};
}
const match = sourceArchiveUriAuthorityPattern.exec(uri.authority);
if (match === null)
throw new InvalidSourceArchiveUriError(uri);
if (match === null) throw new InvalidSourceArchiveUriError(uri);
const zipPathStartIndex = parseInt(match[1]);
const zipPathEndIndex = parseInt(match[2]);
if (isNaN(zipPathStartIndex) || isNaN(zipPathEndIndex))
throw new InvalidSourceArchiveUriError(uri);
return {
pathWithinSourceArchive: uri.path.substring(zipPathEndIndex) || '/',
sourceArchiveZipPath: uri.path.substring(zipPathStartIndex, zipPathEndIndex),
pathWithinSourceArchive: uri.path.substring(zipPathEndIndex) || "/",
sourceArchiveZipPath: uri.path.substring(
zipPathStartIndex,
zipPathEndIndex,
),
};
}
@@ -139,9 +146,9 @@ export function decodeSourceArchiveUri(uri: vscode.Uri): ZipFileReference {
*/
function ensureFile(map: DirectoryHierarchyMap, file: string) {
const dirname = path.dirname(file);
if (dirname === '.') {
if (dirname === ".") {
const error = `Ill-formed path ${file} in zip archive (expected absolute path)`;
void logger.log(error);
void extLogger.log(error);
throw new Error(error);
}
ensureDir(map, dirname);
@@ -154,8 +161,9 @@ function ensureFile(map: DirectoryHierarchyMap, file: string) {
function ensureDir(map: DirectoryHierarchyMap, dir: string) {
const parent = path.dirname(dir);
if (!map.has(dir)) {
map.set(dir, new Map);
if (dir !== parent) { // not the root directory
map.set(dir, new Map());
if (dir !== parent) {
// not the root directory
ensureDir(map, parent);
map.get(parent)!.set(path.basename(dir), vscode.FileType.Directory);
}
@@ -167,22 +175,33 @@ type Archive = {
dirMap: DirectoryHierarchyMap;
};
async function parse_zip(zipPath: string): Promise<Archive> {
if (!(await pathExists(zipPath)))
throw vscode.FileSystemError.FileNotFound(zipPath);
const archive: Archive = {
unzipped: await unzipper.Open.file(zipPath),
dirMap: new Map(),
};
archive.unzipped.files.forEach((f) => {
ensureFile(archive.dirMap, path.resolve("/", f.path));
});
return archive;
}
export class ArchiveFileSystemProvider implements vscode.FileSystemProvider {
private readOnlyError = vscode.FileSystemError.NoPermissions('write operation attempted, but source archive filesystem is readonly');
private archives: Map<string, Archive> = new Map;
private readOnlyError = vscode.FileSystemError.NoPermissions(
"write operation attempted, but source archive filesystem is readonly",
);
private archives: Map<string, Promise<Archive>> = new Map();
private async getArchive(zipPath: string): Promise<Archive> {
if (!this.archives.has(zipPath)) {
if (!await fs.pathExists(zipPath))
throw vscode.FileSystemError.FileNotFound(zipPath);
const archive: Archive = { unzipped: await unzipper.Open.file(zipPath), dirMap: new Map };
archive.unzipped.files.forEach(f => { ensureFile(archive.dirMap, path.resolve('/', f.path)); });
this.archives.set(zipPath, archive);
this.archives.set(zipPath, parse_zip(zipPath));
}
return this.archives.get(zipPath)!;
return await this.archives.get(zipPath)!;
}
root = new Directory('');
root = new Directory("");
// metadata
@@ -190,11 +209,14 @@ export class ArchiveFileSystemProvider implements vscode.FileSystemProvider {
return await this._lookup(uri);
}
async readDirectory(uri: vscode.Uri): Promise<[string, vscode.FileType][]> {
async readDirectory(
uri: vscode.Uri,
): Promise<Array<[string, vscode.FileType]>> {
const ref = decodeSourceArchiveUri(uri);
const archive = await this.getArchive(ref.sourceArchiveZipPath);
const contents = archive.dirMap.get(ref.pathWithinSourceArchive);
const result = contents === undefined ? undefined : Array.from(contents.entries());
const result =
contents === undefined ? undefined : Array.from(contents.entries());
if (result === undefined) {
throw vscode.FileSystemError.FileNotFound(uri);
}
@@ -213,11 +235,19 @@ export class ArchiveFileSystemProvider implements vscode.FileSystemProvider {
// write operations, all disabled
writeFile(_uri: vscode.Uri, _content: Uint8Array, _options: { create: boolean; overwrite: boolean }): void {
writeFile(
_uri: vscode.Uri,
_content: Uint8Array,
_options: { create: boolean; overwrite: boolean },
): void {
throw this.readOnlyError;
}
rename(_oldUri: vscode.Uri, _newUri: vscode.Uri, _options: { overwrite: boolean }): void {
rename(
_oldUri: vscode.Uri,
_newUri: vscode.Uri,
_options: { overwrite: boolean },
): void {
throw this.readOnlyError;
}
@@ -239,18 +269,18 @@ export class ArchiveFileSystemProvider implements vscode.FileSystemProvider {
// use '/' as path separator throughout
const reqPath = ref.pathWithinSourceArchive;
const file = archive.unzipped.files.find(
f => {
const absolutePath = path.resolve('/', f.path);
return absolutePath === reqPath
|| absolutePath === path.join('/src_archive', reqPath);
}
);
const file = archive.unzipped.files.find((f) => {
const absolutePath = path.resolve("/", f.path);
return (
absolutePath === reqPath ||
absolutePath === path.join("/src_archive", reqPath)
);
});
if (file !== undefined) {
if (file.type === 'File') {
if (file.type === "File") {
return new File(reqPath, await file.buffer());
}
else { // file.type === 'Directory'
} else {
// file.type === 'Directory'
// I haven't observed this case in practice. Could it happen
// with a zip file that contains empty directories?
return new Directory(reqPath);
@@ -259,7 +289,11 @@ export class ArchiveFileSystemProvider implements vscode.FileSystemProvider {
if (archive.dirMap.has(reqPath)) {
return new Directory(reqPath);
}
throw vscode.FileSystemError.FileNotFound(`uri '${uri.toString()}', interpreted as '${reqPath}' in archive '${ref.sourceArchiveZipPath}'`);
throw vscode.FileSystemError.FileNotFound(
`uri '${uri.toString()}', interpreted as '${reqPath}' in archive '${
ref.sourceArchiveZipPath
}'`,
);
}
private async _lookupAsFile(uri: vscode.Uri): Promise<File> {
@@ -274,11 +308,14 @@ export class ArchiveFileSystemProvider implements vscode.FileSystemProvider {
private _emitter = new vscode.EventEmitter<vscode.FileChangeEvent[]>();
readonly onDidChangeFile: vscode.Event<vscode.FileChangeEvent[]> = this._emitter.event;
readonly onDidChangeFile: vscode.Event<vscode.FileChangeEvent[]> =
this._emitter.event;
watch(_resource: vscode.Uri): vscode.Disposable {
// ignore, fires for all changes...
return new vscode.Disposable(() => { /**/ });
return new vscode.Disposable(() => {
/**/
});
}
}
@@ -290,15 +327,17 @@ export class ArchiveFileSystemProvider implements vscode.FileSystemProvider {
* (cf. https://www.ietf.org/rfc/rfc2396.txt (Appendix A, page 26) for
* the fact that hyphens are allowed in uri schemes)
*/
export const zipArchiveScheme = 'codeql-zip-archive';
export const zipArchiveScheme = "codeql-zip-archive";
export function activate(ctx: vscode.ExtensionContext) {
ctx.subscriptions.push(vscode.workspace.registerFileSystemProvider(
zipArchiveScheme,
new ArchiveFileSystemProvider(),
{
isCaseSensitive: true,
isReadonly: true,
}
));
ctx.subscriptions.push(
vscode.workspace.registerFileSystemProvider(
zipArchiveScheme,
new ArchiveFileSystemProvider(),
{
isCaseSensitive: true,
isReadonly: true,
},
),
);
}

View File

@@ -0,0 +1,72 @@
import { Uri, window } from "vscode";
import { withProgress } from "./progress";
import { AstViewer } from "./astViewer";
import {
TemplatePrintAstProvider,
TemplatePrintCfgProvider,
} from "./contextual/templateProvider";
import { AstCfgCommands } from "./common/commands";
import { LocalQueries } from "./local-queries";
type AstCfgOptions = {
localQueries: LocalQueries;
astViewer: AstViewer;
astTemplateProvider: TemplatePrintAstProvider;
cfgTemplateProvider: TemplatePrintCfgProvider;
};
export function getAstCfgCommands({
localQueries,
astViewer,
astTemplateProvider,
cfgTemplateProvider,
}: AstCfgOptions): AstCfgCommands {
const viewAst = async (selectedFile: Uri) =>
withProgress(
async (progress, token) => {
const ast = await astTemplateProvider.provideAst(
progress,
token,
selectedFile ?? window.activeTextEditor?.document.uri,
);
if (ast) {
astViewer.updateRoots(await ast.getRoots(), ast.db, ast.fileName);
}
},
{
cancellable: true,
title: "Calculate AST",
},
);
const viewCfg = async () =>
withProgress(
async (progress, token) => {
const res = await cfgTemplateProvider.provideCfgUri(
window.activeTextEditor?.document,
);
if (res) {
await localQueries.compileAndRunQuery(
false,
res[0],
progress,
token,
undefined,
);
}
},
{
title: "Calculating Control Flow Graph",
cancellable: true,
},
);
return {
"codeQL.viewAst": viewAst,
"codeQL.viewAstContextExplorer": viewAst,
"codeQL.viewAstContextEditor": viewAst,
"codeQL.viewCfg": viewCfg,
"codeQL.viewCfgContextExplorer": viewCfg,
"codeQL.viewCfgContextEditor": viewCfg,
};
}

View File

@@ -11,17 +11,23 @@ import {
TextEditorSelectionChangeKind,
Location,
Range,
Uri
} from 'vscode';
import * as path from 'path';
Uri,
} from "vscode";
import { basename } from "path";
import { DatabaseItem } from './databases';
import { UrlValue, BqrsId } from './pure/bqrs-cli-types';
import { showLocation } from './interface-utils';
import { isStringLoc, isWholeFileLoc, isLineColumnLoc } from './pure/bqrs-utils';
import { commandRunner } from './commandRunner';
import { DisposableObject } from './pure/disposable-object';
import { showAndLogErrorMessage } from './helpers';
import { DatabaseItem } from "./local-databases";
import { UrlValue, BqrsId } from "./pure/bqrs-cli-types";
import { showLocation } from "./interface-utils";
import {
isStringLoc,
isWholeFileLoc,
isLineColumnLoc,
} from "./pure/bqrs-utils";
import { DisposableObject } from "./pure/disposable-object";
import { showAndLogExceptionWithTelemetry } from "./helpers";
import { asError, getErrorMessage } from "./pure/helpers-pure";
import { redactableError } from "./pure/errors";
import { AstViewerCommands } from "./common/commands";
export interface AstItem {
id: BqrsId;
@@ -36,32 +42,25 @@ export interface ChildAstItem extends AstItem {
parent: ChildAstItem | AstItem;
}
class AstViewerDataProvider extends DisposableObject implements TreeDataProvider<AstItem> {
class AstViewerDataProvider
extends DisposableObject
implements TreeDataProvider<AstItem>
{
public roots: AstItem[] = [];
public db: DatabaseItem | undefined;
private _onDidChangeTreeData =
this.push(new EventEmitter<AstItem | undefined>());
private _onDidChangeTreeData = this.push(
new EventEmitter<AstItem | undefined>(),
);
readonly onDidChangeTreeData: Event<AstItem | undefined> =
this._onDidChangeTreeData.event;
constructor() {
super();
this.push(
commandRunner('codeQLAstViewer.gotoCode',
async (item: AstItem) => {
await showLocation(item.fileLocation);
})
);
}
refresh(): void {
this._onDidChangeTreeData.fire(undefined);
}
getChildren(item?: AstItem): ProviderResult<AstItem[]> {
const children = item ? item.children : this.roots;
return children.sort((c1, c2) => (c1.order - c2.order));
return children.sort((c1, c2) => c1.order - c2.order);
}
getParent(item: ChildAstItem): ProviderResult<AstItem> {
@@ -74,22 +73,22 @@ class AstViewerDataProvider extends DisposableObject implements TreeDataProvider
const state = item.children.length
? TreeItemCollapsibleState.Collapsed
: TreeItemCollapsibleState.None;
const treeItem = new TreeItem(item.label || '', state);
treeItem.description = line ? `Line ${line}` : '';
const treeItem = new TreeItem(item.label || "", state);
treeItem.description = line ? `Line ${line}` : "";
treeItem.id = String(item.id);
treeItem.tooltip = `${treeItem.description} ${treeItem.label}`;
treeItem.command = {
command: 'codeQLAstViewer.gotoCode',
title: 'Go To Code',
command: "codeQLAstViewer.gotoCode",
title: "Go To Code",
tooltip: `Go To ${item.location}`,
arguments: [item]
arguments: [item],
};
return treeItem;
}
private extractLineInfo(loc?: UrlValue) {
if (!loc) {
return '';
return "";
} else if (isStringLoc(loc)) {
return loc;
} else if (isWholeFileLoc(loc)) {
@@ -97,7 +96,7 @@ class AstViewerDataProvider extends DisposableObject implements TreeDataProvider
} else if (isLineColumnLoc(loc)) {
return loc.startLine;
} else {
return '';
return "";
}
}
}
@@ -111,32 +110,45 @@ export class AstViewer extends DisposableObject {
super();
this.treeDataProvider = new AstViewerDataProvider();
this.treeView = window.createTreeView('codeQLAstViewer', {
this.treeView = window.createTreeView("codeQLAstViewer", {
treeDataProvider: this.treeDataProvider,
showCollapseAll: true
showCollapseAll: true,
});
this.push(this.treeView);
this.push(this.treeDataProvider);
this.push(
commandRunner('codeQLAstViewer.clear', async () => {
this.clear();
})
window.onDidChangeTextEditorSelection(this.updateTreeSelection, this),
);
this.push(window.onDidChangeTextEditorSelection(this.updateTreeSelection, this));
}
getCommands(): AstViewerCommands {
return {
"codeQLAstViewer.clear": async () => this.clear(),
"codeQLAstViewer.gotoCode": async (item: AstItem) => {
await showLocation(item.fileLocation);
},
};
}
updateRoots(roots: AstItem[], db: DatabaseItem, fileUri: Uri) {
this.treeDataProvider.roots = roots;
this.treeDataProvider.db = db;
this.treeDataProvider.refresh();
this.treeView.message = `AST for ${path.basename(fileUri.fsPath)}`;
this.treeView.message = `AST for ${basename(fileUri.fsPath)}`;
this.currentFileUri = fileUri;
// Handle error on reveal. This could happen if
// the tree view is disposed during the reveal.
this.treeView.reveal(roots[0], { focus: false })?.then(
() => { /**/ },
err => showAndLogErrorMessage(err)
() => {
/**/
},
(error: unknown) =>
showAndLogExceptionWithTelemetry(
redactableError(
asError(error),
)`Failed to reveal AST: ${getErrorMessage(error)}`,
),
);
}
@@ -149,7 +161,10 @@ export class AstViewer extends DisposableObject {
// range that contains the selection.
// Some nodes do not have a location, but their children might, so must
// recurse though location-less AST nodes to see if children are correct.
function findBest(selectedRange: Range, items?: AstItem[]): AstItem | undefined {
function findBest(
selectedRange: Range,
items?: AstItem[],
): AstItem | undefined {
if (!items || !items.length) {
return;
}
@@ -188,8 +203,15 @@ export class AstViewer extends DisposableObject {
// Handle error on reveal. This could happen if
// the tree view is disposed during the reveal.
this.treeView.reveal(targetItem)?.then(
() => { /**/ },
err => showAndLogErrorMessage(err)
() => {
/**/
},
(error: unknown) =>
showAndLogExceptionWithTelemetry(
redactableError(
asError(error),
)`Failed to reveal AST: ${getErrorMessage(error)}`,
),
);
}
}

View File

@@ -1,62 +1,60 @@
import * as vscode from 'vscode';
import * as Octokit from '@octokit/rest';
import * as vscode from "vscode";
import * as Octokit from "@octokit/rest";
import { retry } from "@octokit/plugin-retry";
import { Credentials } from "./common/authentication";
const GITHUB_AUTH_PROVIDER_ID = 'github';
const GITHUB_AUTH_PROVIDER_ID = "github";
// 'repo' scope should be enough for triggering workflows. For a comprehensive list, see:
// We need 'repo' scope for triggering workflows, 'gist' scope for exporting results to Gist,
// and 'read:packages' for reading private CodeQL packages.
// For a comprehensive list of scopes, see:
// https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps
const SCOPES = ['repo'];
const SCOPES = ["repo", "gist", "read:packages"];
/**
/**
* Handles authentication to GitHub, using the VS Code [authentication API](https://code.visualstudio.com/api/references/vscode-api#authentication).
*/
export class Credentials {
export class VSCodeCredentials implements Credentials {
/**
* A specific octokit to return, otherwise a new authenticated octokit will be created when needed.
*/
private octokit: Octokit.Octokit | undefined;
// Explicitly make the constructor private, so that we can't accidentally call the constructor from outside the class
// without also initializing the class.
// eslint-disable-next-line @typescript-eslint/no-empty-function
private constructor() { }
static async initialize(context: vscode.ExtensionContext): Promise<Credentials> {
const c = new Credentials();
c.registerListeners(context);
c.octokit = await c.createOctokit(false);
return c;
}
private async createOctokit(createIfNone: boolean): Promise<Octokit.Octokit | undefined> {
const session = await vscode.authentication.getSession(GITHUB_AUTH_PROVIDER_ID, SCOPES, { createIfNone });
if (session) {
return new Octokit.Octokit({
auth: session.accessToken
});
} else {
return undefined;
}
}
registerListeners(context: vscode.ExtensionContext): void {
// Sessions are changed when a user logs in or logs out.
context.subscriptions.push(vscode.authentication.onDidChangeSessions(async e => {
if (e.provider.id === GITHUB_AUTH_PROVIDER_ID) {
this.octokit = await this.createOctokit(false);
}
}));
}
/**
* Creates or returns an instance of Octokit.
*
* @returns An instance of Octokit.
*/
async getOctokit(): Promise<Octokit.Octokit> {
if (this.octokit) {
return this.octokit;
}
this.octokit = await this.createOctokit(true);
// octokit shouldn't be undefined, since we've set "createIfNone: true".
// The following block is mainly here to prevent a compiler error.
if (!this.octokit) {
throw new Error('Did not initialize Octokit.');
}
return this.octokit;
const accessToken = await this.getAccessToken();
return new Octokit.Octokit({
auth: accessToken,
retry,
});
}
async getAccessToken(): Promise<string> {
const session = await vscode.authentication.getSession(
GITHUB_AUTH_PROVIDER_ID,
SCOPES,
{ createIfNone: true },
);
return session.accessToken;
}
async getExistingAccessToken(): Promise<string | undefined> {
const session = await vscode.authentication.getSession(
GITHUB_AUTH_PROVIDER_ID,
SCOPES,
{ createIfNone: false },
);
return session?.accessToken;
}
}

View File

@@ -1,25 +1,30 @@
import * as semver from 'semver';
import { runCodeQlCliCommand } from './cli';
import { Logger } from './logging';
import { getErrorMessage } from './pure/helpers-pure';
import * as semver from "semver";
import { runCodeQlCliCommand } from "./cli";
import { Logger } from "./common";
import { getErrorMessage } from "./pure/helpers-pure";
/**
* Get the version of a CodeQL CLI.
*/
export async function getCodeQlCliVersion(codeQlPath: string, logger: Logger): Promise<semver.SemVer | undefined> {
export async function getCodeQlCliVersion(
codeQlPath: string,
logger: Logger,
): Promise<semver.SemVer | undefined> {
try {
const output: string = await runCodeQlCliCommand(
codeQlPath,
['version'],
['--format=terse'],
'Checking CodeQL version',
logger
["version"],
["--format=terse"],
"Checking CodeQL version",
logger,
);
return semver.parse(output.trim()) || undefined;
} catch (e) {
// Failed to run the version command. This might happen if the cli version is _really_ old, or it is corrupted.
// Either way, we can't determine compatibility.
void logger.log(`Failed to run 'codeql version'. Reason: ${getErrorMessage(e)}`);
void logger.log(
`Failed to run 'codeql version'. Reason: ${getErrorMessage(e)}`,
);
return undefined;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,246 +0,0 @@
import {
CancellationToken,
ProgressOptions,
window as Window,
commands,
Disposable,
ProgressLocation
} from 'vscode';
import { showAndLogErrorMessage, showAndLogWarningMessage } from './helpers';
import { logger } from './logging';
import { getErrorMessage, getErrorStack } from './pure/helpers-pure';
import { telemetryListener } from './telemetry';
export class UserCancellationException extends Error {
/**
* @param message The error message
* @param silent If silent is true, then this exception will avoid showing a warning message to the user.
*/
constructor(message?: string, public readonly silent = false) {
super(message);
}
}
export interface ProgressUpdate {
/**
* The current step
*/
step: number;
/**
* The maximum step. This *should* be constant for a single job.
*/
maxStep: number;
/**
* The current progress message
*/
message: string;
}
export type ProgressCallback = (p: ProgressUpdate) => void;
/**
* A task that handles command invocations from `commandRunner`
* and includes a progress monitor.
*
*
* Arguments passed to the command handler are passed along,
* untouched to this `ProgressTask` instance.
*
* @param progress a progress handler function. Call this
* function with a `ProgressUpdate` instance in order to
* denote some progress being achieved on this task.
* @param token a cencellation token
* @param args arguments passed to this task passed on from
* `commands.registerCommand`.
*/
export type ProgressTask<R> = (
progress: ProgressCallback,
token: CancellationToken,
...args: any[]
) => Thenable<R>;
/**
* A task that handles command invocations from `commandRunner`.
* Arguments passed to the command handler are passed along,
* untouched to this `NoProgressTask` instance.
*
* @param args arguments passed to this task passed on from
* `commands.registerCommand`.
*/
type NoProgressTask = ((...args: any[]) => Promise<any>);
/**
* This mediates between the kind of progress callbacks we want to
* write (where we *set* current progress position and give
* `maxSteps`) and the kind vscode progress api expects us to write
* (which increment progress by a certain amount out of 100%).
*
* Where possible, the `commandRunner` function below should be used
* instead of this function. The commandRunner is meant for wrapping
* top-level commands and provides error handling and other support
* automatically.
*
* Only use this function if you need a progress monitor and the
* control flow does not always come from a command (eg- during
* extension activation, or from an internal language server
* request).
*/
export function withProgress<R>(
options: ProgressOptions,
task: ProgressTask<R>,
...args: any[]
): Thenable<R> {
let progressAchieved = 0;
return Window.withProgress(options,
(progress, token) => {
return task(p => {
const { message, step, maxStep } = p;
const increment = 100 * (step - progressAchieved) / maxStep;
progressAchieved = step;
progress.report({ message, increment });
}, token, ...args);
});
}
/**
* A generic wrapper for command registration. This wrapper adds uniform error handling for commands.
*
* In this variant of the command runner, no progress monitor is used.
*
* @param commandId The ID of the command to register.
* @param task The task to run. It is passed directly to `commands.registerCommand`. Any
* arguments to the command handler are passed on to the task.
*/
export function commandRunner(
commandId: string,
task: NoProgressTask,
): Disposable {
return commands.registerCommand(commandId, async (...args: any[]) => {
const startTime = Date.now();
let error: Error | undefined;
try {
return await task(...args);
} catch (e) {
const errorMessage = `${getErrorMessage(e) || e} (${commandId})`;
error = e instanceof Error ? e : new Error(errorMessage);
const errorStack = getErrorStack(e);
if (e instanceof UserCancellationException) {
// User has cancelled this action manually
if (e.silent) {
void logger.log(errorMessage);
} else {
void showAndLogWarningMessage(errorMessage);
}
} else {
// Include the full stack in the error log only.
const fullMessage = errorStack
? `${errorMessage}\n${errorStack}`
: errorMessage;
void showAndLogErrorMessage(errorMessage, {
fullMessage
});
}
return undefined;
} finally {
const executionTime = Date.now() - startTime;
telemetryListener.sendCommandUsage(commandId, executionTime, error);
}
});
}
/**
* A generic wrapper for command registration. This wrapper adds uniform error handling,
* progress monitoring, and cancellation for commands.
*
* @param commandId The ID of the command to register.
* @param task The task to run. It is passed directly to `commands.registerCommand`. Any
* arguments to the command handler are passed on to the task after the progress callback
* and cancellation token.
* @param progressOptions Progress options to be sent to the progress monitor.
*/
export function commandRunnerWithProgress<R>(
commandId: string,
task: ProgressTask<R>,
progressOptions: Partial<ProgressOptions>,
outputLogger = logger
): Disposable {
return commands.registerCommand(commandId, async (...args: any[]) => {
const startTime = Date.now();
let error: Error | undefined;
const progressOptionsWithDefaults = {
location: ProgressLocation.Notification,
...progressOptions
};
try {
return await withProgress(progressOptionsWithDefaults, task, ...args);
} catch (e) {
const errorMessage = `${getErrorMessage(e) || e} (${commandId})`;
error = e instanceof Error ? e : new Error(errorMessage);
const errorStack = getErrorStack(e);
if (e instanceof UserCancellationException) {
// User has cancelled this action manually
if (e.silent) {
void outputLogger.log(errorMessage);
} else {
void showAndLogWarningMessage(errorMessage, { outputLogger });
}
} else {
// Include the full stack in the error log only.
const fullMessage = errorStack
? `${errorMessage}\n${errorStack}`
: errorMessage;
void showAndLogErrorMessage(errorMessage, {
outputLogger,
fullMessage
});
}
return undefined;
} finally {
const executionTime = Date.now() - startTime;
telemetryListener.sendCommandUsage(commandId, executionTime, error);
}
});
}
/**
* Displays a progress monitor that indicates how much progess has been made
* reading from a stream.
*
* @param readable The stream to read progress from
* @param messagePrefix A prefix for displaying the message
* @param totalNumBytes Total number of bytes in this stream
* @param progress The progress callback used to set messages
*/
export function reportStreamProgress(
readable: NodeJS.ReadableStream,
messagePrefix: string,
totalNumBytes?: number,
progress?: ProgressCallback
) {
if (progress && totalNumBytes) {
let numBytesDownloaded = 0;
const bytesToDisplayMB = (numBytes: number): string => `${(numBytes / (1024 * 1024)).toFixed(1)} MB`;
const updateProgress = () => {
progress({
step: numBytesDownloaded,
maxStep: totalNumBytes,
message: `${messagePrefix} [${bytesToDisplayMB(numBytesDownloaded)} of ${bytesToDisplayMB(totalNumBytes)}]`,
});
};
// Display the progress straight away rather than waiting for the first chunk.
updateProgress();
readable.on('data', data => {
numBytesDownloaded += data.length;
updateProgress();
});
} else if (progress) {
progress({
step: 1,
maxStep: 2,
message: `${messagePrefix} (Size unknown)`,
});
}
}

View File

@@ -0,0 +1,25 @@
import { Credentials } from "./authentication";
import { Disposable } from "../pure/disposable-object";
import { AppEventEmitter } from "./events";
import { Logger } from "./logging";
import { Memento } from "./memento";
import { AppCommandManager } from "./commands";
export interface App {
createEventEmitter<T>(): AppEventEmitter<T>;
readonly mode: AppMode;
readonly logger: Logger;
readonly subscriptions: Disposable[];
readonly extensionPath: string;
readonly globalStoragePath: string;
readonly workspaceStoragePath?: string;
readonly workspaceState: Memento;
readonly credentials: Credentials;
readonly commands: AppCommandManager;
}
export enum AppMode {
Production = 1,
Development = 2,
Test = 3,
}

View File

@@ -0,0 +1,34 @@
import * as Octokit from "@octokit/rest";
/**
* An interface providing methods for obtaining access tokens
* or an octokit instance for making HTTP requests.
*/
export interface Credentials {
/**
* Returns an authenticated instance of Octokit.
* May prompt the user to log in and grant permission to use their
* token, if they have not already done so.
*
* @returns An instance of Octokit.
*/
getOctokit(): Promise<Octokit.Octokit>;
/**
* Returns an OAuth access token.
* May prompt the user to log in and grant permission to use their
* token, if they have not already done so.
*
* @returns An OAuth access token.
*/
getAccessToken(): Promise<string>;
/**
* Returns an OAuth access token if one is available.
* If a token is not available this will return undefined and
* will not prompt the user to log in.
*
* @returns An OAuth access token, or undefined.
*/
getExistingAccessToken(): Promise<string | undefined>;
}

View File

@@ -0,0 +1,299 @@
import type { CommandManager } from "../packages/commands";
import type { Uri, Range, TextDocumentShowOptions } from "vscode";
import type { AstItem } from "../astViewer";
import type { DbTreeViewItem } from "../databases/ui/db-tree-view-item";
import type { DatabaseItem } from "../local-databases";
import type { QueryHistoryInfo } from "../query-history/query-history-info";
import type { RepositoriesFilterSortStateWithIds } from "../pure/variant-analysis-filter-sort";
import type { TestTreeNode } from "../test-tree-node";
import type {
VariantAnalysis,
VariantAnalysisScannedRepository,
VariantAnalysisScannedRepositoryResult,
} from "../variant-analysis/shared/variant-analysis";
// A command function matching the signature that VS Code calls when
// a command on a selection is invoked.
export type SelectionCommandFunction<Item> = (
singleItem: Item,
multiSelect: Item[],
) => Promise<void>;
// A command function matching the signature that VS Code calls when
// a command on a selection is invoked when canSelectMany is false.
export type SingleSelectionCommandFunction<Item> = (
singleItem: Item,
) => Promise<void>;
/**
* Contains type definitions for all commands used by the extension.
*
* To add a new command first define its type here, then provide
* the implementation in the corresponding `getCommands` function.
*/
// Builtin commands where the implementation is provided by VS Code and not by this extension.
// See https://code.visualstudio.com/api/references/commands
export type BuiltInVsCodeCommands = {
// The codeQLDatabases.focus command is provided by VS Code because we've registered the custom view
"codeQLDatabases.focus": () => Promise<void>;
"markdown.showPreviewToSide": (uri: Uri) => Promise<void>;
revealFileInOS: (uri: Uri) => Promise<void>;
setContext: (
key: `${"codeql" | "codeQL"}${string}`,
value: unknown,
) => Promise<void>;
"workbench.action.reloadWindow": () => Promise<void>;
"vscode.diff": (
leftSideResource: Uri,
rightSideResource: Uri,
title?: string,
columnOrOptions?: TextDocumentShowOptions,
) => Promise<void>;
"vscode.open": (uri: Uri) => Promise<void>;
"vscode.openFolder": (uri: Uri) => Promise<void>;
};
// Commands that are available before the extension is fully activated.
// These commands are *not* registered using the command manager, but can
// be invoked using the command manager.
export type PreActivationCommands = {
"codeQL.checkForUpdatesToCLI": () => Promise<void>;
};
// Base commands not tied directly to a module like e.g. variant analysis.
export type BaseCommands = {
"codeQL.openDocumentation": () => Promise<void>;
"codeQL.showLogs": () => Promise<void>;
"codeQL.authenticateToGitHub": () => Promise<void>;
"codeQL.copyVersion": () => Promise<void>;
"codeQL.restartQueryServer": () => Promise<void>;
"codeQL.restartQueryServerOnConfigChange": () => Promise<void>;
"codeQL.restartLegacyQueryServerOnConfigChange": () => Promise<void>;
};
// Commands used when working with queries in the editor
export type QueryEditorCommands = {
"codeQL.openReferencedFile": (selectedQuery: Uri) => Promise<void>;
"codeQL.openReferencedFileContextEditor": (
selectedQuery: Uri,
) => Promise<void>;
"codeQL.openReferencedFileContextExplorer": (
selectedQuery: Uri,
) => Promise<void>;
"codeQL.previewQueryHelp": (selectedQuery: Uri) => Promise<void>;
};
// Commands used for running local queries
export type LocalQueryCommands = {
"codeQL.runQuery": (uri?: Uri) => Promise<void>;
"codeQL.runQueryContextEditor": (uri?: Uri) => Promise<void>;
"codeQL.runQueryOnMultipleDatabases": (uri?: Uri) => Promise<void>;
"codeQL.runQueryOnMultipleDatabasesContextEditor": (
uri?: Uri,
) => Promise<void>;
"codeQL.runQueries": SelectionCommandFunction<Uri>;
"codeQL.quickEval": (uri: Uri) => Promise<void>;
"codeQL.quickEvalContextEditor": (uri: Uri) => Promise<void>;
"codeQL.codeLensQuickEval": (uri: Uri, range: Range) => Promise<void>;
"codeQL.quickQuery": () => Promise<void>;
};
export type ResultsViewCommands = {
"codeQLQueryResults.up": () => Promise<void>;
"codeQLQueryResults.down": () => Promise<void>;
"codeQLQueryResults.left": () => Promise<void>;
"codeQLQueryResults.right": () => Promise<void>;
"codeQLQueryResults.nextPathStep": () => Promise<void>;
"codeQLQueryResults.previousPathStep": () => Promise<void>;
};
// Commands used for the query history panel
export type QueryHistoryCommands = {
// Commands in the "navigation" group
"codeQLQueryHistory.sortByName": () => Promise<void>;
"codeQLQueryHistory.sortByDate": () => Promise<void>;
"codeQLQueryHistory.sortByCount": () => Promise<void>;
// Commands in the context menu or in the hover menu
"codeQLQueryHistory.openQueryTitleMenu": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.openQueryContextMenu": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.removeHistoryItemTitleMenu": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.removeHistoryItemContextMenu": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.removeHistoryItemContextInline": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.renameItem": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.compareWith": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.showEvalLog": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.showEvalLogSummary": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.showEvalLogViewer": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.showQueryLog": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.showQueryText": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.openQueryDirectory": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.cancel": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.exportResults": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.viewCsvResults": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.viewCsvAlerts": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.viewSarifAlerts": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.viewDil": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.itemClicked": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.openOnGithub": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.copyRepoList": SelectionCommandFunction<QueryHistoryInfo>;
// Commands in the command palette
"codeQL.exportSelectedVariantAnalysisResults": () => Promise<void>;
};
// Commands used for the local databases panel
export type LocalDatabasesCommands = {
// Command palette commands
"codeQL.chooseDatabaseFolder": () => Promise<void>;
"codeQL.chooseDatabaseArchive": () => Promise<void>;
"codeQL.chooseDatabaseInternet": () => Promise<void>;
"codeQL.chooseDatabaseGithub": () => Promise<void>;
"codeQL.upgradeCurrentDatabase": () => Promise<void>;
"codeQL.clearCache": () => Promise<void>;
// Explorer context menu
"codeQL.setCurrentDatabase": (uri: Uri) => Promise<void>;
// Database panel view title commands
"codeQLDatabases.chooseDatabaseFolder": () => Promise<void>;
"codeQLDatabases.chooseDatabaseArchive": () => Promise<void>;
"codeQLDatabases.chooseDatabaseInternet": () => Promise<void>;
"codeQLDatabases.chooseDatabaseGithub": () => Promise<void>;
"codeQLDatabases.sortByName": () => Promise<void>;
"codeQLDatabases.sortByDateAdded": () => Promise<void>;
// Database panel context menu
"codeQLDatabases.setCurrentDatabase": (
databaseItem: DatabaseItem,
) => Promise<void>;
// Database panel selection commands
"codeQLDatabases.removeDatabase": SelectionCommandFunction<DatabaseItem>;
"codeQLDatabases.upgradeDatabase": SelectionCommandFunction<DatabaseItem>;
"codeQLDatabases.renameDatabase": SelectionCommandFunction<DatabaseItem>;
"codeQLDatabases.openDatabaseFolder": SelectionCommandFunction<DatabaseItem>;
"codeQLDatabases.addDatabaseSource": SelectionCommandFunction<DatabaseItem>;
// Codespace template commands
"codeQL.setDefaultTourDatabase": () => Promise<void>;
// Internal commands
"codeQLDatabases.removeOrphanedDatabases": () => Promise<void>;
};
// Commands tied to variant analysis
export type VariantAnalysisCommands = {
"codeQL.autoDownloadVariantAnalysisResult": (
scannedRepo: VariantAnalysisScannedRepository,
variantAnalysisSummary: VariantAnalysis,
) => Promise<void>;
"codeQL.copyVariantAnalysisRepoList": (
variantAnalysisId: number,
filterSort?: RepositoriesFilterSortStateWithIds,
) => Promise<void>;
"codeQL.loadVariantAnalysisRepoResults": (
variantAnalysisId: number,
repositoryFullName: string,
) => Promise<VariantAnalysisScannedRepositoryResult>;
"codeQL.monitorNewVariantAnalysis": (
variantAnalysis: VariantAnalysis,
) => Promise<void>;
"codeQL.monitorRehydratedVariantAnalysis": (
variantAnalysis: VariantAnalysis,
) => Promise<void>;
"codeQL.openVariantAnalysisLogs": (
variantAnalysisId: number,
) => Promise<void>;
"codeQL.openVariantAnalysisView": (
variantAnalysisId: number,
) => Promise<void>;
"codeQL.runVariantAnalysis": (uri?: Uri) => Promise<void>;
"codeQL.runVariantAnalysisContextEditor": (uri?: Uri) => Promise<void>;
};
export type DatabasePanelCommands = {
"codeQLVariantAnalysisRepositories.openConfigFile": () => Promise<void>;
"codeQLVariantAnalysisRepositories.addNewDatabase": () => Promise<void>;
"codeQLVariantAnalysisRepositories.addNewList": () => Promise<void>;
"codeQLVariantAnalysisRepositories.setupControllerRepository": () => Promise<void>;
"codeQLVariantAnalysisRepositories.setSelectedItem": SingleSelectionCommandFunction<DbTreeViewItem>;
"codeQLVariantAnalysisRepositories.setSelectedItemContextMenu": SingleSelectionCommandFunction<DbTreeViewItem>;
"codeQLVariantAnalysisRepositories.openOnGitHubContextMenu": SingleSelectionCommandFunction<DbTreeViewItem>;
"codeQLVariantAnalysisRepositories.renameItemContextMenu": SingleSelectionCommandFunction<DbTreeViewItem>;
"codeQLVariantAnalysisRepositories.removeItemContextMenu": SingleSelectionCommandFunction<DbTreeViewItem>;
};
export type AstCfgCommands = {
"codeQL.viewAst": (selectedFile: Uri) => Promise<void>;
"codeQL.viewAstContextExplorer": (selectedFile: Uri) => Promise<void>;
"codeQL.viewAstContextEditor": (selectedFile: Uri) => Promise<void>;
"codeQL.viewCfg": () => Promise<void>;
"codeQL.viewCfgContextExplorer": () => Promise<void>;
"codeQL.viewCfgContextEditor": () => Promise<void>;
};
export type AstViewerCommands = {
"codeQLAstViewer.clear": () => Promise<void>;
"codeQLAstViewer.gotoCode": (item: AstItem) => Promise<void>;
};
export type PackagingCommands = {
"codeQL.installPackDependencies": () => Promise<void>;
"codeQL.downloadPacks": () => Promise<void>;
};
export type DataExtensionsEditorCommands = {
"codeQL.openDataExtensionsEditor": () => Promise<void>;
};
export type EvalLogViewerCommands = {
"codeQLEvalLogViewer.clear": () => Promise<void>;
};
export type SummaryLanguageSupportCommands = {
"codeQL.gotoQL": () => Promise<void>;
};
export type TestUICommands = {
"codeQLTests.showOutputDifferences": (node: TestTreeNode) => Promise<void>;
"codeQLTests.acceptOutput": (node: TestTreeNode) => Promise<void>;
};
export type MockGitHubApiServerCommands = {
"codeQL.mockGitHubApiServer.startRecording": () => Promise<void>;
"codeQL.mockGitHubApiServer.saveScenario": () => Promise<void>;
"codeQL.mockGitHubApiServer.cancelRecording": () => Promise<void>;
"codeQL.mockGitHubApiServer.loadScenario": () => Promise<void>;
"codeQL.mockGitHubApiServer.unloadScenario": () => Promise<void>;
};
// All commands where the implementation is provided by this activated extension.
export type AllExtensionCommands = BaseCommands &
QueryEditorCommands &
ResultsViewCommands &
QueryHistoryCommands &
LocalDatabasesCommands &
VariantAnalysisCommands &
DatabasePanelCommands &
AstCfgCommands &
AstViewerCommands &
PackagingCommands &
DataExtensionsEditorCommands &
EvalLogViewerCommands &
SummaryLanguageSupportCommands &
Partial<TestUICommands> &
MockGitHubApiServerCommands;
export type AllCommands = AllExtensionCommands &
PreActivationCommands &
BuiltInVsCodeCommands;
export type AppCommandManager = CommandManager<AllCommands>;
// Separate command manager because it uses a different logger
export type QueryServerCommands = LocalQueryCommands;
export type QueryServerCommandManager = CommandManager<QueryServerCommands>;

View File

@@ -0,0 +1,10 @@
import { Disposable } from "../pure/disposable-object";
export interface AppEvent<T> {
(listener: (event: T) => void): Disposable;
}
export interface AppEventEmitter<T> {
event: AppEvent<T>;
fire(data: T): void;
}

View File

@@ -0,0 +1,77 @@
import { OWNER_REGEX, REPO_REGEX } from "../pure/helpers-pure";
/**
* Checks if a string is a valid GitHub NWO.
* @param identifier The GitHub NWO
* @returns
*/
export function isValidGitHubNwo(identifier: string): boolean {
return validGitHubNwoOrOwner(identifier, "nwo");
}
/**
* Checks if a string is a valid GitHub owner.
* @param identifier The GitHub owner
* @returns
*/
export function isValidGitHubOwner(identifier: string): boolean {
return validGitHubNwoOrOwner(identifier, "owner");
}
function validGitHubNwoOrOwner(
identifier: string,
kind: "owner" | "nwo",
): boolean {
return kind === "owner"
? OWNER_REGEX.test(identifier)
: REPO_REGEX.test(identifier);
}
/**
* Extracts an NWO from a GitHub URL.
* @param githubUrl The GitHub repository URL
* @return The corresponding NWO, or undefined if the URL is not valid
*/
export function getNwoFromGitHubUrl(githubUrl: string): string | undefined {
return getNwoOrOwnerFromGitHubUrl(githubUrl, "nwo");
}
/**
* Extracts an owner from a GitHub URL.
* @param githubUrl The GitHub repository URL
* @return The corresponding Owner, or undefined if the URL is not valid
*/
export function getOwnerFromGitHubUrl(githubUrl: string): string | undefined {
return getNwoOrOwnerFromGitHubUrl(githubUrl, "owner");
}
function getNwoOrOwnerFromGitHubUrl(
githubUrl: string,
kind: "owner" | "nwo",
): string | undefined {
try {
let paths: string[];
const urlElements = githubUrl.split("/");
if (
urlElements[0] === "github.com" ||
urlElements[0] === "www.github.com"
) {
paths = githubUrl.split("/").slice(1);
} else {
const uri = new URL(githubUrl);
if (uri.hostname !== "github.com" && uri.hostname !== "www.github.com") {
return;
}
paths = uri.pathname.split("/").filter((segment: string) => segment);
}
const owner = `${paths[0]}`;
if (kind === "owner") {
return owner ? owner : undefined;
}
const nwo = `${paths[0]}/${paths[1]}`;
return paths[1] ? nwo : undefined;
} catch (e) {
// Ignore the error here, since we catch failures at a higher level.
return;
}
}

Some files were not shown because too many files have changed in this diff Show More