Compare commits

...

680 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
951d0b1004 Merge remote-tracking branch 'origin/main' into koesie10/deprecate-lgtm-download 2022-08-23 16:27:23 +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
430 changed files with 194556 additions and 5712 deletions

6
.gitattributes vendored
View File

@@ -18,4 +18,8 @@ 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/remote-queries/data/*.json linguist-generated

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

@@ -16,13 +16,13 @@ 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.14.0'
node-version: '16.14.2'
- name: Install dependencies
working-directory: extensions/ql-vscode
@@ -65,7 +65,7 @@ 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
@@ -76,13 +76,13 @@ 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.14.0'
node-version: '16.14.2'
- name: Install dependencies
working-directory: extensions/ql-vscode
@@ -103,6 +103,11 @@ jobs:
run: |
npm run lint
- name: Lint scenarios
working-directory: extensions/ql-vscode
run: |
npm run lint:scenarios
- name: Run unit tests (Linux)
working-directory: extensions/ql-vscode
if: matrix.os == 'ubuntu-latest'
@@ -121,7 +126,7 @@ jobs:
env:
VSCODE_CODEQL_GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
run: |
sudo apt-get install xvfb
unset DBUS_SESSION_BUS_ADDRESS
/usr/bin/xvfb-run npm run integration
- name: Run integration tests (Windows)
@@ -139,7 +144,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
version: ['v2.6.3', 'v2.7.6', 'v2.8.5', 'v2.9.4', 'v2.10.4', 'nightly']
version: ['v2.7.6', 'v2.8.5', 'v2.9.4', 'v2.10.5', 'v2.11.2', 'nightly']
env:
CLI_VERSION: ${{ matrix.version }}
NIGHTLY_URL: ${{ needs.find-nightly.outputs.url }}
@@ -147,11 +152,11 @@ 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.14.0'
node-version: '16.14.2'
- name: Install dependencies
working-directory: extensions/ql-vscode
@@ -175,10 +180,10 @@ jobs:
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 }}
@@ -188,6 +193,7 @@ jobs:
working-directory: extensions/ql-vscode
if: matrix.os == 'ubuntu-latest'
run: |
unset DBUS_SESSION_BUS_ADDRESS
/usr/bin/xvfb-run npm run cli-integration
- name: Run CLI tests (Windows)

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.14.0'
node-version: '16.14.2'
- name: Install dependencies
run: |
@@ -47,11 +47,11 @@ 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
@@ -107,7 +107,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()
@@ -136,7 +136,7 @@ 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
@@ -156,7 +156,7 @@ jobs:
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

27
.vscode/launch.json vendored
View File

@@ -35,14 +35,17 @@
"runtimeArgs": [
"--inspect=9229"
],
"env": {
"LANG": "en-US"
},
"args": [
"--exit",
"-u",
"bdd",
"--colors",
"--diff",
"-r",
"ts-node/register",
"--config",
".mocharc.json",
"test/pure-tests/**/*.ts"
],
"stopOnEntry": false,
@@ -50,6 +53,18 @@
"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",
"stopOnEntry": false,
"sourceMaps": true,
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"name": "Launch Integration Tests - No Workspace (vscode-codeql)",
"type": "extensionHost",
@@ -124,6 +139,14 @@
"outFiles": [
"${workspaceRoot}/extensions/ql-vscode/out/**/*.js",
],
},
{
"name": "Launch Storybook",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}/extensions/ql-vscode",
"runtimeExecutable": "npm",
"runtimeArgs": ["run-script", "storybook"]
}
]
}

View File

@@ -30,12 +30,11 @@
"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"
}

View File

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

View File

@@ -77,29 +77,121 @@ $ 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
You will need to run CLI tests using a task from inside of VS Code called _Launch Integration Tests - With CLI_.
We have several types of tests:
* Unit tests: these live in the `tests/pure-tests/` directory
* View tests: these live in `src/view/variant-analysis/__tests__/`
* VSCode integration tests: these live in `src/vscode-tests/no-workspace` and `src/vscode-tests/minimal-workspace`
* CLI integration tests: these live in `src/vscode-tests/cli-integration`
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 `src/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 integration`
###### CLI integration tests
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.
From inside of VSCode, open the `launch.json` file and in the _Launch Integration Tests - With CLI_ task, uncomment the `"${workspaceRoot}/../codeql"` line. If necessary, replace value with a path to your checkout, and then run the task.
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 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
###### CLI integration tests
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_.
#### 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.
## Releasing (write access required)
@@ -123,7 +215,7 @@ From inside of VSCode, open the `launch.json` file and in the _Launch Integratio
git tag v1.3.6
```
If you've accidentally created a badly named tag, you can delete it via
If you've accidentally created a badly named tag, you can delete it via
```bash
git tag -d badly-named-tag
```
@@ -134,18 +226,19 @@ From inside of VSCode, open the `launch.json` file and in the _Launch Integratio
```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.

View File

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

View File

@@ -3,14 +3,14 @@ module.exports = {
parserOptions: {
ecmaVersion: 2018,
sourceType: "module",
project: ["tsconfig.json", "./src/**/tsconfig.json", "./gulpfile.ts/tsconfig.json"],
project: ["tsconfig.json", "./src/**/tsconfig.json", "./gulpfile.ts/tsconfig.json", "./scripts/tsconfig.json", "./.storybook/tsconfig.json"],
},
plugins: ["@typescript-eslint"],
env: {
node: true,
es6: true,
},
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:jest-dom/recommended"],
rules: {
"@typescript-eslint/no-use-before-define": 0,
"@typescript-eslint/no-unused-vars": [

View File

@@ -0,0 +1,4 @@
{
"exit": true,
"require": ["test/mocha.setup.js"]
}

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

@@ -1 +1 @@
v16.14.0
v16.14.2

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'
}
};
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

@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "esnext",
"moduleResolution": "node",
"target": "es6",
"outDir": "out",
"lib": ["ES2021", "dom"],
"jsx": "react",
"sourceMap": true,
"rootDir": "..",
"strict": true,
"noUnusedLocals": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"experimentalDecorators": true,
"skipLibCheck": true
},
"exclude": ["node_modules"]
}

View File

@@ -0,0 +1,49 @@
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,9 @@
export enum VSCodeTheme {
Dark = 'dark',
Light = 'light',
}
export const themeNames: { [key in VSCodeTheme]: string } = {
[VSCodeTheme.Dark]: 'Dark+',
[VSCodeTheme.Light]: 'Light+',
};

View File

@@ -0,0 +1,38 @@
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 } = {
// eslint-disable-next-line @typescript-eslint/no-var-requires
[VSCodeTheme.Dark]: require('!file-loader?modules!../../src/stories/vscode-theme-dark.css').default,
// eslint-disable-next-line @typescript-eslint/no-var-requires
[VSCodeTheme.Light]: require('!file-loader?modules!../../src/stories/vscode-theme-light.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

@@ -1,5 +1,33 @@
# CodeQL for Visual Studio Code: Changelog
## 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)
@@ -14,7 +42,7 @@ No user facing changes.
No user facing changes.
## 1.6.9 - 20 July 2022
## 1.6.9 - 20 July 2022
No user facing changes.

View File

@@ -22,7 +22,7 @@ For information about other configurations, see the separate [CodeQL help](https
### 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).
---
@@ -73,18 +73,19 @@ If you're using your own clone of the CodeQL standard libraries, you can do a `g
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.
@@ -98,6 +99,10 @@ When the results are ready, they're displayed in the CodeQL Query Results view.
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.
### Keyboad 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

@@ -15,7 +15,8 @@ const packageFiles = [
'snippets.json',
'media',
'node_modules',
'out'
'out',
'workspace-databases-schema.json'
];
async function copyPackage(sourcePath: string, destPath: string): Promise<void> {

View File

@@ -1,7 +1,7 @@
import * as gulp from 'gulp';
import { compileTypeScript, watchTypeScript, cleanOutput } from './typescript';
import { compileTextMateGrammar } from './textmate';
import { copyTestData } from './tests';
import { copyTestData, watchTestData } from './tests';
import { compileView, watchView } from './webpack';
import { packageExtension } from './package';
import { injectAppInsightsKey } from './appInsights';
@@ -21,6 +21,7 @@ export {
watchView,
compileTypeScript,
copyTestData,
watchTestData,
injectAppInsightsKey,
compileView,
};

View File

@@ -1,9 +1,14 @@
import * as gulp from 'gulp';
export function copyTestData() {
copyNoWorkspaceData();
copyCliIntegrationData();
return Promise.resolve();
return Promise.all([
copyNoWorkspaceData(),
copyCliIntegrationData()
]);
}
export function watchTestData() {
return gulp.watch(['src/vscode-tests/*/data/**/*'], copyTestData);
}
function copyNoWorkspaceData() {

View File

@@ -0,0 +1,214 @@
/*
* For a detailed explanation regarding each configuration property and type check, visit:
* https://jestjs.io/docs/configuration
*/
module.exports = {
// All imported modules in your tests should be mocked automatically
// automock: false,
// Stop running tests after `n` failures
// bail: 0,
// The directory where Jest should store its cached dependency information
// cacheDirectory: "/private/var/folders/6m/1394pht172qgd7dmw1fwjk100000gn/T/jest_dx",
// Automatically clear mock calls, instances, contexts and results before every test
// clearMocks: true,
// Indicates whether the coverage information should be collected while executing the test
// collectCoverage: false,
// An array of glob patterns indicating a set of files for which coverage information should be collected
// collectCoverageFrom: undefined,
// The directory where Jest should output its coverage files
// coverageDirectory: undefined,
// An array of regexp pattern strings used to skip coverage collection
// coveragePathIgnorePatterns: [
// "/node_modules/"
// ],
// Indicates which provider should be used to instrument code for coverage
coverageProvider: 'v8',
// A list of reporter names that Jest uses when writing coverage reports
// coverageReporters: [
// "json",
// "text",
// "lcov",
// "clover"
// ],
// An object that configures minimum threshold enforcement for coverage results
// coverageThreshold: undefined,
// A path to a custom dependency extractor
// dependencyExtractor: undefined,
// Make calling deprecated APIs throw helpful error messages
// errorOnDeprecated: false,
// The default configuration for fake timers
// fakeTimers: {
// "enableGlobally": false
// },
// Force coverage collection from ignored files using an array of glob patterns
// forceCoverageMatch: [],
// A path to a module which exports an async function that is triggered once before all test suites
// globalSetup: undefined,
// A path to a module which exports an async function that is triggered once after all test suites
// globalTeardown: undefined,
// A set of global variables that need to be available in all test environments
// globals: {},
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
// maxWorkers: "50%",
// An array of directory names to be searched recursively up from the requiring module's location
// moduleDirectories: [
// "node_modules"
// ],
// An array of file extensions your modules use
moduleFileExtensions: [
'js',
'mjs',
'cjs',
'jsx',
'ts',
'tsx',
'json'
],
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
'moduleNameMapper': {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/test/__mocks__/fileMock.ts',
'\\.(css|less)$': '<rootDir>/test/__mocks__/styleMock.ts'
},
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
// modulePathIgnorePatterns: [],
// Activates notifications for test results
// notify: false,
// An enum that specifies notification mode. Requires { notify: true }
// notifyMode: "failure-change",
// A preset that is used as a base for Jest's configuration
preset: 'ts-jest',
// Run tests from one or more projects
// projects: undefined,
// Use this configuration option to add custom reporters to Jest
// reporters: undefined,
// Automatically reset mock state before every test
// resetMocks: false,
// Reset the module registry before running each individual test
// resetModules: false,
// A path to a custom resolver
// resolver: undefined,
// Automatically restore mock state and implementation before every test
// restoreMocks: false,
// The root directory that Jest should scan for tests and modules within
// rootDir: undefined,
// A list of paths to directories that Jest should use to search for files in
// roots: [
// "<rootDir>"
// ],
// Allows you to use a custom runner instead of Jest's default test runner
// runner: "jest-runner",
// The paths to modules that run some code to configure or set up the testing environment before each test
// setupFiles: [],
// A list of paths to modules that run some code to configure or set up the testing framework before each test
setupFilesAfterEnv: ['<rootDir>/test/jest.setup.ts'],
// The number of seconds after which a test is considered as slow and reported as such in the results.
// slowTestThreshold: 5,
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
// snapshotSerializers: [],
// The test environment that will be used for testing
testEnvironment: 'jsdom',
// Options that will be passed to the testEnvironment
// testEnvironmentOptions: {},
// Adds a location field to test results
// testLocationInResults: false,
// The glob patterns Jest uses to detect test files
testMatch: [
'**/__tests__/**/*.[jt]s?(x)'
],
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
// testPathIgnorePatterns: [
// "/node_modules/"
// ],
// The regexp pattern or array of patterns that Jest uses to detect test files
// testRegex: [],
// This option allows the use of a custom results processor
// testResultsProcessor: undefined,
// This option allows use of a custom test runner
// testRunner: "jest-circus/runner",
// A map from regular expressions to paths to transformers
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
tsconfig: 'src/view/tsconfig.spec.json',
},
],
'node_modules': [
'babel-jest',
{
presets: [
'@babel/preset-env'
],
plugins: [
'@babel/plugin-transform-modules-commonjs',
]
}
]
},
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
'transformIgnorePatterns': [
// These use ES modules, so need to be transformed
'node_modules/(?!(?:@vscode/webview-ui-toolkit|@microsoft/.+|exenv-es6)/.*)'
],
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
// unmockedModulePathPatterns: undefined,
// Indicates whether each individual test should be reported during the run
// verbose: undefined,
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
// watchPathIgnorePatterns: [],
// Whether to use watchman for file crawling
// watchman: true,
};

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,7 @@
"description": "CodeQL for Visual Studio Code",
"author": "GitHub",
"private": true,
"version": "1.6.12",
"version": "1.7.5",
"publisher": "GitHub",
"license": "MIT",
"icon": "media/VS-marketplace-CodeQL-icon.png",
@@ -37,6 +37,7 @@
"onLanguage:ql",
"onLanguage:ql-summary",
"onView:codeQLDatabases",
"onView:codeQLDatabasesExperimental",
"onView:codeQLQueryHistory",
"onView:codeQLAstViewer",
"onView:codeQLEvalLogViewer",
@@ -63,6 +64,7 @@
"onCommand:codeQL.quickQuery",
"onCommand:codeQL.restartQueryServer",
"onWebviewPanel:resultsView",
"onWebviewPanel:codeQL.variantAnalysis",
"onFileSystem:codeql-zip-archive"
],
"main": "./out/extension",
@@ -82,6 +84,12 @@
"editor.wordBasedSuggestions": false
}
},
"jsonValidation": [
{
"fileMatch": "workspace-databases.json",
"url": "./workspace-databases-schema.json"
}
],
"languages": [
{
"id": "ql",
@@ -289,6 +297,13 @@
"pattern": "^$|^(?:[a-zA-Z0-9]+-)*[a-zA-Z0-9]+/[a-zA-Z0-9-_]+$",
"patternErrorMessage": "Please enter a valid GitHub repository",
"markdownDescription": "[For internal use only] The name of the GitHub repository in which the GitHub Actions workflow is run when using the \"Run Variant Analysis\" command. The repository should be of the form `<owner>/<repo>`)."
},
"codeQL.logInsights.joinOrderWarningThreshold": {
"type": "number",
"default": 50,
"scope": "window",
"minimum": 0,
"description": "Report a warning for any join order whose metric exceeds this value."
}
}
},
@@ -313,6 +328,10 @@
"command": "codeQL.exportVariantAnalysisResults",
"title": "CodeQL: Export Variant Analysis Results"
},
{
"command": "codeQL.openVariantAnalysis",
"title": "CodeQL: Open Variant Analysis"
},
{
"command": "codeQL.runQueries",
"title": "CodeQL: Run Queries in Selected Files"
@@ -341,6 +360,14 @@
"command": "codeQL.copyVersion",
"title": "CodeQL: Copy Version Information"
},
{
"command": "codeQLDatabasesExperimental.openConfigFile",
"title": "Open Database Configuration File",
"icon": {
"light": "media/light/edit.svg",
"dark": "media/dark/edit.svg"
}
},
{
"command": "codeQLDatabases.chooseDatabaseFolder",
"title": "Choose Database from Folder",
@@ -590,12 +617,20 @@
"title": "Copy Repository List"
},
{
"command": "codeQLQueryResults.nextPathStep",
"title": "CodeQL: Show Next Step on Path"
"command": "codeQLQueryResults.down",
"title": "CodeQL: Navigate Down in Local Result Viewer"
},
{
"command": "codeQLQueryResults.previousPathStep",
"title": "CodeQL: Show Previous Step on Path"
"command": "codeQLQueryResults.up",
"title": "CodeQL: Navigate Up in Local Result Viewer"
},
{
"command": "codeQLQueryResults.right",
"title": "CodeQL: Navigate Right in Local Result Viewer"
},
{
"command": "codeQLQueryResults.left",
"title": "CodeQL: Navigate Left in Local Result Viewer"
},
{
"command": "codeQL.restartQueryServer",
@@ -633,6 +668,26 @@
"command": "codeQL.gotoQL",
"title": "CodeQL: Go to QL Code",
"enablement": "codeql.hasQLSource"
},
{
"command": "codeQL.mockGitHubApiServer.startRecording",
"title": "CodeQL: Mock GitHub API Server: Start Scenario Recording"
},
{
"command": "codeQL.mockGitHubApiServer.saveScenario",
"title": "CodeQL: Mock GitHub API Server: Save Scenario"
},
{
"command": "codeQL.mockGitHubApiServer.cancelRecording",
"title": "CodeQL: Mock GitHub API Server: Cancel Scenario Recording"
},
{
"command": "codeQL.mockGitHubApiServer.loadScenario",
"title": "CodeQL: Mock GitHub API Server: Load Scenario"
},
{
"command": "codeQL.mockGitHubApiServer.unloadScenario",
"title": "CodeQL: Mock GitHub API Server: Unload Scenario"
}
],
"menus": {
@@ -669,7 +724,7 @@
},
{
"command": "codeQLDatabases.chooseDatabaseLgtm",
"when": "view == codeQLDatabases",
"when": "config.codeQL.canary && view == codeQLDatabases",
"group": "navigation"
},
{
@@ -711,6 +766,11 @@
"command": "codeQLEvalLogViewer.clear",
"when": "view == codeQLEvalLogViewer",
"group": "navigation"
},
{
"command": "codeQLDatabasesExperimental.openConfigFile",
"when": "view == codeQLDatabasesExperimental",
"group": "navigation"
}
],
"view/item/context": [
@@ -724,11 +784,6 @@
"group": "9_qlCommands",
"when": "view == codeQLDatabases"
},
{
"command": "codeQLDatabases.upgradeDatabase",
"group": "9_qlCommands",
"when": "view == codeQLDatabases"
},
{
"command": "codeQLDatabases.renameDatabase",
"group": "9_qlCommands",
@@ -752,7 +807,7 @@
{
"command": "codeQLQueryHistory.removeHistoryItem",
"group": "9_qlCommands",
"when": "viewItem == interpretedResultsItem || viewItem == rawResultsItem || viewItem == remoteResultsItem || viewItem == cancelledResultsItem"
"when": "viewItem == interpretedResultsItem || viewItem == rawResultsItem || viewItem == remoteResultsItem || viewItem == cancelledResultsItem || viewItem == cancelledRemoteResultsItem"
},
{
"command": "codeQLQueryHistory.setLabel",
@@ -827,7 +882,7 @@
{
"command": "codeQLQueryHistory.openOnGithub",
"group": "9_qlCommands",
"when": "viewItem == remoteResultsItem || viewItem == inProgressRemoteResultsItem || viewItem == cancelledResultsItem"
"when": "viewItem == remoteResultsItem || viewItem == inProgressRemoteResultsItem || viewItem == cancelledRemoteResultsItem"
},
{
"command": "codeQLQueryHistory.copyRepoList",
@@ -894,6 +949,10 @@
"command": "codeQL.runVariantAnalysis",
"when": "config.codeQL.canary && editorLangId == ql && resourceExtname == .ql"
},
{
"command": "codeQL.openVariantAnalysis",
"when": "config.codeQL.canary && config.codeQL.variantAnalysis.liveResults"
},
{
"command": "codeQL.exportVariantAnalysisResults",
"when": "config.codeQL.canary"
@@ -926,6 +985,14 @@
"command": "codeQL.viewCfg",
"when": "resourceScheme == codeql-zip-archive && config.codeQL.canary"
},
{
"command": "codeQL.chooseDatabaseLgtm",
"when": "config.codeQL.canary"
},
{
"command": "codeQLDatabasesExperimental.openConfigFile",
"when": "false"
},
{
"command": "codeQLDatabases.setCurrentDatabase",
"when": "false"
@@ -1089,6 +1156,26 @@
{
"command": "codeQLTests.showOutputDifferences",
"when": "false"
},
{
"command": "codeQL.mockGitHubApiServer.startRecording",
"when": "config.codeQL.mockGitHubApiServer.enabled && !codeQL.mockGitHubApiServer.recording"
},
{
"command": "codeQL.mockGitHubApiServer.saveScenario",
"when": "config.codeQL.mockGitHubApiServer.enabled && codeQL.mockGitHubApiServer.recording"
},
{
"command": "codeQL.mockGitHubApiServer.cancelRecording",
"when": "config.codeQL.mockGitHubApiServer.enabled && codeQL.mockGitHubApiServer.recording"
},
{
"command": "codeQL.mockGitHubApiServer.loadScenario",
"when": "config.codeQL.mockGitHubApiServer.enabled && !codeQL.mockGitHubApiServer.recording"
},
{
"command": "codeQL.mockGitHubApiServer.unloadScenario",
"when": "config.codeQL.mockGitHubApiServer.enabled && codeQL.mockGitHubApiServer.scenarioLoaded"
}
],
"editor/context": [
@@ -1145,6 +1232,11 @@
"id": "codeQLDatabases",
"name": "Databases"
},
{
"id": "codeQLDatabasesExperimental",
"name": "Databases",
"when": "config.codeQL.canary && config.codeQL.newQueryRunExperience"
},
{
"id": "codeQLQueryHistory",
"name": "Query History"
@@ -1171,7 +1263,7 @@
},
{
"view": "codeQLDatabases",
"contents": "Add a CodeQL database:\n[From a folder](command:codeQLDatabases.chooseDatabaseFolder)\n[From an archive](command:codeQLDatabases.chooseDatabaseArchive)\n[From a URL (as a zip file)](command:codeQLDatabases.chooseDatabaseInternet)\n[From GitHub](command:codeQLDatabases.chooseDatabaseGithub)\n[From LGTM](command:codeQLDatabases.chooseDatabaseLgtm)"
"contents": "Add a CodeQL database:\n[From a folder](command:codeQLDatabases.chooseDatabaseFolder)\n[From an archive](command:codeQLDatabases.chooseDatabaseArchive)\n[From a URL (as a zip file)](command:codeQLDatabases.chooseDatabaseInternet)\n[From GitHub](command:codeQLDatabases.chooseDatabaseGithub)"
},
{
"view": "codeQLEvalLogViewer",
@@ -1184,23 +1276,32 @@
"watch": "npm-run-all -p watch:*",
"watch:extension": "tsc --watch",
"watch:webpack": "gulp watchView",
"test": "mocha --exit -r ts-node/register test/pure-tests/**/*.ts",
"preintegration": "rm -rf ./out/vscode-tests && gulp",
"watch:files": "gulp watchTestData",
"test": "npm-run-all -p test:*",
"test:unit": "mocha --config .mocharc.json 'test/pure-tests/**/*.ts'",
"test:view": "jest",
"integration": "node ./out/vscode-tests/run-integration-tests.js no-workspace,minimal-workspace",
"cli-integration": "npm run preintegration && node ./out/vscode-tests/run-integration-tests.js cli-integration",
"integration:no-workspace": "node ./out/vscode-tests/run-integration-tests.js no-workspace",
"integration:minimal-workspace": "node ./out/vscode-tests/run-integration-tests.js minimal-workspace",
"cli-integration": "node ./out/vscode-tests/run-integration-tests.js cli-integration",
"update-vscode": "node ./node_modules/vscode/bin/install",
"format": "tsfmt -r && eslint src test --ext .ts,.tsx --fix",
"lint": "eslint src test --ext .ts,.tsx --max-warnings=0",
"format-staged": "lint-staged"
"format": "tsfmt -r && eslint . --ext .ts,.tsx --fix",
"lint": "eslint . --ext .ts,.tsx --max-warnings=0",
"format-staged": "lint-staged",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook",
"lint:scenarios": "ts-node scripts/lint-scenarios.ts"
},
"dependencies": {
"@octokit/plugin-retry": "^3.0.9",
"@octokit/rest": "^18.5.6",
"@primer/octicons-react": "^16.3.0",
"@octokit/rest": "^19.0.4",
"@primer/octicons-react": "^17.6.0",
"@primer/react": "^35.0.0",
"@vscode/codicons": "^0.0.31",
"@vscode/webview-ui-toolkit": "^1.0.1",
"ajv": "^8.11.0",
"child-process-promise": "^2.2.1",
"chokidar": "^3.5.3",
"classnames": "~2.2.6",
"d3": "^7.6.1",
"d3-graphviz": "^2.6.1",
@@ -1209,8 +1310,10 @@
"immutable": "^4.0.0",
"js-yaml": "^4.1.0",
"minimist": "~1.2.6",
"msw": "^0.47.4",
"nanoid": "^3.2.0",
"node-fetch": "~2.6.7",
"p-queue": "^6.0.0",
"path-browserify": "^1.0.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
@@ -1233,6 +1336,21 @@
"zip-a-folder": "~1.1.3"
},
"devDependencies": {
"@babel/core": "^7.18.13",
"@babel/plugin-transform-modules-commonjs": "^7.18.6",
"@faker-js/faker": "^7.5.0",
"@octokit/plugin-throttling": "^4.3.2",
"@storybook/addon-actions": "^6.5.10",
"@storybook/addon-essentials": "^6.5.10",
"@storybook/addon-interactions": "^6.5.10",
"@storybook/addon-links": "^6.5.10",
"@storybook/builder-webpack5": "^6.5.10",
"@storybook/manager-webpack5": "^6.5.10",
"@storybook/react": "^6.5.10",
"@storybook/testing-library": "^0.0.13",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^12.1.5",
"@testing-library/user-event": "^14.4.3",
"@types/chai": "^4.1.7",
"@types/chai-as-promised": "~7.1.2",
"@types/child-process-promise": "^2.2.1",
@@ -1246,6 +1364,7 @@
"@types/gulp": "^4.0.9",
"@types/gulp-replace": "^1.1.0",
"@types/gulp-sourcemaps": "0.0.32",
"@types/jest": "^29.0.2",
"@types/js-yaml": "^3.12.5",
"@types/jszip": "~3.1.6",
"@types/mocha": "^9.0.0",
@@ -1270,14 +1389,19 @@
"@types/xml2js": "~0.4.4",
"@typescript-eslint/eslint-plugin": "^4.26.0",
"@typescript-eslint/parser": "^4.26.0",
"@vscode/test-electron": "^2.2.0",
"ansi-colors": "^4.1.1",
"applicationinsights": "^1.8.7",
"applicationinsights": "^2.3.5",
"babel-loader": "^8.2.5",
"chai": "^4.2.0",
"chai-as-promised": "~7.1.1",
"css-loader": "~3.1.0",
"del": "^6.0.0",
"eslint": "~6.8.0",
"eslint-plugin-jest-dom": "^4.0.2",
"eslint-plugin-react": "~7.19.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-storybook": "^0.6.4",
"file-loader": "^6.2.0",
"glob": "^7.1.4",
"gulp": "^4.0.2",
@@ -1285,6 +1409,8 @@
"gulp-sourcemaps": "^3.0.0",
"gulp-typescript": "^5.0.1",
"husky": "~4.3.8",
"jest": "^29.0.3",
"jest-environment-jsdom": "^29.0.3",
"lint-staged": "~10.2.2",
"mini-css-extract-plugin": "^2.6.1",
"mocha": "^10.0.0",
@@ -1292,16 +1418,17 @@
"npm-run-all": "^4.1.5",
"prettier": "~2.0.5",
"proxyquire": "~2.1.3",
"sinon": "~13.0.1",
"sinon": "~14.0.0",
"sinon-chai": "~3.5.0",
"through2": "^4.0.2",
"ts-jest": "^29.0.1",
"ts-json-schema-generator": "^1.1.2",
"ts-loader": "^8.1.0",
"ts-node": "^10.7.0",
"ts-protoc-gen": "^0.9.0",
"typescript": "^4.5.5",
"typescript-formatter": "^7.2.2",
"vsce": "^2.7.0",
"vscode-test": "^1.4.0",
"webpack": "^5.62.2",
"webpack-cli": "^4.6.0"
},

View File

@@ -0,0 +1,128 @@
/**
* 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 * as fs from 'fs-extra';
import * as path 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/remote-queries/gh-api/variant-analysis';
import { RepositoryWithMetadata } from '../src/remote-queries/gh-api/repository';
const extensionDirectory = path.resolve(__dirname, '..');
const scenariosDirectory = path.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 fs.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 fs.readJson(file);
if (!isGetVariantAnalysisRequest(data)) {
continue;
}
if (!data.response.body || !('controller_repo' in data.response.body)) {
continue;
}
console.log(`Adding fields to '${path.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 fs.writeJson(file, data, { spaces: 2 });
}
}
addFieldsToScenarios().catch(e => {
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 * as fs from 'fs-extra';
import * as path from 'path';
if (process.argv.length !== 3) {
console.error('Expected 1 argument - the scenario name');
}
const scenarioName = process.argv[2];
const extensionDirectory = path.resolve(__dirname, '..');
const scenariosDirectory = path.resolve(extensionDirectory, 'src/mocks/scenarios');
const scenarioDirectory = path.resolve(scenariosDirectory, scenarioName);
async function fixScenarioFiles() {
console.log(scenarioDirectory);
if (!(await fs.pathExists(scenarioDirectory))) {
console.error('Scenario directory does not exist: ' + scenarioDirectory);
return;
}
const files = await fs.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 = path.extname(file);
if (ext === '.json') {
const fileName = path.basename(file, ext);
const fileCurrentIndex = parseInt(fileName.split('-')[0]);
const fileNameWithoutIndex = fileName.split('-')[1];
if (fileCurrentIndex !== index) {
const newFileName = `${index}-${fileNameWithoutIndex}${ext}`;
const oldFilePath = path.join(scenarioDirectory, file);
const newFilePath = path.join(scenarioDirectory, newFileName);
console.log(`Rename: ${oldFilePath} -> ${newFilePath}`);
await fs.rename(oldFilePath, newFilePath);
if (fileNameWithoutIndex === 'getVariantAnalysisRepoResult') {
const oldZipFileName = `${fileCurrentIndex}-getVariantAnalysisRepoResult.body.zip`;
const newZipFileName = `${index}-getVariantAnalysisRepoResult.body.zip`;
const oldZipFilePath = path.join(scenarioDirectory, oldZipFileName);
const newZipFilePath = path.join(scenarioDirectory, newZipFileName);
console.log(`Rename: ${oldZipFilePath} -> ${newZipFilePath}`);
await fs.rename(oldZipFilePath, newZipFilePath);
const json = await fs.readJson(newFilePath);
json.response.body = `file:${newZipFileName}`;
console.log(`Response.body change to ${json.response.body}`);
await fs.writeJSON(newFilePath, json);
}
}
index++;
}
}
}
fixScenarioFiles().catch(e => {
console.error(e);
process.exit(2);
});

View File

@@ -0,0 +1,68 @@
import * as fs from 'fs-extra';
import * as path from 'path';
import Ajv from 'ajv';
import * as tsj from 'ts-json-schema-generator';
import { getFiles } from './util/files';
const extensionDirectory = path.resolve(__dirname, '..');
const rootDirectory = path.resolve(extensionDirectory, '../..');
const scenariosDirectory = path.resolve(extensionDirectory, 'src/mocks/scenarios');
const debug = process.env.RUNNER_DEBUG || process.argv.includes('--debug');
async function lintScenarios() {
const schema = tsj.createGenerator({
path: path.resolve(extensionDirectory, 'src/mocks/gh-api-request.ts'),
tsconfig: path.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 = await ajv.compile(schema);
let invalidFiles = 0;
if (!(await fs.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 fs.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=${path.relative(rootDirectory, file)}::${error.instancePath}: ${error.message}`);
});
invalidFiles++;
} else if (debug) {
console.log(`File '${path.relative(rootDirectory, file)}' is valid`);
}
}
if (invalidFiles > 0) {
process.exit(1);
}
}
lintScenarios().catch(e => {
console.error(e);
process.exit(2);
});

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 * as fs from 'fs-extra';
import * as path from 'path';
// https://stackoverflow.com/a/45130990
export async function* getFiles(dir: string): AsyncGenerator<string> {
const dirents = await fs.readdir(dir, { withFileTypes: true });
for (const dirent of dirents) {
const res = path.resolve(dir, dirent.name);
if (dirent.isDirectory()) {
yield* getFiles(res);
} else {
yield res;
}
}
}

View File

@@ -1,118 +0,0 @@
import {
WebviewPanel,
ExtensionContext,
window as Window,
ViewColumn,
Uri,
WebviewPanelOptions,
WebviewOptions
} from 'vscode';
import * as path from 'path';
import { DisposableObject } from './pure/disposable-object';
import { tmpDir } from './helpers';
import { getHtmlForWebview, WebviewMessage, WebviewView } from './interface-utils';
export type InterfacePanelConfig = {
viewId: string;
title: string;
viewColumn: ViewColumn;
view: WebviewView;
preserveFocus?: boolean;
additionalOptions?: WebviewPanelOptions & WebviewOptions;
}
export abstract class AbstractInterfaceManager<ToMessage extends WebviewMessage, FromMessage extends WebviewMessage> extends DisposableObject {
protected panel: WebviewPanel | undefined;
protected panelLoaded = false;
protected panelLoadedCallBacks: (() => void)[] = [];
constructor(
protected readonly ctx: ExtensionContext
) {
super();
}
protected get isShowingPanel() {
return !!this.panel;
}
protected getPanel(): WebviewPanel {
if (this.panel == undefined) {
const { ctx } = this;
const config = this.getPanelConfig();
this.panel = Window.createWebviewPanel(
config.viewId,
config.title,
{ viewColumn: ViewColumn.Active, preserveFocus: true },
{
enableScripts: true,
enableFindWidget: true,
retainContextWhenHidden: true,
...config.additionalOptions,
localResourceRoots: [
...(config.additionalOptions?.localResourceRoots ?? []),
Uri.file(tmpDir.name),
Uri.file(path.join(ctx.extensionPath, 'out'))
],
}
);
this.push(
this.panel.onDidDispose(
() => {
this.panel = undefined;
this.panelLoaded = false;
this.onPanelDispose();
},
null,
ctx.subscriptions
)
);
this.panel.webview.html = getHtmlForWebview(
ctx,
this.panel.webview,
config.view,
{
allowInlineStyles: true,
}
);
this.push(
this.panel.webview.onDidReceiveMessage(
async (e) => this.onMessage(e),
undefined,
ctx.subscriptions
)
);
}
return this.panel;
}
protected abstract getPanelConfig(): InterfacePanelConfig;
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 postMessage(msg: ToMessage): Thenable<boolean> {
return this.getPanel().webview.postMessage(msg);
}
}

View File

@@ -0,0 +1,156 @@
import {
WebviewPanel,
ExtensionContext,
window as Window,
ViewColumn,
Uri,
WebviewPanelOptions,
WebviewOptions,
} from 'vscode';
import * as path 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;
}
export abstract class AbstractWebview<ToMessage extends WebviewMessage, FromMessage extends WebviewMessage> extends DisposableObject {
protected panel: WebviewPanel | undefined;
protected panelLoaded = false;
protected panelLoadedCallBacks: (() => 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(path.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,
}
);
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

@@ -11,12 +11,12 @@ import { promisify } from 'util';
import { CancellationToken, commands, Disposable, Uri } from 'vscode';
import { BQRSInfo, DecodedBqrsChunk } from './pure/bqrs-cli-types';
import { CliConfig } from './config';
import { allowCanaryQueryServer, CliConfig } from './config';
import { DistributionProvider, FindDistributionResultKind } from './distribution';
import { assertNever, getErrorMessage, getErrorStack } from './pure/helpers-pure';
import { QueryMetadata, SortDirection } from './pure/interface-types';
import { Logger, ProgressReporter } from './logging';
import { CompilationMessage } from './pure/messages';
import { CompilationMessage } from './pure/legacy-messages';
import { sarifParser } from './sarif-parser';
import { dbSchemeToLanguage, walkDirectory } from './helpers';
@@ -944,16 +944,14 @@ export class CodeQLCliServer implements Disposable {
return this.runJsonCodeQlCliCommand(['pack', 'install'], args, 'Installing pack dependencies');
}
async packBundle(dir: string, workspaceFolders: string[], outputPath: string, precompile = true): Promise<void> {
async packBundle(dir: string, workspaceFolders: string[], outputPath: string, moreOptions: string[]): Promise<void> {
const args = [
'-o',
outputPath,
dir,
...moreOptions,
...this.getAdditionalPacksArg(workspaceFolders)
];
if (!precompile && await this.cliConstraints.supportsNoPrecompile()) {
args.push('--no-precompile');
}
return this.runJsonCodeQlCliCommand(['pack', 'bundle'], args, 'Bundling pack');
}
@@ -972,6 +970,12 @@ export class CodeQLCliServer implements Disposable {
}
}
async packResolveDependencies(dir: string): Promise<{ [pack: string]: string }> {
// Uses the default `--mode use-lock`, which creates the lock file if it doesn't exist.
const results: { [pack: string]: string } = await this.runJsonCodeQlCliCommand(['pack', 'resolve-dependencies'], [dir], 'Resolving pack dependencies');
return results;
}
async generateDil(qloFile: string, outFile: string): Promise<void> {
const extraArgs = await this.cliConstraints.supportsDecompileDil()
? ['--kind', 'dil', '-o', outFile, qloFile]
@@ -1248,6 +1252,9 @@ export class CliVersionConstraint {
*/
public static CLI_VERSION_WITH_LANGUAGE = new SemVer('2.4.1');
public static CLI_VERSION_WITH_NONDESTURCTIVE_UPGRADES = new SemVer('2.4.2');
/**
* CLI version where `codeql resolve upgrades` supports
* the `--allow-downgrades` flag
@@ -1261,7 +1268,7 @@ export class CliVersionConstraint {
/**
* CLI version where database registration was introduced
*/
*/
public static CLI_VERSION_WITH_DB_REGISTRATION = new SemVer('2.4.1');
/**
@@ -1285,6 +1292,13 @@ export class CliVersionConstraint {
*/
public static CLI_VERSION_REMOTE_QUERIES = new SemVer('2.6.3');
/**
* CLI version where building QLX packs for remote queries is supported.
* (The options were _accepted_ by a few earlier versions, but only from
* 2.11.3 will it actually use the existing compilation cache correctly).
*/
public static CLI_VERSION_QLX_REMOTE = new SemVer('2.11.3');
/**
* CLI version where the `resolve ml-models` subcommand was introduced.
*/
@@ -1327,6 +1341,11 @@ export class CliVersionConstraint {
*/
public static CLI_VERSION_WITH_SOURCEMAP = new SemVer('2.10.3');
/**
* CLI version that supports the new query server.
*/
public static CLI_VERSION_WITH_NEW_QUERY_SERVER = new SemVer('2.11.1');
constructor(private readonly cli: CodeQLCliServer) {
/**/
}
@@ -1343,6 +1362,10 @@ export class CliVersionConstraint {
return this.isVersionAtLeast(CliVersionConstraint.CLI_VERSION_WITH_LANGUAGE);
}
public async supportsNonDestructiveUpgrades() {
return this.isVersionAtLeast(CliVersionConstraint.CLI_VERSION_WITH_NONDESTURCTIVE_UPGRADES);
}
public async supportsDowngrades() {
return this.isVersionAtLeast(CliVersionConstraint.CLI_VERSION_WITH_DOWNGRADES);
}
@@ -1371,6 +1394,10 @@ export class CliVersionConstraint {
return this.isVersionAtLeast(CliVersionConstraint.CLI_VERSION_REMOTE_QUERIES);
}
async supportsQlxRemote() {
return this.isVersionAtLeast(CliVersionConstraint.CLI_VERSION_QLX_REMOTE);
}
async supportsResolveMlModels() {
return this.isVersionAtLeast(CliVersionConstraint.CLI_VERSION_WITH_RESOLVE_ML_MODELS);
}
@@ -1398,4 +1425,15 @@ export class CliVersionConstraint {
async supportsSourceMap() {
return this.isVersionAtLeast(CliVersionConstraint.CLI_VERSION_WITH_SOURCEMAP);
}
async supportsNewQueryServer() {
// TODO while under development, users _must_ opt-in to the new query server
// by setting the `codeql.canaryQueryServer` setting to `true`.
return allowCanaryQueryServer() &&
this.isVersionAtLeast(CliVersionConstraint.CLI_VERSION_WITH_NEW_QUERY_SERVER);
}
async supportsNewQueryServerForTests() {
return this.isVersionAtLeast(CliVersionConstraint.CLI_VERSION_WITH_NEW_QUERY_SERVER);
}
}

View File

@@ -17,14 +17,14 @@ import resultsDiff from './resultsDiff';
import { CompletedLocalQueryInfo } from '../query-results';
import { getErrorMessage } from '../pure/helpers-pure';
import { HistoryItemLabelProvider } from '../history-item-label-provider';
import { AbstractInterfaceManager, InterfacePanelConfig } from '../abstract-interface-manager';
import { AbstractWebview, WebviewPanelConfig } from '../abstract-webview';
interface ComparePair {
from: CompletedLocalQueryInfo;
to: CompletedLocalQueryInfo;
}
export class CompareInterfaceManager extends AbstractInterfaceManager<ToCompareViewMessage, FromCompareViewMessage> {
export class CompareView extends AbstractWebview<ToCompareViewMessage, FromCompareViewMessage> {
private comparePair: ComparePair | undefined;
constructor(
@@ -46,7 +46,8 @@ export class CompareInterfaceManager extends AbstractInterfaceManager<ToCompareV
selectedResultSetName?: string
) {
this.comparePair = { from, to };
this.getPanel().reveal(undefined, true);
const panel = await this.getPanel();
panel.reveal(undefined, true);
await this.waitForPanelLoaded();
const [
@@ -95,7 +96,7 @@ export class CompareInterfaceManager extends AbstractInterfaceManager<ToCompareV
}
}
protected getPanelConfig(): InterfacePanelConfig {
protected getPanelConfig(): WebviewPanelConfig {
return {
viewId: 'compareView',
title: 'Compare CodeQL Query Results',
@@ -111,7 +112,7 @@ export class CompareInterfaceManager extends AbstractInterfaceManager<ToCompareV
protected async onMessage(msg: FromCompareViewMessage): Promise<void> {
switch (msg.t) {
case 'compareViewLoaded':
case 'viewLoaded':
this.onWebViewLoaded();
break;

View File

@@ -4,14 +4,25 @@ import { DistributionManager } from './distribution';
import { logger } from './logging';
import { ONE_DAY_IN_MS } from './pure/time';
export const ALL_SETTINGS: Setting[] = [];
/** Helper class to look up a labelled (and possibly nested) setting. */
export class Setting {
name: string;
parent?: Setting;
private _hasChildren = false;
constructor(name: string, parent?: Setting) {
this.name = name;
this.parent = parent;
if (parent !== undefined) {
parent._hasChildren = true;
}
ALL_SETTINGS.push(this);
}
get hasChildren() {
return this._hasChildren;
}
get qualifiedName(): string {
@@ -36,6 +47,18 @@ export class Setting {
return workspace.getConfiguration(this.parent.qualifiedName).update(this.name, value, target);
}
inspect<T>(): InspectionResult<T> | undefined {
if (this.parent === undefined) {
throw new Error('Cannot update the value of a root setting.');
}
return workspace.getConfiguration(this.parent.qualifiedName).inspect(this.name);
}
}
export interface InspectionResult<T> {
globalValue?: T;
workspaceValue?: T,
workspaceFolderValue?: T,
}
const ROOT_SETTING = new Setting('codeQL');
@@ -44,6 +67,7 @@ const ROOT_SETTING = new Setting('codeQL');
const TELEMETRY_SETTING = new Setting('telemetry', ROOT_SETTING);
const AST_VIEWER_SETTING = new Setting('astViewer', ROOT_SETTING);
const GLOBAL_TELEMETRY_SETTING = new Setting('telemetry');
const LOG_INSIGHTS_SETTING = new Setting('logInsights', ROOT_SETTING);
export const LOG_TELEMETRY = new Setting('logTelemetry', TELEMETRY_SETTING);
export const ENABLE_TELEMETRY = new Setting('enableTelemetry', TELEMETRY_SETTING);
@@ -317,6 +341,22 @@ export function isCanary() {
return !!CANARY_FEATURES.getValue<boolean>();
}
/**
* Enables the experimental query server
*/
export const CANARY_QUERY_SERVER = new Setting('canaryQueryServer', ROOT_SETTING);
export function allowCanaryQueryServer() {
return !!CANARY_QUERY_SERVER.getValue<boolean>();
}
export const JOIN_ORDER_WARNING_THRESHOLD = new Setting('joinOrderWarningThreshold', LOG_INSIGHTS_SETTING);
export function joinOrderWarningThreshold(): number {
return JOIN_ORDER_WARNING_THRESHOLD.getValue<number>();
}
/**
* Avoids caching in the AST viewer if the user is also a canary user.
*/
@@ -343,12 +383,12 @@ export async function setRemoteRepositoryLists(lists: Record<string, string[]> |
}
/**
* Path to a file that contains lists of GitHub repositories that you want to query remotely via
* Path to a file that contains lists of GitHub repositories that you want to query remotely via
* the "Run Variant Analysis" command.
* Note: This command is only available for internal users.
*
*
* This setting should be a path to a JSON file that contains a JSON object where each key is a
* user-specified name (string), and the value is an array of GitHub repositories
* user-specified name (string), and the value is an array of GitHub repositories
* (of the form `<owner>/<repo>`).
*/
const REPO_LISTS_PATH = new Setting('repositoryListsPath', REMOTE_QUERIES_SETTING);
@@ -387,3 +427,62 @@ export function getActionBranch(): string {
export function isIntegrationTestMode() {
return process.env.INTEGRATION_TEST_MODE === 'true';
}
/**
* A flag indicating whether to enable the experimental "live results" feature
* for multi-repo variant analyses.
*/
const LIVE_RESULTS = new Setting('liveResults', REMOTE_QUERIES_SETTING);
export function isVariantAnalysisLiveResultsEnabled(): boolean {
return !!LIVE_RESULTS.getValue<boolean>();
}
/**
* A flag indicating whether to use the new query run experience which involves
* using a new database panel.
*/
const NEW_QUERY_RUN_EXPERIENCE = new Setting('newQueryRunExperience', ROOT_SETTING);
export function isNewQueryRunExperienceEnabled(): boolean {
return !!NEW_QUERY_RUN_EXPERIENCE.getValue<boolean>();
}
// Settings for mocking the GitHub API.
const MOCK_GH_API_SERVER = new Setting('mockGitHubApiServer', ROOT_SETTING);
/**
* A flag indicating whether to enable a mock GitHub API server.
*/
const MOCK_GH_API_SERVER_ENABLED = new Setting('enabled', MOCK_GH_API_SERVER);
/**
* A path to a directory containing test scenarios. If this setting is not set,
* the mock server will a default location for test scenarios in dev mode, and
* will show a menu to select a directory in production mode.
*/
const MOCK_GH_API_SERVER_SCENARIOS_PATH = new Setting('scenariosPath', MOCK_GH_API_SERVER);
export interface MockGitHubApiConfig {
mockServerEnabled: boolean;
mockScenariosPath: string;
onDidChangeConfiguration: Event<void>;
}
export class MockGitHubApiConfigListener extends ConfigListener implements MockGitHubApiConfig {
protected handleDidChangeConfiguration(e: ConfigurationChangeEvent): void {
this.handleDidChangeConfigurationForRelevantSettings([MOCK_GH_API_SERVER], e);
}
public get mockServerEnabled(): boolean {
return !!MOCK_GH_API_SERVER_ENABLED.getValue<boolean>();
}
public get mockScenariosPath(): string {
return MOCK_GH_API_SERVER_SCENARIOS_PATH.getValue<string>();
}
}
export function getMockGitHubApiServerScenariosPath(): string | undefined {
return MOCK_GH_API_SERVER_SCENARIOS_PATH.getValue<string>();
}

View File

@@ -1,10 +1,10 @@
import { QueryWithResults } from '../run-queries';
import { CodeQLCliServer } from '../cli';
import { DecodedBqrsChunk, BqrsId, EntityValue } from '../pure/bqrs-cli-types';
import { DatabaseItem } from '../databases';
import { ChildAstItem, AstItem } from '../astViewer';
import fileRangeFromURI from './fileRangeFromURI';
import { Uri } from 'vscode';
import { QueryWithResults } from '../run-queries-shared';
/**
* A class that wraps a tree of QL results from a query that

View File

@@ -3,13 +3,12 @@ import { ColumnKindCode, EntityValue, getResultSetSchema, ResultSetSchema } from
import { CodeQLCliServer } from '../cli';
import { DatabaseManager, DatabaseItem } from '../databases';
import fileRangeFromURI from './fileRangeFromURI';
import * as messages from '../pure/messages';
import { QueryServerClient } from '../queryserver-client';
import { QueryWithResults, compileAndRunQueryAgainstDatabase, createInitialQueryInfo } from '../run-queries';
import { ProgressCallback } from '../commandRunner';
import { KeyType } from './keyType';
import { qlpackOfDatabase, resolveQueries } from './queryResolver';
import { qlpackOfDatabase, resolveQueries, runContextualQuery } from './queryResolver';
import { CancellationToken, LocationLink, Uri } from 'vscode';
import { QueryWithResults } from '../run-queries-shared';
import { QueryRunner } from '../queryRunner';
export const SELECT_QUERY_NAME = '#select';
export const TEMPLATE_NAME = 'selectedSourceFile';
@@ -35,7 +34,7 @@ export interface FullLocationLink extends LocationLink {
*/
export async function getLocationsForUriString(
cli: CodeQLCliServer,
qs: QueryServerClient,
qs: QueryRunner,
dbm: DatabaseManager,
uriString: string,
keyType: KeyType,
@@ -57,27 +56,8 @@ export async function getLocationsForUriString(
const links: FullLocationLink[] = [];
for (const query of await resolveQueries(cli, qlpack, keyType)) {
const initialInfo = await createInitialQueryInfo(
Uri.file(query),
{
name: db.name,
databaseUri: db.databaseUri.toString(),
},
false
);
const results = await compileAndRunQueryAgainstDatabase(
cli,
qs,
db,
initialInfo,
queryStorageDir,
progress,
token,
templates
);
if (results.result.resultType == messages.QueryResultType.SUCCESS) {
const results = await runContextualQuery(query, db, queryStorageDir, qs, cli, progress, token, templates);
if (results.successful) {
links.push(...await getLinksFromResults(results, cli, db, filter));
}
}
@@ -114,15 +94,9 @@ async function getLinksFromResults(
return localLinks;
}
function createTemplates(path: string): messages.TemplateDefinitions {
function createTemplates(path: string): Record<string, string> {
return {
[TEMPLATE_NAME]: {
values: {
tuples: [[{
stringValue: path
}]]
}
}
[TEMPLATE_NAME]: path
};
}

View File

@@ -1,6 +1,7 @@
import * as fs from 'fs-extra';
import * as yaml from 'js-yaml';
import * as tmp from 'tmp-promise';
import * as path from 'path';
import * as helpers from '../helpers';
import {
@@ -12,6 +13,11 @@ import {
import { CodeQLCliServer } from '../cli';
import { DatabaseItem } from '../databases';
import { QlPacksForLanguage } from '../helpers';
import { logger } from '../logging';
import { createInitialQueryInfo } from '../run-queries-shared';
import { CancellationToken, Uri } from 'vscode';
import { ProgressCallback } from '../commandRunner';
import { QueryRunner } from '../queryRunner';
export async function qlpackOfDatabase(cli: CodeQLCliServer, db: DatabaseItem): Promise<QlPacksForLanguage> {
if (db.contents === undefined) {
@@ -104,3 +110,69 @@ export async function resolveQueries(cli: CodeQLCliServer, qlpacks: QlPacksForLa
void helpers.showAndLogErrorMessage(errorMessage);
throw new Error(`Couldn't find any queries tagged ${tagOfKeyType(keyType)} in any of the following packs: ${packsToSearch.join(', ')}.`);
}
async function resolveContextualQuery(cli: CodeQLCliServer, query: string): Promise<{ packPath: string, createdTempLockFile: boolean }> {
// Contextual queries now live within the standard library packs.
// This simplifies distribution (you don't need the standard query pack to use the AST viewer),
// but if the library pack doesn't have a lockfile, we won't be able to find
// other pack dependencies of the library pack.
// Work out the enclosing pack.
const packContents = await cli.packPacklist(query, false);
const packFilePath = packContents.find((p) => ['codeql-pack.yml', 'qlpack.yml'].includes(path.basename(p)));
if (packFilePath === undefined) {
// Should not happen; we already resolved this query.
throw new Error(`Could not find a CodeQL pack file for the pack enclosing the contextual query ${query}`);
}
const packPath = path.dirname(packFilePath);
const lockFilePath = packContents.find((p) => ['codeql-pack.lock.yml', 'qlpack.lock.yml'].includes(path.basename(p)));
let createdTempLockFile = false;
if (!lockFilePath) {
// No lock file, likely because this library pack is in the package cache.
// Create a lock file so that we can resolve dependencies and library path
// for the contextual query.
void logger.log(`Library pack ${packPath} is missing a lock file; creating a temporary lock file`);
await cli.packResolveDependencies(packPath);
createdTempLockFile = true;
// Clear CLI server pack cache before installing dependencies,
// so that it picks up the new lock file, not the previously cached pack.
void logger.log('Clearing the CodeQL CLI server\'s pack cache');
await cli.clearCache();
// Install dependencies.
void logger.log(`Installing package dependencies for library pack ${packPath}`);
await cli.packInstall(packPath);
}
return { packPath, createdTempLockFile };
}
async function removeTemporaryLockFile(packPath: string) {
const tempLockFilePath = path.resolve(packPath, 'codeql-pack.lock.yml');
void logger.log(`Deleting temporary package lock file at ${tempLockFilePath}`);
// It's fine if the file doesn't exist.
await fs.promises.rm(path.resolve(packPath, 'codeql-pack.lock.yml'), { force: true });
}
export async function runContextualQuery(query: string, db: DatabaseItem, queryStorageDir: string, qs: QueryRunner, cli: CodeQLCliServer, progress: ProgressCallback, token: CancellationToken, templates: Record<string, string>) {
const { packPath, createdTempLockFile } = await resolveContextualQuery(cli, query);
const initialInfo = await createInitialQueryInfo(
Uri.file(query),
{
name: db.name,
databaseUri: db.databaseUri.toString(),
},
false
);
void logger.log(`Running contextual query ${query}; results will be stored in ${queryStorageDir}`);
const queryResult = await qs.compileAndRunQueryAgainstDatabase(
db,
initialInfo,
queryStorageDir,
progress,
token,
templates
);
if (createdTempLockFile) {
await removeTemporaryLockFile(packPath);
}
return queryResult;
}

View File

@@ -16,30 +16,28 @@ import { CodeQLCliServer } from '../cli';
import { DatabaseManager } from '../databases';
import { CachedOperation } from '../helpers';
import { ProgressCallback, withProgress } from '../commandRunner';
import * as messages from '../pure/messages';
import { QueryServerClient } from '../queryserver-client';
import { compileAndRunQueryAgainstDatabase, createInitialQueryInfo, QueryWithResults } from '../run-queries';
import AstBuilder from './astBuilder';
import {
KeyType,
} from './keyType';
import { FullLocationLink, getLocationsForUriString, TEMPLATE_NAME } from './locationFinder';
import { qlpackOfDatabase, resolveQueries } from './queryResolver';
import { qlpackOfDatabase, resolveQueries, runContextualQuery } from './queryResolver';
import { isCanary, NO_CACHE_AST_VIEWER } from '../config';
import { QueryWithResults } from '../run-queries-shared';
import { QueryRunner } from '../queryRunner';
/**
* Run templated CodeQL queries to find definitions and references in
* Runs templated CodeQL queries to find definitions in
* source-language files. We may eventually want to find a way to
* generalize this to other custom queries, e.g. showing dataflow to
* or from a selected identifier.
*/
export class TemplateQueryDefinitionProvider implements DefinitionProvider {
private cache: CachedOperation<LocationLink[]>;
constructor(
private cli: CodeQLCliServer,
private qs: QueryServerClient,
private qs: QueryRunner,
private dbm: DatabaseManager,
private queryStorageDir: string,
) {
@@ -78,12 +76,18 @@ export class TemplateQueryDefinitionProvider implements DefinitionProvider {
}
}
/**
* Runs templated CodeQL queries to find references in
* source-language files. We may eventually want to find a way to
* generalize this to other custom queries, e.g. showing dataflow to
* or from a selected identifier.
*/
export class TemplateQueryReferenceProvider implements ReferenceProvider {
private cache: CachedOperation<FullLocationLink[]>;
constructor(
private cli: CodeQLCliServer,
private qs: QueryServerClient,
private qs: QueryRunner,
private dbm: DatabaseManager,
private queryStorageDir: string,
) {
@@ -132,12 +136,16 @@ type QueryWithDb = {
dbUri: Uri
};
/**
* Run templated CodeQL queries to produce AST information for
* source-language files.
*/
export class TemplatePrintAstProvider {
private cache: CachedOperation<QueryWithDb>;
constructor(
private cli: CodeQLCliServer,
private qs: QueryServerClient,
private qs: QueryRunner,
private dbm: DatabaseManager,
private queryStorageDir: string,
) {
@@ -195,59 +203,41 @@ export class TemplatePrintAstProvider {
}
const query = queries[0];
const templates: messages.TemplateDefinitions = {
[TEMPLATE_NAME]: {
values: {
tuples: [[{
stringValue: zippedArchive.pathWithinSourceArchive
}]]
}
}
const templates: Record<string, string> = {
[TEMPLATE_NAME]:
zippedArchive.pathWithinSourceArchive
};
const initialInfo = await createInitialQueryInfo(
Uri.file(query),
{
name: db.name,
databaseUri: db.databaseUri.toString(),
},
false
);
const queryResult = await runContextualQuery(query, db, this.queryStorageDir, this.qs, this.cli, progress, token, templates);
return {
query: await compileAndRunQueryAgainstDatabase(
this.cli,
this.qs,
db,
initialInfo,
this.queryStorageDir,
progress,
token,
templates
),
query: queryResult,
dbUri: db.databaseUri
};
}
}
/**
* Run templated CodeQL queries to produce CFG information for
* source-language files.
*/
export class TemplatePrintCfgProvider {
private cache: CachedOperation<[Uri, messages.TemplateDefinitions] | undefined>;
private cache: CachedOperation<[Uri, Record<string, string>] | undefined>;
constructor(
private cli: CodeQLCliServer,
private dbm: DatabaseManager,
) {
this.cache = new CachedOperation<[Uri, messages.TemplateDefinitions] | undefined>(this.getCfgUri.bind(this));
this.cache = new CachedOperation<[Uri, Record<string, string>] | undefined>(this.getCfgUri.bind(this));
}
async provideCfgUri(document?: TextDocument): Promise<[Uri, messages.TemplateDefinitions] | undefined> {
async provideCfgUri(document?: TextDocument): Promise<[Uri, Record<string, string>] | undefined> {
if (!document) {
return;
}
return await this.cache.get(document.uri.toString());
}
private async getCfgUri(uriString: string): Promise<[Uri, messages.TemplateDefinitions]> {
private async getCfgUri(uriString: string): Promise<[Uri, Record<string, string>]> {
const uri = Uri.parse(uriString, true);
if (uri.scheme !== zipArchiveScheme) {
throw new Error('CFG Viewing is only available for databases with zipped source archives.');
@@ -275,14 +265,8 @@ export class TemplatePrintCfgProvider {
const queryUri = Uri.file(queries[0]);
const templates: messages.TemplateDefinitions = {
[TEMPLATE_NAME]: {
values: {
tuples: [[{
stringValue: zippedArchive.pathWithinSourceArchive
}]]
}
}
const templates: Record<string, string> = {
[TEMPLATE_NAME]: zippedArchive.pathWithinSourceArchive
};
return [queryUri, templates];

View File

@@ -28,9 +28,6 @@ import {
showAndLogErrorMessage
} from './helpers';
import { logger } from './logging';
import { clearCacheInDatabase } from './run-queries';
import * as qsClient from './queryserver-client';
import { upgradeDatabaseExplicit } from './upgrades';
import {
importArchiveDatabase,
promptImportGithubDatabase,
@@ -40,6 +37,7 @@ import {
import { CancellationToken } from 'vscode';
import { asyncFilter, getErrorMessage } from './pure/helpers-pure';
import { Credentials } from './authentication';
import { QueryRunner } from './queryRunner';
import { isCanary } from './config';
type ThemableIconPath = { light: string; dark: string } | string;
@@ -220,7 +218,7 @@ export class DatabaseUI extends DisposableObject {
public constructor(
private databaseManager: DatabaseManager,
private readonly queryServer: qsClient.QueryServerClient | undefined,
private readonly queryServer: QueryRunner | undefined,
private readonly storagePath: string,
readonly extensionPath: string,
private readonly getCredentials: () => Promise<Credentials>
@@ -390,12 +388,11 @@ export class DatabaseUI extends DisposableObject {
handleChooseDatabaseFolder = async (
progress: ProgressCallback,
token: CancellationToken
): Promise<DatabaseItem | undefined> => {
): Promise<void> => {
try {
return await this.chooseAndSetDatabase(true, progress, token);
await this.chooseAndSetDatabase(true, progress, token);
} catch (e) {
void showAndLogErrorMessage(getErrorMessage(e));
return undefined;
}
};
@@ -458,12 +455,11 @@ export class DatabaseUI extends DisposableObject {
handleChooseDatabaseArchive = async (
progress: ProgressCallback,
token: CancellationToken
): Promise<DatabaseItem | undefined> => {
): Promise<void> => {
try {
return await this.chooseAndSetDatabase(false, progress, token);
await this.chooseAndSetDatabase(false, progress, token);
} catch (e) {
void showAndLogErrorMessage(getErrorMessage(e));
return undefined;
}
};
@@ -576,8 +572,7 @@ export class DatabaseUI extends DisposableObject {
// Search for upgrade scripts in any workspace folders available
await upgradeDatabaseExplicit(
this.queryServer,
await this.queryServer.upgradeDatabaseExplicit(
databaseItem,
progress,
token
@@ -592,8 +587,7 @@ export class DatabaseUI extends DisposableObject {
this.queryServer !== undefined &&
this.databaseManager.currentDatabaseItem !== undefined
) {
await clearCacheInDatabase(
this.queryServer,
await this.queryServer.clearCacheInDatabase(
this.databaseManager.currentDatabaseItem,
progress,
token
@@ -756,7 +750,7 @@ export class DatabaseUI extends DisposableObject {
* Perform some heuristics to ensure a proper database location is chosen.
*
* 1. If the selected URI to add is a file, choose the containing directory
* 2. If the selected URI is a directory matching db-*, choose the containing directory
* 2. If the selected URI appears to be a db language folder, choose the containing directory
* 3. choose the current directory
*
* @param uri a URI that is a database folder or inside it
@@ -769,7 +763,7 @@ export class DatabaseUI extends DisposableObject {
dbPath = path.dirname(dbPath);
}
if (isLikelyDbLanguageFolder(dbPath)) {
if (await isLikelyDbLanguageFolder(dbPath)) {
dbPath = path.dirname(dbPath);
}
return Uri.file(dbPath);

View File

@@ -17,9 +17,8 @@ import {
import { zipArchiveScheme, encodeArchiveBasePath, decodeSourceArchiveUri, encodeSourceArchiveUri } from './archive-filesystem-provider';
import { DisposableObject } from './pure/disposable-object';
import { Logger, logger } from './logging';
import { registerDatabases, Dataset, deregisterDatabases } from './pure/messages';
import { QueryServerClient } from './queryserver-client';
import { getErrorMessage } from './pure/helpers-pure';
import { QueryRunner } from './queryRunner';
/**
* databases.ts
@@ -359,14 +358,12 @@ export class DatabaseItemImpl implements DatabaseItem {
try {
this._contents = await resolveDatabaseContents(this.databaseUri);
this._error = undefined;
}
catch (e) {
} catch (e) {
this._contents = undefined;
this._error = e instanceof Error ? e : new Error(String(e));
throw e;
}
}
finally {
} finally {
this.onChanged({
kind: DatabaseEventKind.Refresh,
item: this
@@ -555,16 +552,13 @@ export class DatabaseManager extends DisposableObject {
constructor(
private readonly ctx: ExtensionContext,
private readonly qs: QueryServerClient,
private readonly qs: QueryRunner,
private readonly cli: cli.CodeQLCliServer,
public logger: Logger
) {
super();
qs.onDidStartQueryServer(this.reregisterDatabases.bind(this));
// Let this run async.
void this.loadPersistedState();
qs.onStart(this.reregisterDatabases.bind(this));
}
public async openDatabase(
@@ -690,11 +684,13 @@ export class DatabaseManager extends DisposableObject {
this._onDidChangeDatabaseItem.fire(event);
});
await this.addDatabaseItem(progress, token, item);
// Avoid persisting the database state after adding since that should happen only after
// all databases have been added.
await this.addDatabaseItem(progress, token, item, false);
return item;
}
private async loadPersistedState(): Promise<void> {
public async loadPersistedState(): Promise<void> {
return withProgress({
location: vscode.ProgressLocation.Notification
},
@@ -708,6 +704,7 @@ export class DatabaseManager extends DisposableObject {
step
});
try {
void this.logger.log(`Found ${databases.length} persisted databases: ${databases.map(db => db.uri).join(', ')}`);
for (const database of databases) {
progress({
maxStep: databases.length,
@@ -722,16 +719,20 @@ export class DatabaseManager extends DisposableObject {
if (currentDatabaseUri === database.uri) {
await this.setCurrentDatabaseItem(databaseItem, true);
}
}
catch (e) {
void this.logger.log(`Loaded database ${databaseItem.name} at URI ${database.uri}.`);
} catch (e) {
// When loading from persisted state, leave invalid databases in the list. They will be
// marked as invalid, and cannot be set as the current database.
void this.logger.log(`Error loading database ${database.uri}: ${e}.`);
}
}
await this.updatePersistedDatabaseList();
} catch (e) {
// database list had an unexpected type - nothing to be done?
void showAndLogErrorMessage(`Database list loading failed: ${getErrorMessage(e)}`);
}
void this.logger.log('Finished loading persisted databases.');
});
}
@@ -786,10 +787,14 @@ export class DatabaseManager extends DisposableObject {
private async addDatabaseItem(
progress: ProgressCallback,
token: vscode.CancellationToken,
item: DatabaseItem
item: DatabaseItem,
updatePersistedState = true
) {
this._databaseItems.push(item);
await this.updatePersistedDatabaseList();
if (updatePersistedState) {
await this.updatePersistedDatabaseList();
}
// Add this database item to the allow-list
// Database items reconstituted from persisted state
@@ -860,27 +865,14 @@ export class DatabaseManager extends DisposableObject {
token: vscode.CancellationToken,
dbItem: DatabaseItem,
) {
if (dbItem.contents && (await this.cli.cliConstraints.supportsDatabaseRegistration())) {
const databases: Dataset[] = [{
dbDir: dbItem.contents.datasetUri.fsPath,
workingSet: 'default'
}];
await this.qs.sendRequest(deregisterDatabases, { databases }, token, progress);
}
await this.qs.deregisterDatabase(progress, token, dbItem);
}
private async registerDatabase(
progress: ProgressCallback,
token: vscode.CancellationToken,
dbItem: DatabaseItem,
) {
if (dbItem.contents && (await this.cli.cliConstraints.supportsDatabaseRegistration())) {
const databases: Dataset[] = [{
dbDir: dbItem.contents.datasetUri.fsPath,
workingSet: 'default'
}];
await this.qs.sendRequest(registerDatabases, { databases }, token, progress);
}
await this.qs.registerDatabase(progress, token, dbItem);
}
private updatePersistedCurrentDatabaseItem(): void {

View File

@@ -0,0 +1,3 @@
### Databases
This folder contains code for the new experimental databases panel and new query run experience.

View File

@@ -0,0 +1,80 @@
import * as fs from 'fs-extra';
import * as path from 'path';
import { cloneDbConfig, DbConfig } from './db-config';
import * as chokidar from 'chokidar';
import { DisposableObject } from '../pure/disposable-object';
import { DbConfigValidator } from './db-config-validator';
export class DbConfigStore extends DisposableObject {
private readonly configPath: string;
private readonly configValidator: DbConfigValidator;
private config: DbConfig;
private configWatcher: chokidar.FSWatcher | undefined;
public constructor(
workspaceStoragePath: string,
extensionPath: string) {
super();
this.configPath = path.join(workspaceStoragePath, 'workspace-databases.json');
this.config = this.createEmptyConfig();
this.configWatcher = undefined;
this.configValidator = new DbConfigValidator(extensionPath);
}
public async initialize(): Promise<void> {
await this.loadConfig();
this.watchConfig();
}
public dispose(): void {
this.configWatcher?.unwatch(this.configPath);
}
public getConfig(): DbConfig {
// Clone the config so that it's not modified outside of this class.
return cloneDbConfig(this.config);
}
public getConfigPath(): string {
return this.configPath;
}
public validateConfig(): string[] {
return this.configValidator.validate(this.config);
}
private async loadConfig(): Promise<void> {
if (!await fs.pathExists(this.configPath)) {
await fs.writeJSON(this.configPath, this.createEmptyConfig(), { spaces: 2 });
}
await this.readConfig();
}
private async readConfig(): Promise<void> {
this.config = await fs.readJSON(this.configPath);
}
private readConfigSync(): void {
this.config = fs.readJSONSync(this.configPath);
}
private watchConfig(): void {
this.configWatcher = chokidar.watch(this.configPath).on('change', () => {
this.readConfigSync();
});
}
private createEmptyConfig(): DbConfig {
return {
remote: {
repositoryLists: [],
owners: [],
repositories: [],
}
};
}
}

View File

@@ -0,0 +1,24 @@
import * as fs from 'fs-extra';
import * as path from 'path';
import Ajv from 'ajv';
import { DbConfig } from './db-config';
export class DbConfigValidator {
private readonly schema: any;
constructor(extensionPath: string) {
const schemaPath = path.resolve(extensionPath, 'workspace-databases-schema.json');
this.schema = fs.readJsonSync(schemaPath);
}
public validate(dbConfig: DbConfig): string[] {
const ajv = new Ajv({ allErrors: true });
ajv.validate(this.schema, dbConfig);
if (ajv.errors) {
return ajv.errors.map((error) => `${error.instancePath} ${error.message}`);
}
return [];
}
}

View File

@@ -0,0 +1,29 @@
// Contains models for the data we want to store in the database config
export interface DbConfig {
remote: RemoteDbConfig;
}
export interface RemoteDbConfig {
repositoryLists: RemoteRepositoryList[];
owners: string[];
repositories: string[];
}
export interface RemoteRepositoryList {
name: string;
repositories: string[];
}
export function cloneDbConfig(config: DbConfig): DbConfig {
return {
remote: {
repositoryLists: config.remote.repositoryLists.map((list) => ({
name: list.name,
repositories: [...list.repositories],
})),
owners: [...config.remote.owners],
repositories: [...config.remote.repositories],
}
};
}

View File

@@ -0,0 +1,53 @@
// This file contains models that are used to represent the databases.
export enum DbItemKind {
RootLocal = 'RootLocal',
RootRemote = 'RootRemote',
RemoteSystemDefinedList = 'RemoteSystemDefinedList',
RemoteUserDefinedList = 'RemoteUserDefinedList',
RemoteOwner = 'RemoteOwner',
RemoteRepo = 'RemoteRepo'
}
export interface RootLocalDbItem {
kind: DbItemKind.RootLocal;
}
export interface RootRemoteDbItem {
kind: DbItemKind.RootRemote;
children: RemoteDbItem[];
}
export type DbItem =
| RootLocalDbItem
| RootRemoteDbItem
| RemoteDbItem
export type RemoteDbItem =
| RemoteSystemDefinedListDbItem
| RemoteUserDefinedListDbItem
| RemoteOwnerDbItem
| RemoteRepoDbItem;
export interface RemoteSystemDefinedListDbItem {
kind: DbItemKind.RemoteSystemDefinedList;
listName: string;
listDisplayName: string;
listDescription: string;
}
export interface RemoteUserDefinedListDbItem {
kind: DbItemKind.RemoteUserDefinedList;
listName: string;
repos: RemoteRepoDbItem[];
}
export interface RemoteOwnerDbItem {
kind: DbItemKind.RemoteOwner;
ownerName: string;
}
export interface RemoteRepoDbItem {
kind: DbItemKind.RemoteRepo;
repoFullName: string;
}

View File

@@ -0,0 +1,23 @@
import { DbConfigStore } from './db-config-store';
import { DbItem } from './db-item';
import { createLocalTree, createRemoteTree } from './db-tree-creator';
export class DbManager {
constructor(
private readonly dbConfigStore: DbConfigStore
) {
}
public getDbItems(): DbItem[] {
const config = this.dbConfigStore.getConfig();
return [
createRemoteTree(config),
createLocalTree()
];
}
public getConfigPath(): string {
return this.dbConfigStore.getConfigPath();
}
}

View File

@@ -0,0 +1,45 @@
import * as vscode from 'vscode';
import { isCanary, isNewQueryRunExperienceEnabled } from '../config';
import { logger } from '../logging';
import { DisposableObject } from '../pure/disposable-object';
import { DbConfigStore } from './db-config-store';
import { DbManager } from './db-manager';
import { DbPanel } from './ui/db-panel';
export class DbModule extends DisposableObject {
public async initialize(
extensionContext: vscode.ExtensionContext
): Promise<void> {
if (extensionContext.extensionMode !== vscode.ExtensionMode.Development ||
!isCanary() ||
!isNewQueryRunExperienceEnabled()) {
// Currently, we only want to expose the new database panel when we
// are in development and canary mode and the developer has enabled the
// new query run experience.
return;
}
void logger.log('Initializing database module');
const storagePath = extensionContext.storageUri?.fsPath || extensionContext.globalStorageUri.fsPath;
const extensionPath = extensionContext.extensionPath;
const dbConfigStore = new DbConfigStore(storagePath, extensionPath);
await dbConfigStore.initialize();
const dbManager = new DbManager(dbConfigStore);
const dbPanel = new DbPanel(dbManager);
await dbPanel.initialize();
extensionContext.subscriptions.push(dbPanel);
this.push(dbPanel);
this.push(dbConfigStore);
}
}
export async function initializeDbModule(
extensionContext: vscode.ExtensionContext
): Promise<DbModule> {
const dbModule = new DbModule();
await dbModule.initialize(extensionContext);
return dbModule;
}

View File

@@ -0,0 +1,70 @@
import { DbConfig, RemoteRepositoryList } from './db-config';
import {
DbItemKind,
RemoteOwnerDbItem,
RemoteRepoDbItem,
RemoteSystemDefinedListDbItem,
RemoteUserDefinedListDbItem,
RootLocalDbItem,
RootRemoteDbItem
} from './db-item';
export function createRemoteTree(dbConfig: DbConfig): RootRemoteDbItem {
const systemDefinedLists = [
createSystemDefinedList(10),
createSystemDefinedList(100),
createSystemDefinedList(1000)
];
const userDefinedRepoLists = dbConfig.remote.repositoryLists.map(createUserDefinedList);
const owners = dbConfig.remote.owners.map(createOwnerItem);
const repos = dbConfig.remote.repositories.map(createRepoItem);
return {
kind: DbItemKind.RootRemote,
children: [
...systemDefinedLists,
...owners,
...userDefinedRepoLists,
...repos
]
};
}
export function createLocalTree(): RootLocalDbItem {
// This will be fleshed out further in the future.
return {
kind: DbItemKind.RootLocal
};
}
function createSystemDefinedList(n: number): RemoteSystemDefinedListDbItem {
return {
kind: DbItemKind.RemoteSystemDefinedList,
listName: `top_${n}`,
listDisplayName: `Top ${n} repositories`,
listDescription: `Top ${n} repositories of a language`
};
}
function createUserDefinedList(list: RemoteRepositoryList): RemoteUserDefinedListDbItem {
return {
kind: DbItemKind.RemoteUserDefinedList,
listName: list.name,
repos: list.repositories.map((r) => createRepoItem(r))
};
}
function createOwnerItem(owner: string): RemoteOwnerDbItem {
return {
kind: DbItemKind.RemoteOwner,
ownerName: owner
};
}
function createRepoItem(repo: string): RemoteRepoDbItem {
return {
kind: DbItemKind.RemoteRepo,
repoFullName: repo
};
}

View File

@@ -0,0 +1,49 @@
import { DbItem, DbItemKind } from '../db-item';
import {
createDbTreeViewItemOwner,
createDbTreeViewItemRepo,
createDbTreeViewItemRoot,
createDbTreeViewItemSystemDefinedList,
createDbTreeViewItemUserDefinedList,
DbTreeViewItem
} from './db-tree-view-item';
export function mapDbItemToTreeViewItem(dbItem: DbItem): DbTreeViewItem {
switch (dbItem.kind) {
case DbItemKind.RootLocal:
return createDbTreeViewItemRoot(
dbItem,
'local',
'Local databases',
[]);
case DbItemKind.RootRemote:
return createDbTreeViewItemRoot(
dbItem,
'remote',
'Remote databases',
dbItem.children.map(c => mapDbItemToTreeViewItem(c)));
case DbItemKind.RemoteSystemDefinedList:
return createDbTreeViewItemSystemDefinedList(
dbItem,
dbItem.listDisplayName,
dbItem.listDescription);
case DbItemKind.RemoteUserDefinedList:
return createDbTreeViewItemUserDefinedList(
dbItem,
dbItem.listName,
dbItem.repos.map(mapDbItemToTreeViewItem));
case DbItemKind.RemoteOwner:
return createDbTreeViewItemOwner(
dbItem,
dbItem.ownerName);
case DbItemKind.RemoteRepo:
return createDbTreeViewItemRepo(
dbItem,
dbItem.repoFullName);
}
}

View File

@@ -0,0 +1,39 @@
import * as vscode from 'vscode';
import { commandRunner } from '../../commandRunner';
import { DisposableObject } from '../../pure/disposable-object';
import { DbManager } from '../db-manager';
import { DbTreeDataProvider } from './db-tree-data-provider';
export class DbPanel extends DisposableObject {
private readonly dataProvider: DbTreeDataProvider;
public constructor(
private readonly dbManager: DbManager
) {
super();
this.dataProvider = new DbTreeDataProvider(dbManager);
const treeView = vscode.window.createTreeView('codeQLDatabasesExperimental', {
treeDataProvider: this.dataProvider,
canSelectMany: false
});
this.push(treeView);
}
public async initialize(): Promise<void> {
this.push(
commandRunner(
'codeQLDatabasesExperimental.openConfigFile',
() => this.openConfigFile(),
)
);
}
private async openConfigFile(): Promise<void> {
const configPath = this.dbManager.getConfigPath();
const document = await vscode.workspace.openTextDocument(configPath);
await vscode.window.showTextDocument(document);
}
}

View File

@@ -0,0 +1,49 @@
import { ProviderResult, TreeDataProvider, TreeItem } from 'vscode';
import { createDbTreeViewItemWarning, DbTreeViewItem } from './db-tree-view-item';
import { DbManager } from '../db-manager';
import { mapDbItemToTreeViewItem } from './db-item-mapper';
export class DbTreeDataProvider implements TreeDataProvider<DbTreeViewItem> {
private dbTreeItems: DbTreeViewItem[];
public constructor(
private readonly dbManager: DbManager
) {
this.dbTreeItems = this.createTree();
}
/**
* Called when expanding a node (including the root node).
* @param node The node to expand.
* @returns The children of the node.
*/
public getChildren(node?: DbTreeViewItem): ProviderResult<DbTreeViewItem[]> {
if (!node) {
// We're at the root.
return Promise.resolve(this.dbTreeItems);
} else {
return Promise.resolve(node.children);
}
}
/**
* Returns the UI presentation of the element that gets displayed in the view.
* @param node The node to represent.
* @returns The UI presentation of the node.
*/
public getTreeItem(node: DbTreeViewItem): TreeItem | Thenable<TreeItem> {
return node;
}
private createTree(): DbTreeViewItem[] {
const dbItems = this.dbManager.getDbItems();
// Add a sample warning as a proof of concept.
const warningTreeViewItem = createDbTreeViewItemWarning(
'There was an error',
'Fix it'
);
return [...dbItems.map(mapDbItemToTreeViewItem), warningTreeViewItem];
}
}

View File

@@ -0,0 +1,107 @@
import * as vscode from 'vscode';
import {
DbItem,
RemoteOwnerDbItem,
RemoteRepoDbItem,
RemoteSystemDefinedListDbItem,
RemoteUserDefinedListDbItem,
RootLocalDbItem,
RootRemoteDbItem
} from '../db-item';
/**
* Represents an item in the database tree view. This item could be
* representing an actual database item or a warning.
*/
export class DbTreeViewItem extends vscode.TreeItem {
constructor(
public readonly dbItem: DbItem | undefined,
public readonly iconPath: vscode.ThemeIcon | undefined,
public readonly label: string,
public readonly tooltip: string | undefined,
public readonly collapsibleState: vscode.TreeItemCollapsibleState,
public readonly children: DbTreeViewItem[]
) {
super(label, collapsibleState);
}
}
export function createDbTreeViewItemWarning(label: string, tooltip: string): DbTreeViewItem {
return new DbTreeViewItem(
undefined,
new vscode.ThemeIcon('warning', new vscode.ThemeColor('problemsWarningIcon.foreground')),
label,
tooltip,
vscode.TreeItemCollapsibleState.None,
[]
);
}
export function createDbTreeViewItemRoot(
dbItem: RootLocalDbItem | RootRemoteDbItem,
label: string,
tooltip: string,
children: DbTreeViewItem[]
): DbTreeViewItem {
return new DbTreeViewItem(
dbItem,
undefined,
label,
tooltip,
vscode.TreeItemCollapsibleState.Collapsed,
children);
}
export function createDbTreeViewItemSystemDefinedList(
dbItem: RemoteSystemDefinedListDbItem,
label: string,
tooltip: string
): DbTreeViewItem {
return new DbTreeViewItem(
dbItem,
new vscode.ThemeIcon('github'),
label,
tooltip,
vscode.TreeItemCollapsibleState.None,
[]);
}
export function createDbTreeViewItemUserDefinedList(
dbItem: RemoteUserDefinedListDbItem,
listName: string,
children: DbTreeViewItem[]
): DbTreeViewItem {
return new DbTreeViewItem(
dbItem,
undefined,
listName,
undefined,
vscode.TreeItemCollapsibleState.Collapsed,
children);
}
export function createDbTreeViewItemOwner(
dbItem: RemoteOwnerDbItem,
ownerName: string,
): DbTreeViewItem {
return new DbTreeViewItem(
dbItem,
new vscode.ThemeIcon('organization'),
ownerName,
undefined,
vscode.TreeItemCollapsibleState.None,
[]);
}
export function createDbTreeViewItemRepo(
dbItem: RemoteRepoDbItem,
repoName: string,
): DbTreeViewItem {
return new DbTreeViewItem(
dbItem,
new vscode.ThemeIcon('database'),
repoName,
undefined,
vscode.TreeItemCollapsibleState.None,
[]);
}

View File

@@ -33,6 +33,7 @@ import {
CliConfigListener,
DistributionConfigListener,
isCanary,
joinOrderWarningThreshold,
MAX_QUERIES,
QueryHistoryConfigListener,
QueryServerConfigListener
@@ -68,17 +69,17 @@ import {
} from './helpers';
import { asError, assertNever, getErrorMessage } from './pure/helpers-pure';
import { spawnIdeServer } from './ide-server';
import { InterfaceManager } from './interface';
import { ResultsView } from './interface';
import { WebviewReveal } from './interface-utils';
import { ideServerLogger, logger, queryServerLogger } from './logging';
import { ideServerLogger, logger, ProgressReporter, queryServerLogger } from './logging';
import { QueryHistoryManager } from './query-history';
import { CompletedLocalQueryInfo, LocalQueryInfo } from './query-results';
import * as qsClient from './queryserver-client';
import * as legacyQueryServer from './legacy-query-server/queryserver-client';
import * as newQueryServer from './query-server/queryserver-client';
import { displayQuickQuery } from './quick-query';
import { compileAndRunQueryAgainstDatabase, createInitialQueryInfo } from './run-queries';
import { QLTestAdapterFactory } from './test-adapter';
import { TestUIService } from './test-ui';
import { CompareInterfaceManager } from './compare/compare-interface';
import { CompareView } from './compare/compare-view';
import { gatherQlFiles } from './pure/files';
import { initializeTelemetry } from './telemetry';
import {
@@ -102,6 +103,18 @@ import { EvalLogViewer } from './eval-log-viewer';
import { SummaryLanguageSupport } from './log-insights/summary-language-support';
import { JoinOrderScannerProvider } from './log-insights/join-order';
import { LogScannerService } from './log-insights/log-scanner-service';
import { createInitialQueryInfo } from './run-queries-shared';
import { LegacyQueryRunner } from './legacy-query-server/legacyRunner';
import { NewQueryRunner } from './query-server/query-runner';
import { QueryRunner } from './queryRunner';
import { VariantAnalysisView } from './remote-queries/variant-analysis-view';
import { VariantAnalysisViewSerializer } from './remote-queries/variant-analysis-view-serializer';
import { VariantAnalysis, VariantAnalysisScannedRepository } from './remote-queries/shared/variant-analysis';
import { VariantAnalysisManager } from './remote-queries/variant-analysis-manager';
import { createVariantAnalysisContentProvider } from './remote-queries/variant-analysis-content-provider';
import { VSCodeMockGitHubApiServer } from './mocks/vscode-mock-gh-api-server';
import { VariantAnalysisResultsManager } from './remote-queries/variant-analysis-results-manager';
import { initializeDbModule } from './databases/db-module';
/**
* extension.ts
@@ -164,10 +177,11 @@ function registerErrorStubs(excludedCommands: string[], stubGenerator: (command:
export interface CodeQLExtensionInterface {
readonly ctx: ExtensionContext;
readonly cliServer: CodeQLCliServer;
readonly qs: qsClient.QueryServerClient;
readonly qs: QueryRunner;
readonly distributionManager: DistributionManager;
readonly databaseManager: DatabaseManager;
readonly databaseUI: DatabaseUI;
readonly variantAnalysisManager: VariantAnalysisManager;
readonly dispose: () => void;
}
@@ -378,7 +392,10 @@ export async function activate(ctx: ExtensionContext): Promise<CodeQLExtensionIn
allowAutoUpdating: true
})));
return await installOrUpdateThenTryActivate({
const variantAnalysisViewSerializer = new VariantAnalysisViewSerializer(ctx);
Window.registerWebviewPanelSerializer(VariantAnalysisView.viewType, variantAnalysisViewSerializer);
const codeQlExtension = await installOrUpdateThenTryActivate({
isUserInitiated: !!ctx.globalState.get(shouldUpdateOnNextActivationKey),
shouldDisplayMessageWhenNoUpdates: false,
@@ -386,8 +403,14 @@ export async function activate(ctx: ExtensionContext): Promise<CodeQLExtensionIn
// otherwise, ask user to accept the update
allowAutoUpdating: !!ctx.globalState.get(shouldUpdateOnNextActivationKey)
});
variantAnalysisViewSerializer.onExtensionLoaded(codeQlExtension.variantAnalysisManager);
return codeQlExtension;
}
const PACK_GLOBS = ['**/codeql-pack.yml', '**/qlpack.yml', '**/queries.xml', '**/codeql-pack.lock.yml', '**/qlpack.lock.yml', '.codeqlmanifest.json', 'codeql-workspace.yml'];
async function activateWithInstalledDistribution(
ctx: ExtensionContext,
distributionManager: DistributionManager,
@@ -416,24 +439,23 @@ async function activateWithInstalledDistribution(
ctx.subscriptions.push(statusBar);
void logger.log('Initializing query server client.');
const qs = new qsClient.QueryServerClient(
qlConfigurationListener,
cliServer,
{
logger: queryServerLogger,
contextStoragePath: getContextStoragePath(ctx),
},
(task) =>
Window.withProgress(
{ title: 'CodeQL query server', location: ProgressLocation.Window },
task
)
);
ctx.subscriptions.push(qs);
await qs.startQueryServer();
const qs = await createQueryServer(qlConfigurationListener, cliServer, ctx);
for (const glob of PACK_GLOBS) {
const fsWatcher = workspace.createFileSystemWatcher(glob);
ctx.subscriptions.push(fsWatcher);
fsWatcher.onDidChange(async (_uri) => {
await qs.clearPackCache();
});
}
void logger.log('Initializing database manager.');
const dbm = new DatabaseManager(ctx, qs, cliServer, logger);
// Let this run async.
void dbm.loadPersistedState();
ctx.subscriptions.push(dbm);
void logger.log('Initializing database panel.');
const databaseUI = new DatabaseUI(
@@ -460,19 +482,29 @@ async function activateWithInstalledDistribution(
const labelProvider = new HistoryItemLabelProvider(queryHistoryConfigurationListener);
void logger.log('Initializing results panel interface.');
const intm = new InterfaceManager(ctx, dbm, cliServer, queryServerLogger, labelProvider);
ctx.subscriptions.push(intm);
const localQueryResultsView = new ResultsView(ctx, dbm, cliServer, queryServerLogger, labelProvider);
ctx.subscriptions.push(localQueryResultsView);
void logger.log('Initializing variant analysis manager.');
const rqm = new RemoteQueriesManager(ctx, cliServer, queryStorageDir, logger);
const variantAnalysisStorageDir = path.join(ctx.globalStorageUri.fsPath, 'variant-analyses');
await fs.ensureDir(variantAnalysisStorageDir);
const variantAnalysisResultsManager = new VariantAnalysisResultsManager(cliServer, logger);
const variantAnalysisManager = new VariantAnalysisManager(ctx, variantAnalysisStorageDir, variantAnalysisResultsManager);
ctx.subscriptions.push(variantAnalysisManager);
ctx.subscriptions.push(variantAnalysisResultsManager);
ctx.subscriptions.push(workspace.registerTextDocumentContentProvider('codeql-variant-analysis', createVariantAnalysisContentProvider(variantAnalysisManager)));
void logger.log('Initializing remote queries manager.');
const rqm = new RemoteQueriesManager(ctx, cliServer, queryStorageDir, logger, variantAnalysisManager);
ctx.subscriptions.push(rqm);
void logger.log('Initializing query history.');
const qhm = new QueryHistoryManager(
qs,
dbm,
intm,
localQueryResultsView,
rqm,
variantAnalysisManager,
evalLogViewer,
queryStorageDir,
ctx,
@@ -488,13 +520,10 @@ async function activateWithInstalledDistribution(
void logger.log('Initializing evaluation log scanners.');
const logScannerService = new LogScannerService(qhm);
ctx.subscriptions.push(logScannerService);
ctx.subscriptions.push(logScannerService.scanners.registerLogScannerProvider(new JoinOrderScannerProvider()));
ctx.subscriptions.push(logScannerService.scanners.registerLogScannerProvider(new JoinOrderScannerProvider(() => joinOrderWarningThreshold())));
void logger.log('Reading query history');
await qhm.readQueryHistory();
void logger.log('Initializing compare panel interface.');
const cmpm = new CompareInterfaceManager(
void logger.log('Initializing compare view.');
const compareView = new CompareView(
ctx,
dbm,
cliServer,
@@ -502,7 +531,7 @@ async function activateWithInstalledDistribution(
labelProvider,
showResults
);
ctx.subscriptions.push(cmpm);
ctx.subscriptions.push(compareView);
void logger.log('Initializing source archive filesystem provider.');
archiveFilesystemProvider.activate(ctx);
@@ -512,7 +541,7 @@ async function activateWithInstalledDistribution(
to: CompletedLocalQueryInfo
): Promise<void> {
try {
await cmpm.showResults(from, to);
await compareView.showResults(from, to);
} catch (e) {
void showAndLogErrorMessage(getErrorMessage(e));
}
@@ -522,7 +551,7 @@ async function activateWithInstalledDistribution(
query: CompletedLocalQueryInfo,
forceReveal: WebviewReveal
): Promise<void> {
await intm.showResults(query, forceReveal, false);
await localQueryResultsView.showResults(query, forceReveal, false);
}
async function compileAndRunQuery(
@@ -552,9 +581,7 @@ async function activateWithInstalledDistribution(
const item = new LocalQueryInfo(initialInfo, source);
qhm.addQuery(item);
try {
const completedQueryInfo = await compileAndRunQueryAgainstDatabase(
cliServer,
qs,
const completedQueryInfo = await qs.compileAndRunQueryAgainstDatabase(
databaseItem,
initialInfo,
queryStorageDir,
@@ -564,7 +591,7 @@ async function activateWithInstalledDistribution(
item,
);
qhm.completeQuery(item, completedQueryInfo);
await showResultsForCompletedQuery(item as CompletedLocalQueryInfo, WebviewReveal.NotForced);
await showResultsForCompletedQuery(item as CompletedLocalQueryInfo, WebviewReveal.Forced);
// Note we must update the query history view after showing results as the
// display and sorting might depend on the number of results
} catch (e) {
@@ -782,12 +809,13 @@ async function activateWithInstalledDistribution(
});
}
if (queryUris.length > 1) {
if (queryUris.length > 1 && !await cliServer.cliConstraints.supportsNonDestructiveUpgrades()) {
// Try to upgrade the current database before running any queries
// so that the user isn't confronted with multiple upgrade
// requests for each query to run.
// Only do it if running multiple queries since this check is
// performed on each query run anyway.
// Don't do this with non destructive upgrades as the user won't see anything anyway.
await databaseUI.tryUpgradeCurrentDatabase(progress, token);
}
@@ -906,6 +934,39 @@ async function activateWithInstalledDistribution(
})
);
ctx.subscriptions.push(
commandRunner('codeQL.monitorVariantAnalysis', async (
variantAnalysis: VariantAnalysis,
token: CancellationToken
) => {
await variantAnalysisManager.monitorVariantAnalysis(variantAnalysis, token);
})
);
ctx.subscriptions.push(
commandRunner('codeQL.autoDownloadVariantAnalysisResult', async (
scannedRepo: VariantAnalysisScannedRepository,
variantAnalysisSummary: VariantAnalysis,
token: CancellationToken
) => {
await variantAnalysisManager.enqueueDownload(scannedRepo, variantAnalysisSummary, token);
})
);
ctx.subscriptions.push(
commandRunner('codeQL.cancelVariantAnalysis', async (
variantAnalysisId: number,
) => {
await variantAnalysisManager.cancelVariantAnalysis(variantAnalysisId);
})
);
ctx.subscriptions.push(
commandRunner('codeQL.openVariantAnalysis', async () => {
await variantAnalysisManager.promptOpenVariantAnalysis();
})
);
ctx.subscriptions.push(
commandRunner('codeQL.autoDownloadRemoteQueryResults', async (
queryResult: RemoteQueryResult,
@@ -914,8 +975,21 @@ async function activateWithInstalledDistribution(
}));
ctx.subscriptions.push(
commandRunner('codeQL.exportVariantAnalysisResults', async () => {
await exportRemoteQueryResults(qhm, rqm, ctx);
commandRunner('codeQL.exportVariantAnalysisResults', async (queryId?: string) => {
await exportRemoteQueryResults(qhm, rqm, ctx, queryId);
})
);
ctx.subscriptions.push(
commandRunner('codeQL.loadVariantAnalysisRepoResults', async (variantAnalysisId: number, repositoryFullName: string) => {
await variantAnalysisManager.loadResults(variantAnalysisId, repositoryFullName);
})
);
// The "openVariantAnalysisView" command is internal-only.
ctx.subscriptions.push(
commandRunner('codeQL.openVariantAnalysisView', async (variantAnalysisId: number) => {
await variantAnalysisManager.showView(variantAnalysisId);
})
);
@@ -1122,8 +1196,47 @@ async function activateWithInstalledDistribution(
)
);
const mockServer = new VSCodeMockGitHubApiServer(ctx);
ctx.subscriptions.push(mockServer);
ctx.subscriptions.push(
commandRunner(
'codeQL.mockGitHubApiServer.startRecording',
async () => await mockServer.startRecording(),
)
);
ctx.subscriptions.push(
commandRunner(
'codeQL.mockGitHubApiServer.saveScenario',
async () => await mockServer.saveScenario(),
)
);
ctx.subscriptions.push(
commandRunner(
'codeQL.mockGitHubApiServer.cancelRecording',
async () => await mockServer.cancelRecording(),
)
);
ctx.subscriptions.push(
commandRunner(
'codeQL.mockGitHubApiServer.loadScenario',
async () => await mockServer.loadScenario(),
)
);
ctx.subscriptions.push(
commandRunner(
'codeQL.mockGitHubApiServer.unloadScenario',
async () => await mockServer.unloadScenario(),
)
);
await commands.executeCommand('codeQLDatabases.removeOrphanedDatabases');
void logger.log('Reading query history');
await qhm.readQueryHistory();
const dbModule = await initializeDbModule(ctx);
ctx.subscriptions.push(dbModule);
void logger.log('Successfully finished extension initialization.');
return {
@@ -1133,12 +1246,46 @@ async function activateWithInstalledDistribution(
distributionManager,
databaseManager: dbm,
databaseUI,
variantAnalysisManager,
dispose: () => {
ctx.subscriptions.forEach(d => d.dispose());
}
};
}
async function createQueryServer(qlConfigurationListener: QueryServerConfigListener, cliServer: CodeQLCliServer, ctx: ExtensionContext): Promise<QueryRunner> {
const qsOpts = {
logger: queryServerLogger,
contextStoragePath: getContextStoragePath(ctx),
};
const progressCallback = (task: (progress: ProgressReporter, token: CancellationToken) => Thenable<void>) => Window.withProgress(
{ title: 'CodeQL query server', location: ProgressLocation.Window },
task
);
if (await cliServer.cliConstraints.supportsNewQueryServer()) {
const qs = new newQueryServer.QueryServerClient(
qlConfigurationListener,
cliServer,
qsOpts,
progressCallback
);
ctx.subscriptions.push(qs);
await qs.startQueryServer();
return new NewQueryRunner(qs);
} else {
const qs = new legacyQueryServer.QueryServerClient(
qlConfigurationListener,
cliServer,
qsOpts,
progressCallback
);
ctx.subscriptions.push(qs);
await qs.startQueryServer();
return new LegacyQueryRunner(qs);
}
}
function getContextStoragePath(ctx: ExtensionContext) {
return ctx.storageUri?.fsPath || ctx.globalStorageUri.fsPath;
}

View File

@@ -22,7 +22,11 @@ fs.ensureDirSync(upgradesTmpDir);
export const tmpDirDisposal = {
dispose: () => {
tmpDir.removeCallback();
try {
tmpDir.removeCallback();
} catch (e) {
void logger.log(`Failed to remove temporary directory ${tmpDir.name}: ${e}`);
}
}
};
@@ -470,9 +474,9 @@ export function getInitialQueryContents(language: string, dbscheme: string) {
/**
* Heuristically determines if the directory passed in corresponds
* to a database root.
*
* @param maybeRoot
* to a database root. A database root is a directory that contains
* a codeql-database.yml or (historically) a .dbinfo file. It also
* contains a folder starting with `db-`.
*/
export async function isLikelyDatabaseRoot(maybeRoot: string) {
const [a, b, c] = (await Promise.all([
@@ -484,11 +488,14 @@ export async function isLikelyDatabaseRoot(maybeRoot: string) {
glob('db-*/', { cwd: maybeRoot })
]));
return !!((a || b) && c);
return ((a || b) && c.length > 0);
}
export function isLikelyDbLanguageFolder(dbPath: string) {
return !!path.basename(dbPath).startsWith('db-');
/**
* A language folder is any folder starting with `db-` that is itself not a database root.
*/
export async function isLikelyDbLanguageFolder(dbPath: string) {
return path.basename(dbPath).startsWith('db-') && !(await isLikelyDatabaseRoot(dbPath));
}
/**
@@ -581,11 +588,3 @@ export async function* walkDirectory(dir: string): AsyncIterableIterator<string>
}
}
}
/**
* Pluralizes a word.
* Example: Returns "N repository" if N is one, "N repositories" otherwise.
*/
export function pluralize(numItems: number | undefined, singular: string, plural: string): string {
return numItems ? `${numItems} ${numItems === 1 ? singular : plural}` : '';
}

View File

@@ -1,9 +1,13 @@
import { env } from 'vscode';
import * as path from 'path';
import { QueryHistoryConfig } from './config';
import { LocalQueryInfo, QueryHistoryInfo } from './query-results';
import { LocalQueryInfo } from './query-results';
import { buildRepoLabel, getRawQueryName, QueryHistoryInfo } from './query-history-info';
import { RemoteQueryHistoryItem } from './remote-queries/remote-query-history-item';
import { pluralize } from './helpers';
import { VariantAnalysisHistoryItem } from './remote-queries/variant-analysis-history-item';
import { assertNever } from './pure/helpers-pure';
import { pluralize } from './pure/word';
import { humanizeQueryStatus } from './query-status';
interface InterpolateReplacements {
t: string; // Start time
@@ -21,9 +25,20 @@ export class HistoryItemLabelProvider {
}
getLabel(item: QueryHistoryInfo) {
const replacements = item.t === 'local'
? this.getLocalInterpolateReplacements(item)
: this.getRemoteInterpolateReplacements(item);
let replacements: InterpolateReplacements;
switch (item.t) {
case 'local':
replacements = this.getLocalInterpolateReplacements(item);
break;
case 'remote':
replacements = this.getRemoteInterpolateReplacements(item);
break;
case 'variant-analysis':
replacements = this.getVariantAnalysisInterpolateReplacements(item);
break;
default:
assertNever(item);
}
const rawLabel = item.userSpecifiedLabel ?? (this.config.format || '%q');
@@ -39,9 +54,7 @@ export class HistoryItemLabelProvider {
getShortLabel(item: QueryHistoryInfo): string {
return item.userSpecifiedLabel
? this.getLabel(item)
: item.t === 'local'
? item.getQueryName()
: item.remoteQuery.queryName;
: getRawQueryName(item);
}
@@ -67,27 +80,29 @@ export class HistoryItemLabelProvider {
};
}
// Return the number of repositories queried if available. Otherwise, use the controller repository name.
private buildRepoLabel(item: RemoteQueryHistoryItem): string {
const repositoryCount = item.remoteQuery.repositoryCount;
if (repositoryCount) {
return pluralize(repositoryCount, 'repository', 'repositories');
}
return `${item.remoteQuery.controllerRepository.owner}/${item.remoteQuery.controllerRepository.name}`;
}
private getRemoteInterpolateReplacements(item: RemoteQueryHistoryItem): InterpolateReplacements {
const resultCount = item.resultCount ? `(${pluralize(item.resultCount, 'result', 'results')})` : '';
return {
t: new Date(item.remoteQuery.executionStartTime).toLocaleString(env.language),
q: `${item.remoteQuery.queryName} (${item.remoteQuery.language})`,
d: this.buildRepoLabel(item),
d: buildRepoLabel(item),
r: resultCount,
s: item.status,
s: humanizeQueryStatus(item.status),
f: path.basename(item.remoteQuery.queryFilePath),
'%': '%'
};
}
private getVariantAnalysisInterpolateReplacements(item: VariantAnalysisHistoryItem): InterpolateReplacements {
const resultCount = item.resultCount ? `(${pluralize(item.resultCount, 'result', 'results')})` : '';
return {
t: new Date(item.variantAnalysis.executionStartTime).toLocaleString(env.language),
q: `${item.variantAnalysis.query.name} (${item.variantAnalysis.query.language})`,
d: buildRepoLabel(item),
r: resultCount,
s: humanizeQueryStatus(item.status),
f: path.basename(item.variantAnalysis.query.filePath),
'%': '%',
};
}
}

View File

@@ -112,7 +112,7 @@ export function tryResolveLocation(
}
}
export type WebviewView = 'results' | 'compare' | 'remote-queries';
export type WebviewView = 'results' | 'compare' | 'remote-queries' | 'variant-analysis';
export interface WebviewMessage {
t: string;

View File

@@ -7,7 +7,7 @@ import {
languages,
Uri,
window as Window,
env
env, WebviewPanel
} from 'vscode';
import * as cli from './cli';
import { CodeQLCliServer } from './cli';
@@ -27,12 +27,12 @@ import {
ALERTS_TABLE_NAME,
GRAPH_TABLE_NAME,
RawResultsSortState,
NavigationDirection,
} from './pure/interface-types';
import { Logger } from './logging';
import * as messages from './pure/messages';
import { commandRunner } from './commandRunner';
import { CompletedQueryInfo, interpretResultsSarif, interpretGraphResults } from './query-results';
import { QueryEvaluationInfo } from './run-queries';
import { QueryEvaluationInfo } from './run-queries-shared';
import { parseSarifLocation, parseSarifPlainTextMessage } from './pure/sarif-utils';
import {
WebviewReveal,
@@ -44,7 +44,7 @@ import {
} from './interface-utils';
import { getDefaultResultSetName, ParsedResultSets } from './pure/interface-types';
import { RawResultSet, transformBqrsResultSet, ResultSetSchema } from './pure/bqrs-cli-types';
import { AbstractInterfaceManager, InterfacePanelConfig } from './abstract-interface-manager';
import { AbstractWebview, WebviewPanelConfig } from './abstract-webview';
import { PAGE_SIZE } from './config';
import { CompletedLocalQueryInfo } from './query-results';
import { HistoryItemLabelProvider } from './history-item-label-provider';
@@ -120,7 +120,7 @@ function numInterpretedPages(interpretation: Interpretation | undefined): number
return Math.ceil(n / pageSize);
}
export class InterfaceManager extends AbstractInterfaceManager<IntoResultsViewMsg, FromResultsViewMsg> {
export class ResultsView extends AbstractWebview<IntoResultsViewMsg, FromResultsViewMsg> {
private _displayedQuery?: CompletedLocalQueryInfo;
private _interpretation?: Interpretation;
@@ -142,19 +142,24 @@ export class InterfaceManager extends AbstractInterfaceManager<IntoResultsViewMs
this.handleSelectionChange.bind(this)
)
);
void logger.log('Registering path-step navigation commands.');
this.push(
commandRunner(
'codeQLQueryResults.nextPathStep',
this.navigatePathStep.bind(this, 1)
)
);
this.push(
commandRunner(
'codeQLQueryResults.previousPathStep',
this.navigatePathStep.bind(this, -1)
)
);
const navigationCommands = {
'codeQLQueryResults.up': NavigationDirection.up,
'codeQLQueryResults.down': NavigationDirection.down,
'codeQLQueryResults.left': NavigationDirection.left,
'codeQLQueryResults.right': NavigationDirection.right,
// For backwards compatibility with keybindings set using an earlier version of the extension.
'codeQLQueryResults.nextPathStep': NavigationDirection.down,
'codeQLQueryResults.previousPathStep': NavigationDirection.up,
};
void logger.log('Registering result view navigation commands.');
for (const [commandId, direction] of Object.entries(navigationCommands)) {
this.push(
commandRunner(
commandId,
this.navigateResultView.bind(this, direction)
)
);
}
this.push(
this.databaseManager.onDidChangeDatabaseItem(({ kind }) => {
@@ -170,11 +175,16 @@ export class InterfaceManager extends AbstractInterfaceManager<IntoResultsViewMs
);
}
async navigatePathStep(direction: number): Promise<void> {
await this.postMessage({ t: 'navigatePath', direction });
async navigateResultView(direction: NavigationDirection): Promise<void> {
if (!this.panel?.visible) {
return;
}
// Reveal the panel now as the subsequent call to 'Window.showTextEditor' in 'showLocation' may destroy the webview otherwise.
this.panel.reveal();
await this.postMessage({ t: 'navigate', direction });
}
protected getPanelConfig(): InterfacePanelConfig {
protected getPanelConfig(): WebviewPanelConfig {
return {
viewId: 'resultsView',
title: 'CodeQL Query Results',
@@ -191,7 +201,7 @@ export class InterfaceManager extends AbstractInterfaceManager<IntoResultsViewMs
protected async onMessage(msg: FromResultsViewMsg): Promise<void> {
try {
switch (msg.t) {
case 'resultViewLoaded':
case 'viewLoaded':
this.onWebViewLoaded();
break;
case 'viewSourceFile': {
@@ -327,10 +337,12 @@ export class InterfaceManager extends AbstractInterfaceManager<IntoResultsViewMs
forceReveal: WebviewReveal,
shouldKeepOldResultsWhileRendering = false
): Promise<void> {
if (fullQuery.completedQuery.result.resultType !== messages.QueryResultType.SUCCESS) {
if (!fullQuery.completedQuery.successful) {
return;
}
const panel = await this.getPanel();
this._interpretation = undefined;
const interpretationPage = await this.interpretResultsInfo(
fullQuery.completedQuery.query,
@@ -340,12 +352,11 @@ export class InterfaceManager extends AbstractInterfaceManager<IntoResultsViewMs
const sortedResultsMap: SortedResultsMap = {};
Object.entries(fullQuery.completedQuery.sortedResultsInfo).forEach(
([k, v]) =>
(sortedResultsMap[k] = this.convertPathPropertiesToWebviewUris(v))
(sortedResultsMap[k] = this.convertPathPropertiesToWebviewUris(panel, v))
);
this._displayedQuery = fullQuery;
const panel = this.getPanel();
await this.waitForPanelLoaded();
if (!panel.visible) {
if (forceReveal === WebviewReveal.Forced) {
@@ -416,6 +427,7 @@ export class InterfaceManager extends AbstractInterfaceManager<IntoResultsViewMs
interpretation: interpretationPage,
origResultsPaths: fullQuery.completedQuery.query.resultsPaths,
resultsPath: this.convertPathToWebviewUri(
panel,
fullQuery.completedQuery.query.resultsPaths.resultsPath
),
parsedResultSets,
@@ -488,10 +500,12 @@ export class InterfaceManager extends AbstractInterfaceManager<IntoResultsViewMs
throw new Error('trying to view a page of a query that is not loaded');
}
const panel = await this.getPanel();
const sortedResultsMap: SortedResultsMap = {};
Object.entries(results.completedQuery.sortedResultsInfo).forEach(
([k, v]) =>
(sortedResultsMap[k] = this.convertPathPropertiesToWebviewUris(v))
(sortedResultsMap[k] = this.convertPathPropertiesToWebviewUris(panel, v))
);
const resultSetSchemas = await this.getResultSetSchemas(results.completedQuery, sorted ? selectedTable : '');
@@ -534,6 +548,7 @@ export class InterfaceManager extends AbstractInterfaceManager<IntoResultsViewMs
interpretation: this._interpretation,
origResultsPaths: results.completedQuery.query.resultsPaths,
resultsPath: this.convertPathToWebviewUri(
panel,
results.completedQuery.query.resultsPaths.resultsPath
),
parsedResultSets,
@@ -802,15 +817,16 @@ export class InterfaceManager extends AbstractInterfaceManager<IntoResultsViewMs
this._diagnosticCollection.set(diagnostics);
}
private convertPathToWebviewUri(path: string): string {
return fileUriToWebviewUri(this.getPanel(), Uri.file(path));
private convertPathToWebviewUri(panel: WebviewPanel, path: string): string {
return fileUriToWebviewUri(panel, Uri.file(path));
}
private convertPathPropertiesToWebviewUris(
panel: WebviewPanel,
info: SortedResultSetInfo
): SortedResultSetInfo {
return {
resultsPath: this.convertPathToWebviewUri(info.resultsPath),
resultsPath: this.convertPathToWebviewUri(panel, info.resultsPath),
sortState: info.sortState,
};
}

View File

@@ -0,0 +1,30 @@
import { Logger } from './logging';
import * as cp from 'child_process';
import { Disposable } from 'vscode';
import { MessageConnection } from 'vscode-jsonrpc';
/** A running query server process and its associated message connection. */
export class ServerProcess implements Disposable {
child: cp.ChildProcess;
connection: MessageConnection;
logger: Logger;
constructor(child: cp.ChildProcess, connection: MessageConnection, private name: string, logger: Logger) {
this.child = child;
this.connection = connection;
this.logger = logger;
}
dispose(): void {
void this.logger.log(`Stopping ${this.name}...`);
this.connection.dispose();
this.child.stdin!.end();
this.child.stderr!.destroy();
// TODO kill the process if it doesn't terminate after a certain time limit.
// On Windows, we usually have to terminate the process before closing its stdout.
this.child.stdout!.destroy();
void this.logger.log(`Stopped ${this.name}.`);
}
}

View File

@@ -0,0 +1,65 @@
import { CancellationToken } from 'vscode';
import { ProgressCallback } from '../commandRunner';
import { DatabaseItem } from '../databases';
import { Dataset, deregisterDatabases, registerDatabases } from '../pure/legacy-messages';
import { InitialQueryInfo, LocalQueryInfo } from '../query-results';
import { QueryRunner } from '../queryRunner';
import { QueryWithResults } from '../run-queries-shared';
import { QueryServerClient } from './queryserver-client';
import { clearCacheInDatabase, compileAndRunQueryAgainstDatabase } from './run-queries';
import { upgradeDatabaseExplicit } from './upgrades';
export class LegacyQueryRunner extends QueryRunner {
constructor(public readonly qs: QueryServerClient) {
super();
}
get cliServer() {
return this.qs.cliServer;
}
async restartQueryServer(progress: ProgressCallback, token: CancellationToken): Promise<void> {
await this.qs.restartQueryServer(progress, token);
}
onStart(callBack: (progress: ProgressCallback, token: CancellationToken) => Promise<void>) {
this.qs.onDidStartQueryServer(callBack);
}
async clearCacheInDatabase(dbItem: DatabaseItem, progress: ProgressCallback, token: CancellationToken): Promise<void> {
await clearCacheInDatabase(this.qs, dbItem, progress, token);
}
async compileAndRunQueryAgainstDatabase(dbItem: DatabaseItem, initialInfo: InitialQueryInfo, queryStorageDir: string, progress: ProgressCallback, token: CancellationToken, templates?: Record<string, string>, queryInfo?: LocalQueryInfo): Promise<QueryWithResults> {
return await compileAndRunQueryAgainstDatabase(this.qs.cliServer, this.qs, dbItem, initialInfo, queryStorageDir, progress, token, templates, queryInfo);
}
async deregisterDatabase(progress: ProgressCallback, token: CancellationToken, dbItem: DatabaseItem): Promise<void> {
if (dbItem.contents && (await this.qs.cliServer.cliConstraints.supportsDatabaseRegistration())) {
const databases: Dataset[] = [{
dbDir: dbItem.contents.datasetUri.fsPath,
workingSet: 'default'
}];
await this.qs.sendRequest(deregisterDatabases, { databases }, token, progress);
}
}
async registerDatabase(progress: ProgressCallback, token: CancellationToken, dbItem: DatabaseItem): Promise<void> {
if (dbItem.contents && (await this.qs.cliServer.cliConstraints.supportsDatabaseRegistration())) {
const databases: Dataset[] = [{
dbDir: dbItem.contents.datasetUri.fsPath,
workingSet: 'default'
}];
await this.qs.sendRequest(registerDatabases, { databases }, token, progress);
}
}
async upgradeDatabaseExplicit(dbItem: DatabaseItem, progress: ProgressCallback, token: CancellationToken): Promise<void> {
await upgradeDatabaseExplicit(this.qs, dbItem, progress, token);
}
async clearPackCache(): Promise<void> {
/**
* Nothing needs to be done
*/
}
}

View File

@@ -1,49 +1,25 @@
import * as cp from 'child_process';
import * as path from 'path';
import * as fs from 'fs-extra';
import { DisposableObject } from './pure/disposable-object';
import { Disposable, CancellationToken, commands } from 'vscode';
import { createMessageConnection, MessageConnection, RequestType } from 'vscode-jsonrpc';
import * as cli from './cli';
import { QueryServerConfig } from './config';
import { Logger, ProgressReporter } from './logging';
import { completeQuery, EvaluationResult, progress, ProgressMessage, WithProgressId } from './pure/messages';
import * as messages from './pure/messages';
import { ProgressCallback, ProgressTask } from './commandRunner';
import { DisposableObject } from '../pure/disposable-object';
import { CancellationToken, commands } from 'vscode';
import { createMessageConnection, RequestType } from 'vscode-jsonrpc';
import * as cli from '../cli';
import { QueryServerConfig } from '../config';
import { Logger, ProgressReporter } from '../logging';
import { completeQuery, EvaluationResult, progress, ProgressMessage, WithProgressId } from '../pure/legacy-messages';
import * as messages from '../pure/legacy-messages';
import { ProgressCallback, ProgressTask } from '../commandRunner';
import { findQueryLogFile } from '../run-queries-shared';
import { ServerProcess } from '../json-rpc-server';
type WithProgressReporting = (task: (progress: ProgressReporter, token: CancellationToken) => Thenable<void>) => Thenable<void>;
type ServerOpts = {
logger: Logger;
contextStoragePath: string;
}
/** A running query server process and its associated message connection. */
class ServerProcess implements Disposable {
child: cp.ChildProcess;
connection: MessageConnection;
logger: Logger;
constructor(child: cp.ChildProcess, connection: MessageConnection, logger: Logger) {
this.child = child;
this.connection = connection;
this.logger = logger;
}
dispose(): void {
void this.logger.log('Stopping query server...');
this.connection.dispose();
this.child.stdin!.end();
this.child.stderr!.destroy();
// TODO kill the process if it doesn't terminate after a certain time limit.
// On Windows, we usually have to terminate the process before closing its stdout.
this.child.stdout!.destroy();
void this.logger.log('Stopped query server.');
}
}
type WithProgressReporting = (task: (progress: ProgressReporter, token: CancellationToken) => Thenable<void>) => Thenable<void>;
/**
* Client that manages a query server process.
* The server process is started upon initialization and tracked during its lifetime.
@@ -200,7 +176,7 @@ export class QueryServerClient extends DisposableObject {
callback(res);
}
});
this.serverProcess = new ServerProcess(child, connection, this.logger);
this.serverProcess = new ServerProcess(child, connection, 'Query server', this.logger);
// Ensure the server process is disposed together with this client.
this.track(this.serverProcess);
connection.listen();
@@ -254,27 +230,3 @@ export class QueryServerClient extends DisposableObject {
}
}
}
export function findQueryLogFile(resultPath: string): string {
return path.join(resultPath, 'query.log');
}
export function findQueryEvalLogFile(resultPath: string): string {
return path.join(resultPath, 'evaluator-log.jsonl');
}
export function findQueryEvalLogSummaryFile(resultPath: string): string {
return path.join(resultPath, 'evaluator-log.summary');
}
export function findJsonQueryEvalLogSummaryFile(resultPath: string): string {
return path.join(resultPath, 'evaluator-log.summary.jsonl');
}
export function findQueryEvalLogSummarySymbolsFile(resultPath: string): string {
return path.join(resultPath, 'evaluator-log.summary.symbols.json');
}
export function findQueryEvalLogEndSummaryFile(resultPath: string): string {
return path.join(resultPath, 'evaluator-log-end.summary');
}

View File

@@ -0,0 +1,526 @@
import * as crypto from 'crypto';
import * as fs from 'fs-extra';
import * as tmp from 'tmp-promise';
import * as path from 'path';
import {
CancellationToken,
Uri,
} from 'vscode';
import { ErrorCodes, ResponseError } from 'vscode-languageclient';
import * as cli from '../cli';
import { DatabaseItem, } from '../databases';
import {
getOnDiskWorkspaceFolders,
showAndLogErrorMessage,
showAndLogWarningMessage,
tryGetQueryMetadata,
upgradesTmpDir
} from '../helpers';
import { ProgressCallback } from '../commandRunner';
import { QueryMetadata } from '../pure/interface-types';
import { logger } from '../logging';
import * as messages from '../pure/legacy-messages';
import { InitialQueryInfo, LocalQueryInfo } from '../query-results';
import * as qsClient from './queryserver-client';
import { getErrorMessage } from '../pure/helpers-pure';
import { compileDatabaseUpgradeSequence, upgradeDatabaseExplicit } from './upgrades';
import { QueryEvaluationInfo, QueryWithResults } from '../run-queries-shared';
/**
* A collection of evaluation-time information about a query,
* including the query itself, and where we have decided to put
* temporary files associated with it, such as the compiled query
* output and results.
*/
export class QueryInProgress {
public queryEvalInfo: QueryEvaluationInfo;
/**
* Note that in the {@link slurpQueryHistory} method, we create a QueryEvaluationInfo instance
* by explicitly setting the prototype in order to avoid calling this constructor.
*/
constructor(
readonly querySaveDir: string,
readonly dbItemPath: string,
databaseHasMetadataFile: boolean,
readonly queryDbscheme: string, // the dbscheme file the query expects, based on library path resolution
readonly quickEvalPosition?: messages.Position,
readonly metadata?: QueryMetadata,
readonly templates?: Record<string, string>,
) {
this.queryEvalInfo = new QueryEvaluationInfo(querySaveDir, dbItemPath, databaseHasMetadataFile, quickEvalPosition, metadata);
/**/
}
get compiledQueryPath() {
return this.queryEvalInfo.compileQueryPath;
}
async run(
qs: qsClient.QueryServerClient,
upgradeQlo: string | undefined,
availableMlModels: cli.MlModelInfo[],
dbItem: DatabaseItem,
progress: ProgressCallback,
token: CancellationToken,
queryInfo?: LocalQueryInfo,
): Promise<messages.EvaluationResult> {
if (!dbItem.contents || dbItem.error) {
throw new Error('Can\'t run query on invalid database.');
}
let result: messages.EvaluationResult | null = null;
const callbackId = qs.registerCallback(res => {
result = {
...res,
logFileLocation: this.queryEvalInfo.logPath
};
});
const availableMlModelUris: messages.MlModel[] = availableMlModels.map(model => ({ uri: Uri.file(model.path).toString(true) }));
const queryToRun: messages.QueryToRun = {
resultsPath: this.queryEvalInfo.resultsPaths.resultsPath,
qlo: Uri.file(this.compiledQueryPath).toString(),
compiledUpgrade: upgradeQlo && Uri.file(upgradeQlo).toString(),
allowUnknownTemplates: true,
templateValues: createSimpleTemplates(this.templates),
availableMlModels: availableMlModelUris,
id: callbackId,
timeoutSecs: qs.config.timeoutSecs,
};
const dataset: messages.Dataset = {
dbDir: dbItem.contents.datasetUri.fsPath,
workingSet: 'default'
};
if (queryInfo && await qs.cliServer.cliConstraints.supportsPerQueryEvalLog()) {
await qs.sendRequest(messages.startLog, {
db: dataset,
logPath: this.queryEvalInfo.evalLogPath,
});
}
const params: messages.EvaluateQueriesParams = {
db: dataset,
evaluateId: callbackId,
queries: [queryToRun],
stopOnError: false,
useSequenceHint: false
};
try {
await qs.sendRequest(messages.runQueries, params, token, progress);
if (qs.config.customLogDirectory) {
void showAndLogWarningMessage(
`Custom log directories are no longer supported. The "codeQL.runningQueries.customLogDirectory" setting is deprecated. Unset the setting to stop seeing this message. Query logs saved to ${this.queryEvalInfo.logPath}.`
);
}
} finally {
qs.unRegisterCallback(callbackId);
if (queryInfo && await qs.cliServer.cliConstraints.supportsPerQueryEvalLog()) {
await qs.sendRequest(messages.endLog, {
db: dataset,
logPath: this.queryEvalInfo.evalLogPath,
});
if (await this.queryEvalInfo.hasEvalLog()) {
await this.queryEvalInfo.addQueryLogs(queryInfo, qs.cliServer, qs.logger);
} else {
void showAndLogWarningMessage(`Failed to write structured evaluator log to ${this.queryEvalInfo.evalLogPath}.`);
}
}
}
return result || {
evaluationTime: 0,
message: 'No result from server',
queryId: -1,
runId: callbackId,
resultType: messages.QueryResultType.OTHER_ERROR
};
}
async compile(
qs: qsClient.QueryServerClient,
program: messages.QlProgram,
progress: ProgressCallback,
token: CancellationToken,
): Promise<messages.CompilationMessage[]> {
let compiled: messages.CheckQueryResult | undefined;
try {
const target = this.quickEvalPosition ? {
quickEval: { quickEvalPos: this.quickEvalPosition }
} : { query: {} };
const params: messages.CompileQueryParams = {
compilationOptions: {
computeNoLocationUrls: true,
failOnWarnings: false,
fastCompilation: false,
includeDilInQlo: true,
localChecking: false,
noComputeGetUrl: false,
noComputeToString: false,
computeDefaultStrings: true,
emitDebugInfo: true
},
extraOptions: {
timeoutSecs: qs.config.timeoutSecs
},
queryToCheck: program,
resultPath: this.compiledQueryPath,
target,
};
compiled = await qs.sendRequest(messages.compileQuery, params, token, progress);
} finally {
void qs.logger.log(' - - - COMPILATION DONE - - - ', { additionalLogLocation: this.queryEvalInfo.logPath });
}
return (compiled?.messages || []).filter(msg => msg.severity === messages.Severity.ERROR);
}
}
export async function clearCacheInDatabase(
qs: qsClient.QueryServerClient,
dbItem: DatabaseItem,
progress: ProgressCallback,
token: CancellationToken,
): Promise<messages.ClearCacheResult> {
if (dbItem.contents === undefined) {
throw new Error('Can\'t clear the cache in an invalid database.');
}
const db: messages.Dataset = {
dbDir: dbItem.contents.datasetUri.fsPath,
workingSet: 'default',
};
const params: messages.ClearCacheParams = {
dryRun: false,
db,
};
return qs.sendRequest(messages.clearCache, params, token, progress);
}
/**
* Compare the dbscheme implied by the query `query` and that of the current database.
* - If they are compatible, do nothing.
* - If they are incompatible but the database can be upgraded, suggest that upgrade.
* - If they are incompatible and the database cannot be upgraded, throw an error.
*/
async function checkDbschemeCompatibility(
cliServer: cli.CodeQLCliServer,
qs: qsClient.QueryServerClient,
query: QueryInProgress,
qlProgram: messages.QlProgram,
dbItem: DatabaseItem,
progress: ProgressCallback,
token: CancellationToken,
): Promise<void> {
const searchPath = getOnDiskWorkspaceFolders();
if (dbItem.contents?.dbSchemeUri !== undefined) {
const { finalDbscheme } = await cliServer.resolveUpgrades(dbItem.contents.dbSchemeUri.fsPath, searchPath, false);
const hash = async function(filename: string): Promise<string> {
return crypto.createHash('sha256').update(await fs.readFile(filename)).digest('hex');
};
// At this point, we have learned about three dbschemes:
// the dbscheme of the actual database we're querying.
const dbschemeOfDb = await hash(dbItem.contents.dbSchemeUri.fsPath);
// the dbscheme of the query we're running, including the library we've resolved it to use.
const dbschemeOfLib = await hash(query.queryDbscheme);
// the database we're able to upgrade to
const upgradableTo = await hash(finalDbscheme);
if (upgradableTo != dbschemeOfLib) {
reportNoUpgradePath(qlProgram, query);
}
if (upgradableTo == dbschemeOfLib &&
dbschemeOfDb != dbschemeOfLib) {
// Try to upgrade the database
await upgradeDatabaseExplicit(
qs,
dbItem,
progress,
token
);
}
}
}
function reportNoUpgradePath(qlProgram: messages.QlProgram, query: QueryInProgress): void {
throw new Error(
`Query ${qlProgram.queryPath} expects database scheme ${query.queryDbscheme}, but the current database has a different scheme, and no database upgrades are available. The current database scheme may be newer than the CodeQL query libraries in your workspace.\n\nPlease try using a newer version of the query libraries.`
);
}
/**
* Compile a non-destructive upgrade.
*/
async function compileNonDestructiveUpgrade(
qs: qsClient.QueryServerClient,
upgradeTemp: tmp.DirectoryResult,
query: QueryInProgress,
qlProgram: messages.QlProgram,
dbItem: DatabaseItem,
progress: ProgressCallback,
token: CancellationToken,
): Promise<string> {
if (!dbItem?.contents?.dbSchemeUri) {
throw new Error('Database is invalid, and cannot be upgraded.');
}
// When packaging is used, dependencies may exist outside of the workspace and they are always on the resolved search path.
// When packaging is not used, all dependencies are in the workspace.
const upgradesPath = (await qs.cliServer.cliConstraints.supportsPackaging())
? qlProgram.libraryPath
: getOnDiskWorkspaceFolders();
const { scripts, matchesTarget } = await qs.cliServer.resolveUpgrades(
dbItem.contents.dbSchemeUri.fsPath,
upgradesPath,
true,
query.queryDbscheme
);
if (!matchesTarget) {
reportNoUpgradePath(qlProgram, query);
}
const result = await compileDatabaseUpgradeSequence(qs, dbItem, scripts, upgradeTemp, progress, token);
if (result.compiledUpgrade === undefined) {
const error = result.error || '[no error message available]';
throw new Error(error);
}
// We can upgrade to the actual target
qlProgram.dbschemePath = query.queryDbscheme;
// We are new enough that we will always support single file upgrades.
return result.compiledUpgrade;
}
export async function compileAndRunQueryAgainstDatabase(
cliServer: cli.CodeQLCliServer,
qs: qsClient.QueryServerClient,
dbItem: DatabaseItem,
initialInfo: InitialQueryInfo,
queryStorageDir: string,
progress: ProgressCallback,
token: CancellationToken,
templates?: Record<string, string>,
queryInfo?: LocalQueryInfo, // May be omitted for queries not initiated by the user. If omitted we won't create a structured log for the query.
): Promise<QueryWithResults> {
if (!dbItem.contents || !dbItem.contents.dbSchemeUri) {
throw new Error(`Database ${dbItem.databaseUri} does not have a CodeQL database scheme.`);
}
// Get the workspace folder paths.
const diskWorkspaceFolders = getOnDiskWorkspaceFolders();
// Figure out the library path for the query.
const packConfig = await cliServer.resolveLibraryPath(diskWorkspaceFolders, initialInfo.queryPath);
if (!packConfig.dbscheme) {
throw new Error('Could not find a database scheme for this query. Please check that you have a valid qlpack.yml file for this query, which refers to a database scheme either in the `dbscheme` field or through one of its dependencies.');
}
// Check whether the query has an entirely different schema from the
// database. (Queries that merely need the database to be upgraded
// won't trigger this check)
// This test will produce confusing results if we ever change the name of the database schema files.
const querySchemaName = path.basename(packConfig.dbscheme);
const dbSchemaName = path.basename(dbItem.contents.dbSchemeUri.fsPath);
if (querySchemaName != dbSchemaName) {
void logger.log(`Query schema was ${querySchemaName}, but database schema was ${dbSchemaName}.`);
throw new Error(`The query ${path.basename(initialInfo.queryPath)} cannot be run against the selected database (${dbItem.name}): their target languages are different. Please select a different database and try again.`);
}
const qlProgram: messages.QlProgram = {
// The project of the current document determines which library path
// we use. The `libraryPath` field in this server message is relative
// to the workspace root, not to the project root.
libraryPath: packConfig.libraryPath,
// Since we are compiling and running a query against a database,
// we use the database's DB scheme here instead of the DB scheme
// from the current document's project.
dbschemePath: dbItem.contents.dbSchemeUri.fsPath,
queryPath: initialInfo.queryPath
};
// Read the query metadata if possible, to use in the UI.
const metadata = await tryGetQueryMetadata(cliServer, qlProgram.queryPath);
let availableMlModels: cli.MlModelInfo[] = [];
if (!await cliServer.cliConstraints.supportsResolveMlModels()) {
void logger.log('Resolving ML models is unsupported by this version of the CLI. Running the query without any ML models.');
} else {
try {
availableMlModels = (await cliServer.resolveMlModels(diskWorkspaceFolders, initialInfo.queryPath)).models;
if (availableMlModels.length) {
void logger.log(`Found available ML models at the following paths: ${availableMlModels.map(x => `'${x.path}'`).join(', ')}.`);
} else {
void logger.log('Did not find any available ML models.');
}
} catch (e) {
const message = `Couldn't resolve available ML models for ${qlProgram.queryPath}. Running the ` +
`query without any ML models: ${e}.`;
void showAndLogErrorMessage(message);
}
}
const hasMetadataFile = (await dbItem.hasMetadataFile());
const query = new QueryInProgress(
path.join(queryStorageDir, initialInfo.id),
dbItem.databaseUri.fsPath,
hasMetadataFile,
packConfig.dbscheme,
initialInfo.quickEvalPosition,
metadata,
templates
);
await query.queryEvalInfo.createTimestampFile();
let upgradeDir: tmp.DirectoryResult | undefined;
try {
let upgradeQlo;
if (await cliServer.cliConstraints.supportsNonDestructiveUpgrades()) {
upgradeDir = await tmp.dir({ dir: upgradesTmpDir, unsafeCleanup: true });
upgradeQlo = await compileNonDestructiveUpgrade(qs, upgradeDir, query, qlProgram, dbItem, progress, token);
} else {
await checkDbschemeCompatibility(cliServer, qs, query, qlProgram, dbItem, progress, token);
}
let errors;
try {
errors = await query.compile(qs, qlProgram, progress, token);
} catch (e) {
if (e instanceof ResponseError && e.code == ErrorCodes.RequestCancelled) {
return createSyntheticResult(query, 'Query cancelled');
} else {
throw e;
}
}
if (errors.length === 0) {
const result = await query.run(qs, upgradeQlo, availableMlModels, dbItem, progress, token, queryInfo);
if (result.resultType !== messages.QueryResultType.SUCCESS) {
const message = result.message || 'Failed to run query';
void logger.log(message);
void showAndLogErrorMessage(message);
}
const message = formatLegacyMessage(result);
return {
query: query.queryEvalInfo,
message,
result,
successful: result.resultType == messages.QueryResultType.SUCCESS,
logFileLocation: result.logFileLocation,
dispose: () => {
qs.logger.removeAdditionalLogLocation(result.logFileLocation);
}
};
} else {
// Error dialogs are limited in size and scrollability,
// so we include a general description of the problem,
// and direct the user to the output window for the detailed compilation messages.
// However we don't show quick eval errors there so we need to display them anyway.
void qs.logger.log(
`Failed to compile query ${initialInfo.queryPath} against database scheme ${qlProgram.dbschemePath}:`,
{ additionalLogLocation: query.queryEvalInfo.logPath }
);
const formattedMessages: string[] = [];
for (const error of errors) {
const message = error.message || '[no error message available]';
const formatted = `ERROR: ${message} (${error.position.fileName}:${error.position.line}:${error.position.column}:${error.position.endLine}:${error.position.endColumn})`;
formattedMessages.push(formatted);
void qs.logger.log(formatted, { additionalLogLocation: query.queryEvalInfo.logPath });
}
if (initialInfo.isQuickEval && formattedMessages.length <= 2) {
// If there are more than 2 error messages, they will not be displayed well in a popup
// and will be trimmed by the function displaying the error popup. Accordingly, we only
// try to show the errors if there are 2 or less, otherwise we direct the user to the log.
void showAndLogErrorMessage('Quick evaluation compilation failed: ' + formattedMessages.join('\n'));
} else {
void showAndLogErrorMessage((initialInfo.isQuickEval ? 'Quick evaluation' : 'Query') + compilationFailedErrorTail);
}
return createSyntheticResult(query, 'Query had compilation errors');
}
} finally {
try {
await upgradeDir?.cleanup();
} catch (e) {
void qs.logger.log(
`Could not clean up the upgrades dir. Reason: ${getErrorMessage(e)}`,
{ additionalLogLocation: query.queryEvalInfo.logPath }
);
}
}
}
const compilationFailedErrorTail = ' compilation failed. Please make sure there are no errors in the query, the database is up to date,' +
' and the query and database use the same target language. For more details on the error, go to View > Output,' +
' and choose CodeQL Query Server from the dropdown.';
export function formatLegacyMessage(result: messages.EvaluationResult) {
switch (result.resultType) {
case messages.QueryResultType.CANCELLATION:
return `cancelled after ${Math.round(result.evaluationTime / 1000)} seconds`;
case messages.QueryResultType.OOM:
return 'out of memory';
case messages.QueryResultType.SUCCESS:
return `finished in ${Math.round(result.evaluationTime / 1000)} seconds`;
case messages.QueryResultType.TIMEOUT:
return `timed out after ${Math.round(result.evaluationTime / 1000)} seconds`;
case messages.QueryResultType.OTHER_ERROR:
default:
return result.message ? `failed: ${result.message}` : 'failed';
}
}
/**
* Create a synthetic result for a query that failed to compile.
*/
function createSyntheticResult(
query: QueryInProgress,
message: string,
): QueryWithResults {
return {
query: query.queryEvalInfo,
message,
result: {
evaluationTime: 0,
queryId: 0,
resultType: messages.QueryResultType.OTHER_ERROR,
message,
runId: 0,
},
successful: false,
dispose: () => { /**/ },
};
}
function createSimpleTemplates(templates: Record<string, string> | undefined): messages.TemplateDefinitions | undefined {
if (!templates) {
return undefined;
}
const result: messages.TemplateDefinitions = {};
for (const key of Object.keys(templates)) {
result[key] = {
values: {
tuples: [[{ stringValue: templates[key] }]]
}
};
}
return result;
}

View File

@@ -1,13 +1,12 @@
import * as vscode from 'vscode';
import { getOnDiskWorkspaceFolders, showAndLogErrorMessage, tmpDir } from './helpers';
import { ProgressCallback, UserCancellationException } from './commandRunner';
import { logger } from './logging';
import * as messages from './pure/messages';
import { getOnDiskWorkspaceFolders, showAndLogErrorMessage, tmpDir } from '../helpers';
import { ProgressCallback, UserCancellationException } from '../commandRunner';
import { logger } from '../logging';
import * as messages from '../pure/legacy-messages';
import * as qsClient from './queryserver-client';
import * as tmp from 'tmp-promise';
import * as path from 'path';
import * as semver from 'semver';
import { DatabaseItem } from './databases';
import { DatabaseItem } from '../databases';
/**
* Maximum number of lines to include from database upgrade message,
@@ -16,17 +15,6 @@ import { DatabaseItem } from './databases';
*/
const MAX_UPGRADE_MESSAGE_LINES = 10;
/**
* Check that we support non-destructive upgrades.
*
* This requires 3 features. The ability to compile an upgrade sequence; The ability to
* run a non-destructive upgrades as a query; the ability to specify a target when
* resolving upgrades. We check for a version of codeql that has all three features.
*/
export async function hasNondestructiveUpgradeCapabilities(qs: qsClient.QueryServerClient): Promise<boolean> {
return semver.gte(await qs.cliServer.getVersion(), '2.4.2');
}
/**
* Compile a database upgrade sequence.
@@ -43,7 +31,7 @@ export async function compileDatabaseUpgradeSequence(
if (dbItem.contents === undefined || dbItem.contents.dbSchemeUri === undefined) {
throw new Error('Database is invalid, and cannot be upgraded.');
}
if (!await hasNondestructiveUpgradeCapabilities(qs)) {
if (!await qs.cliServer.cliConstraints.supportsNonDestructiveUpgrades()) {
throw new Error('The version of codeql is too old to run non-destructive upgrades.');
}
// If possible just compile the upgrade sequence
@@ -205,7 +193,14 @@ export async function upgradeDatabaseExplicit(
void qs.logger.log('Running the following database upgrade:');
getUpgradeDescriptions(compileUpgradeResult.compiledUpgrades).map(s => s.description).join('\n');
return await runDatabaseUpgrade(qs, dbItem, compileUpgradeResult.compiledUpgrades, progress, token);
const result = await runDatabaseUpgrade(qs, dbItem, compileUpgradeResult.compiledUpgrades, progress, token);
// TODO Can remove the next lines when https://github.com/github/codeql-team/issues/1241 is fixed
// restart the query server to avoid a bug in the CLI where the upgrade is applied, but the old dbscheme
// is still cached in memory.
await qs.restartQueryServer(progress, token);
return result;
}
catch (e) {
void showAndLogErrorMessage(`Database upgrade failed: ${e}`);

View File

@@ -2,13 +2,11 @@ import * as I from 'immutable';
import { EvaluationLogProblemReporter, EvaluationLogScanner, EvaluationLogScannerProvider } from './log-scanner';
import { InLayer, ComputeRecursive, SummaryEvent, PipelineRun, ComputeSimple } from './log-summary';
const DEFAULT_WARNING_THRESHOLD = 50;
/**
* Like `max`, but returns 0 if no meaningful maximum can be computed.
*/
function safeMax(it: Iterable<number>) {
const m = Math.max(...it);
function safeMax(it?: Iterable<number>) {
const m = Math.max(...(it || []));
return Number.isFinite(m) ? m : 0;
}
@@ -454,7 +452,11 @@ class JoinOrderScanner implements EvaluationLogScanner {
}
export class JoinOrderScannerProvider implements EvaluationLogScannerProvider {
constructor(private readonly getThreshdold: () => number) {
}
public createScanner(problemReporter: EvaluationLogProblemReporter): EvaluationLogScanner {
return new JoinOrderScanner(problemReporter, DEFAULT_WARNING_THRESHOLD);
const threshold = this.getThreshdold();
return new JoinOrderScanner(problemReporter, threshold);
}
}

View File

@@ -1,7 +1,7 @@
import { Diagnostic, DiagnosticSeverity, languages, Range, Uri } from 'vscode';
import { DisposableObject } from '../pure/disposable-object';
import { QueryHistoryManager } from '../query-history';
import { QueryHistoryInfo } from '../query-results';
import { QueryHistoryInfo } from '../query-history-info';
import { EvaluationLogProblemReporter, EvaluationLogScannerSet } from './log-scanner';
import { PipelineInfo, SummarySymbols } from './summary-parser';
import * as fs from 'fs-extra';

View File

@@ -0,0 +1,102 @@
import { Repository } from '../remote-queries/gh-api/repository';
import { VariantAnalysis, VariantAnalysisRepoTask } from '../remote-queries/gh-api/variant-analysis';
// Types that represent requests/responses from the GitHub API
// that we need to mock.
export enum RequestKind {
GetRepo = 'getRepo',
SubmitVariantAnalysis = 'submitVariantAnalysis',
GetVariantAnalysis = 'getVariantAnalysis',
GetVariantAnalysisRepo = 'getVariantAnalysisRepo',
GetVariantAnalysisRepoResult = 'getVariantAnalysisRepoResult',
}
export interface BasicErorResponse {
message: string;
}
export interface GetRepoRequest {
request: {
kind: RequestKind.GetRepo
},
response: {
status: number,
body: Repository | BasicErorResponse | undefined
}
}
export interface SubmitVariantAnalysisRequest {
request: {
kind: RequestKind.SubmitVariantAnalysis
},
response: {
status: number,
body?: VariantAnalysis | BasicErorResponse
}
}
export interface GetVariantAnalysisRequest {
request: {
kind: RequestKind.GetVariantAnalysis
},
response: {
status: number,
body?: VariantAnalysis | BasicErorResponse
}
}
export interface GetVariantAnalysisRepoRequest {
request: {
kind: RequestKind.GetVariantAnalysisRepo,
repositoryId: number
},
response: {
status: number,
body?: VariantAnalysisRepoTask | BasicErorResponse
}
}
export interface GetVariantAnalysisRepoResultRequest {
request: {
kind: RequestKind.GetVariantAnalysisRepoResult,
repositoryId: number
},
response: {
status: number,
body?: Buffer | string,
contentType: string,
}
}
export type GitHubApiRequest =
| GetRepoRequest
| SubmitVariantAnalysisRequest
| GetVariantAnalysisRequest
| GetVariantAnalysisRepoRequest
| GetVariantAnalysisRepoResultRequest;
export const isGetRepoRequest = (
request: GitHubApiRequest
): request is GetRepoRequest =>
request.request.kind === RequestKind.GetRepo;
export const isSubmitVariantAnalysisRequest = (
request: GitHubApiRequest
): request is SubmitVariantAnalysisRequest =>
request.request.kind === RequestKind.SubmitVariantAnalysis;
export const isGetVariantAnalysisRequest = (
request: GitHubApiRequest
): request is GetVariantAnalysisRequest =>
request.request.kind === RequestKind.GetVariantAnalysis;
export const isGetVariantAnalysisRepoRequest = (
request: GitHubApiRequest
): request is GetVariantAnalysisRepoRequest =>
request.request.kind === RequestKind.GetVariantAnalysisRepo;
export const isGetVariantAnalysisRepoResultRequest = (
request: GitHubApiRequest
): request is GetVariantAnalysisRepoResultRequest =>
request.request.kind === RequestKind.GetVariantAnalysisRepoResult;

View File

@@ -0,0 +1,139 @@
import * as path from 'path';
import * as fs from 'fs-extra';
import { setupServer, SetupServerApi } from 'msw/node';
import { DisposableObject } from '../pure/disposable-object';
import { Recorder } from './recorder';
import { createRequestHandlers } from './request-handlers';
import { getDirectoryNamesInsidePath } from '../pure/files';
/**
* Enables mocking of the GitHub API server via HTTP interception, using msw.
*/
export class MockGitHubApiServer extends DisposableObject {
private _isListening: boolean;
private readonly server: SetupServerApi;
private readonly recorder: Recorder;
constructor() {
super();
this._isListening = false;
this.server = setupServer();
this.recorder = this.push(new Recorder(this.server));
}
public startServer(): void {
if (this._isListening) {
return;
}
this.server.listen();
this._isListening = true;
}
public stopServer(): void {
this.server.close();
this._isListening = false;
}
public async loadScenario(scenarioName: string, scenariosPath?: string): Promise<void> {
if (!scenariosPath) {
scenariosPath = await this.getDefaultScenariosPath();
if (!scenariosPath) {
return;
}
}
const scenarioPath = path.join(scenariosPath, scenarioName);
const handlers = await createRequestHandlers(scenarioPath);
this.server.resetHandlers();
this.server.use(...handlers);
}
public async saveScenario(scenarioName: string, scenariosPath?: string): Promise<string> {
if (!scenariosPath) {
scenariosPath = await this.getDefaultScenariosPath();
if (!scenariosPath) {
throw new Error('Could not find scenarios path');
}
}
const filePath = await this.recorder.save(scenariosPath, scenarioName);
await this.stopRecording();
return filePath;
}
public async unloadScenario(): Promise<void> {
if (!this.isScenarioLoaded) {
return;
}
await this.unloadAllScenarios();
}
public async startRecording(): Promise<void> {
if (this.recorder.isRecording) {
return;
}
if (this.isScenarioLoaded) {
await this.unloadAllScenarios();
}
this.recorder.start();
}
public async stopRecording(): Promise<void> {
await this.recorder.stop();
await this.recorder.clear();
}
public async getScenarioNames(scenariosPath?: string): Promise<string[]> {
if (!scenariosPath) {
scenariosPath = await this.getDefaultScenariosPath();
if (!scenariosPath) {
return [];
}
}
return await getDirectoryNamesInsidePath(scenariosPath);
}
public get isListening(): boolean {
return this._isListening;
}
public get isRecording(): boolean {
return this.recorder.isRecording;
}
public get anyRequestsRecorded(): boolean {
return this.recorder.anyRequestsRecorded;
}
public get isScenarioLoaded(): boolean {
return this.server.listHandlers().length > 0;
}
public async getDefaultScenariosPath(): Promise<string | undefined> {
// This should be the directory where package.json is located
const rootDirectory = path.resolve(__dirname, '../..');
const scenariosPath = path.resolve(rootDirectory, 'src/mocks/scenarios');
if (await fs.pathExists(scenariosPath)) {
return scenariosPath;
}
return undefined;
}
private async unloadAllScenarios(): Promise<void> {
this.server.resetHandlers();
}
}

View File

@@ -0,0 +1,220 @@
import * as fs from 'fs-extra';
import * as path from 'path';
import { MockedRequest } from 'msw';
import { SetupServerApi } from 'msw/node';
import { IsomorphicResponse } from '@mswjs/interceptors';
import { Headers } from 'headers-polyfill';
import fetch from 'node-fetch';
import { DisposableObject } from '../pure/disposable-object';
import { GetVariantAnalysisRepoResultRequest, GitHubApiRequest, RequestKind } from './gh-api-request';
export class Recorder extends DisposableObject {
private readonly allRequests = new Map<string, MockedRequest>();
private currentRecordedScenario: GitHubApiRequest[] = [];
private _isRecording = false;
constructor(
private readonly server: SetupServerApi,
) {
super();
this.onRequestStart = this.onRequestStart.bind(this);
this.onResponseBypass = this.onResponseBypass.bind(this);
}
public get isRecording(): boolean {
return this._isRecording;
}
public get anyRequestsRecorded(): boolean {
return this.currentRecordedScenario.length > 0;
}
public start(): void {
if (this._isRecording) {
return;
}
this._isRecording = true;
this.clear();
this.server.events.on('request:start', this.onRequestStart);
this.server.events.on('response:bypass', this.onResponseBypass);
}
public stop(): void {
if (!this._isRecording) {
return;
}
this._isRecording = false;
this.server.events.removeListener('request:start', this.onRequestStart);
this.server.events.removeListener('response:bypass', this.onResponseBypass);
}
public clear() {
this.currentRecordedScenario = [];
this.allRequests.clear();
}
public async save(scenariosPath: string, name: string): Promise<string> {
const scenarioDirectory = path.join(scenariosPath, name);
await fs.ensureDir(scenarioDirectory);
for (let i = 0; i < this.currentRecordedScenario.length; i++) {
const request = this.currentRecordedScenario[i];
const fileName = `${i}-${request.request.kind}.json`;
const filePath = path.join(scenarioDirectory, fileName);
let writtenRequest = {
...request
};
if (shouldWriteBodyToFile(writtenRequest)) {
const extension = writtenRequest.response.contentType === 'application/zip' ? 'zip' : 'bin';
const bodyFileName = `${i}-${writtenRequest.request.kind}.body.${extension}`;
const bodyFilePath = path.join(scenarioDirectory, bodyFileName);
await fs.writeFile(bodyFilePath, writtenRequest.response.body);
writtenRequest = {
...writtenRequest,
response: {
...writtenRequest.response,
body: `file:${bodyFileName}`,
},
};
}
await fs.writeFile(filePath, JSON.stringify(writtenRequest, null, 2));
}
this.stop();
return scenarioDirectory;
}
private onRequestStart(request: MockedRequest): void {
if (request.headers.has('x-vscode-codeql-msw-bypass')) {
return;
}
this.allRequests.set(request.id, request);
}
private async onResponseBypass(response: IsomorphicResponse, requestId: string): Promise<void> {
const request = this.allRequests.get(requestId);
this.allRequests.delete(requestId);
if (!request) {
return;
}
if (response.body === undefined) {
return;
}
const gitHubApiRequest = await createGitHubApiRequest(request.url.toString(), response.status, response.body, response.headers);
if (!gitHubApiRequest) {
return;
}
this.currentRecordedScenario.push(gitHubApiRequest);
}
}
async function createGitHubApiRequest(url: string, status: number, body: string, headers: Headers): Promise<GitHubApiRequest | undefined> {
if (!url) {
return undefined;
}
if (url.match(/\/repos\/[a-zA-Z0-9-_.]+\/[a-zA-Z0-9-_.]+$/)) {
return {
request: {
kind: RequestKind.GetRepo,
},
response: {
status,
body: JSON.parse(body),
},
};
}
if (url.match(/\/repositories\/\d+\/code-scanning\/codeql\/variant-analyses$/)) {
return {
request: {
kind: RequestKind.SubmitVariantAnalysis,
},
response: {
status,
body: JSON.parse(body),
},
};
}
if (url.match(/\/repositories\/\d+\/code-scanning\/codeql\/variant-analyses\/\d+$/)) {
return {
request: {
kind: RequestKind.GetVariantAnalysis,
},
response: {
status,
body: JSON.parse(body),
},
};
}
const repoTaskMatch = url.match(/\/repositories\/\d+\/code-scanning\/codeql\/variant-analyses\/\d+\/repositories\/(?<repositoryId>\d+)$/);
if (repoTaskMatch?.groups?.repositoryId) {
return {
request: {
kind: RequestKind.GetVariantAnalysisRepo,
repositoryId: parseInt(repoTaskMatch.groups.repositoryId, 10),
},
response: {
status,
body: JSON.parse(body),
},
};
}
// if url is a download URL for a variant analysis result, then it's a get-variant-analysis-repoResult.
const repoDownloadMatch = url.match(/objects-origin\.githubusercontent\.com\/codeql-query-console\/codeql-variant-analysis-repo-tasks\/\d+\/(?<repositoryId>\d+)/);
if (repoDownloadMatch?.groups?.repositoryId) {
// msw currently doesn't support binary response bodies, so we need to download this separately
// see https://github.com/mswjs/interceptors/blob/15eafa6215a328219999403e3ff110e71699b016/src/interceptors/ClientRequest/utils/getIncomingMessageBody.ts#L24-L33
// Essentially, mws is trying to decode a ZIP file as UTF-8 which changes the bytes and corrupts the file.
const response = await fetch(url, {
headers: {
// We need to ensure we don't end up in an infinite loop, since this request will also be intercepted
'x-vscode-codeql-msw-bypass': 'true',
},
});
const responseBuffer = await response.buffer();
return {
request: {
kind: RequestKind.GetVariantAnalysisRepoResult,
repositoryId: parseInt(repoDownloadMatch.groups.repositoryId, 10),
},
response: {
status,
body: responseBuffer,
contentType: headers.get('content-type') ?? 'application/octet-stream',
}
};
}
return undefined;
}
function shouldWriteBodyToFile(request: GitHubApiRequest): request is GetVariantAnalysisRepoResultRequest {
return request.response.body instanceof Buffer;
}

View File

@@ -0,0 +1,156 @@
import * as path from 'path';
import * as fs from 'fs-extra';
import { DefaultBodyType, MockedRequest, rest, RestHandler } from 'msw';
import {
GitHubApiRequest,
isGetRepoRequest,
isGetVariantAnalysisRepoRequest,
isGetVariantAnalysisRepoResultRequest,
isGetVariantAnalysisRequest,
isSubmitVariantAnalysisRequest
} from './gh-api-request';
const baseUrl = 'https://api.github.com';
export type RequestHandler = RestHandler<MockedRequest<DefaultBodyType>>;
export async function createRequestHandlers(scenarioDirPath: string): Promise<RequestHandler[]> {
const requests = await readRequestFiles(scenarioDirPath);
const handlers = [
createGetRepoRequestHandler(requests),
createSubmitVariantAnalysisRequestHandler(requests),
createGetVariantAnalysisRequestHandler(requests),
createGetVariantAnalysisRepoRequestHandler(requests),
createGetVariantAnalysisRepoResultRequestHandler(requests),
];
return handlers;
}
async function readRequestFiles(scenarioDirPath: string): Promise<GitHubApiRequest[]> {
const files = await fs.readdir(scenarioDirPath);
const orderedFiles = files.sort((a, b) => {
const aNum = parseInt(a.split('-')[0]);
const bNum = parseInt(b.split('-')[0]);
return aNum - bNum;
});
const requests: GitHubApiRequest[] = [];
for (const file of orderedFiles) {
if (!file.endsWith('.json')) {
continue;
}
const filePath = path.join(scenarioDirPath, file);
const request: GitHubApiRequest = await fs.readJson(filePath, { encoding: 'utf8' });
if (typeof request.response.body === 'string' && request.response.body.startsWith('file:')) {
request.response.body = await fs.readFile(path.join(scenarioDirPath, request.response.body.substring(5)));
}
requests.push(request);
}
return requests;
}
function createGetRepoRequestHandler(requests: GitHubApiRequest[]): RequestHandler {
const getRepoRequests = requests.filter(isGetRepoRequest);
if (getRepoRequests.length > 1) {
throw Error('More than one get repo request found');
}
const getRepoRequest = getRepoRequests[0];
return rest.get(`${baseUrl}/repos/:owner/:name`, (_req, res, ctx) => {
return res(
ctx.status(getRepoRequest.response.status),
ctx.json(getRepoRequest.response.body),
);
});
}
function createSubmitVariantAnalysisRequestHandler(requests: GitHubApiRequest[]): RequestHandler {
const submitVariantAnalysisRequests = requests.filter(isSubmitVariantAnalysisRequest);
if (submitVariantAnalysisRequests.length > 1) {
throw Error('More than one submit variant analysis request found');
}
const getRepoRequest = submitVariantAnalysisRequests[0];
return rest.post(`${baseUrl}/repositories/:controllerRepoId/code-scanning/codeql/variant-analyses`, (_req, res, ctx) => {
return res(
ctx.status(getRepoRequest.response.status),
ctx.json(getRepoRequest.response.body),
);
});
}
function createGetVariantAnalysisRequestHandler(requests: GitHubApiRequest[]): RequestHandler {
const getVariantAnalysisRequests = requests.filter(isGetVariantAnalysisRequest);
let requestIndex = 0;
// During the lifetime of a variant analysis run, there are multiple requests
// to get the variant analysis. We need to return different responses for each
// request, so keep an index of the request and return the appropriate response.
return rest.get(`${baseUrl}/repositories/:controllerRepoId/code-scanning/codeql/variant-analyses/:variantAnalysisId`, (_req, res, ctx) => {
const request = getVariantAnalysisRequests[requestIndex];
if (requestIndex < getVariantAnalysisRequests.length - 1) {
// If there are more requests to come, increment the index.
requestIndex++;
}
return res(
ctx.status(request.response.status),
ctx.json(request.response.body),
);
});
}
function createGetVariantAnalysisRepoRequestHandler(requests: GitHubApiRequest[]): RequestHandler {
const getVariantAnalysisRepoRequests = requests.filter(isGetVariantAnalysisRepoRequest);
return rest.get(
`${baseUrl}/repositories/:controllerRepoId/code-scanning/codeql/variant-analyses/:variantAnalysisId/repositories/:repoId`,
(req, res, ctx) => {
const scenarioRequest = getVariantAnalysisRepoRequests.find(r => r.request.repositoryId.toString() === req.params.repoId);
if (!scenarioRequest) {
throw Error(`No scenario request found for ${req.url}`);
}
return res(
ctx.status(scenarioRequest.response.status),
ctx.json(scenarioRequest.response.body),
);
});
}
function createGetVariantAnalysisRepoResultRequestHandler(requests: GitHubApiRequest[]): RequestHandler {
const getVariantAnalysisRepoResultRequests = requests.filter(isGetVariantAnalysisRepoResultRequest);
return rest.get(
'https://objects-origin.githubusercontent.com/codeql-query-console/codeql-variant-analysis-repo-tasks/:variantAnalysisId/:repoId/*',
(req, res, ctx) => {
const scenarioRequest = getVariantAnalysisRepoResultRequests.find(r => r.request.repositoryId.toString() === req.params.repoId);
if (!scenarioRequest) {
throw Error(`No scenario request found for ${req.url}`);
}
if (scenarioRequest.response.body) {
return res(
ctx.status(scenarioRequest.response.status),
ctx.set('Content-Type', scenarioRequest.response.contentType),
ctx.body(scenarioRequest.response.body),
);
} else {
return res(
ctx.status(scenarioRequest.response.status),
);
}
});
}

View File

@@ -0,0 +1,11 @@
{
"request": {
"kind": "getRepo"
},
"response": {
"status": 404,
"body": {
"message": "Repository not found"
}
}
}

View File

@@ -0,0 +1,159 @@
{
"request": {
"kind": "getRepo"
},
"response": {
"status": 200,
"body": {
"id": 557804416,
"node_id": "R_kgDOIT9rgA",
"name": "mrva-demo-controller-repo",
"full_name": "github/mrva-demo-controller-repo",
"private": true,
"owner": {
"login": "github",
"id": 9919,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=",
"avatar_url": "https://avatars.githubusercontent.com/u/9919?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/github",
"html_url": "https://github.com/github",
"followers_url": "https://api.github.com/users/github/followers",
"following_url": "https://api.github.com/users/github/following{/other_user}",
"gists_url": "https://api.github.com/users/github/gists{/gist_id}",
"starred_url": "https://api.github.com/users/github/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/github/subscriptions",
"organizations_url": "https://api.github.com/users/github/orgs",
"repos_url": "https://api.github.com/users/github/repos",
"events_url": "https://api.github.com/users/github/events{/privacy}",
"received_events_url": "https://api.github.com/users/github/received_events",
"type": "Organization",
"site_admin": false
},
"html_url": "https://github.com/github/mrva-demo-controller-repo",
"description": null,
"fork": false,
"url": "https://api.github.com/repos/github/mrva-demo-controller-repo",
"forks_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/forks",
"keys_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/teams",
"hooks_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/hooks",
"issue_events_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues/events{/number}",
"events_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/events",
"assignees_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/assignees{/user}",
"branches_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/branches{/branch}",
"tags_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/tags",
"blobs_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/statuses/{sha}",
"languages_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/languages",
"stargazers_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/stargazers",
"contributors_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/contributors",
"subscribers_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/subscribers",
"subscription_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/subscription",
"commits_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/contents/{+path}",
"compare_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/merges",
"archive_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/downloads",
"issues_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues{/number}",
"pulls_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/pulls{/number}",
"milestones_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/milestones{/number}",
"notifications_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/labels{/name}",
"releases_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/releases{/id}",
"deployments_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/deployments",
"created_at": "2022-10-26T10:37:59Z",
"updated_at": "2022-10-26T10:37:59Z",
"pushed_at": "2022-10-26T10:38:02Z",
"git_url": "git://github.com/github/mrva-demo-controller-repo.git",
"ssh_url": "git@github.com:github/mrva-demo-controller-repo.git",
"clone_url": "https://github.com/github/mrva-demo-controller-repo.git",
"svn_url": "https://github.com/github/mrva-demo-controller-repo",
"homepage": null,
"size": 0,
"stargazers_count": 0,
"watchers_count": 0,
"language": null,
"has_issues": true,
"has_projects": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": false,
"forks_count": 0,
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 0,
"license": null,
"allow_forking": false,
"is_template": false,
"web_commit_signoff_required": false,
"topics": [],
"visibility": "private",
"forks": 0,
"open_issues": 0,
"watchers": 0,
"default_branch": "main",
"permissions": {
"admin": true,
"maintain": true,
"push": true,
"triage": true,
"pull": true
},
"temp_clone_token": "AACMDDJSXFX6QQXTSB4YQCDDLEWP4",
"allow_squash_merge": true,
"allow_merge_commit": true,
"allow_rebase_merge": true,
"allow_auto_merge": false,
"delete_branch_on_merge": false,
"allow_update_branch": false,
"use_squash_pr_title_as_default": false,
"squash_merge_commit_message": "COMMIT_MESSAGES",
"squash_merge_commit_title": "COMMIT_OR_PR_TITLE",
"merge_commit_message": "PR_TITLE",
"merge_commit_title": "MERGE_MESSAGE",
"organization": {
"login": "github",
"id": 9919,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=",
"avatar_url": "https://avatars.githubusercontent.com/u/9919?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/github",
"html_url": "https://github.com/github",
"followers_url": "https://api.github.com/users/github/followers",
"following_url": "https://api.github.com/users/github/following{/other_user}",
"gists_url": "https://api.github.com/users/github/gists{/gist_id}",
"starred_url": "https://api.github.com/users/github/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/github/subscriptions",
"organizations_url": "https://api.github.com/users/github/orgs",
"repos_url": "https://api.github.com/users/github/repos",
"events_url": "https://api.github.com/users/github/events{/privacy}",
"received_events_url": "https://api.github.com/users/github/received_events",
"type": "Organization",
"site_admin": false
},
"security_and_analysis": {
"advanced_security": {
"status": "enabled"
},
"secret_scanning": {
"status": "enabled"
},
"secret_scanning_push_protection": {
"status": "enabled"
}
},
"network_count": 0,
"subscribers_count": 0
}
}
}

View File

@@ -0,0 +1,104 @@
{
"request": {
"kind": "submitVariantAnalysis"
},
"response": {
"status": 201,
"body": {
"id": 146,
"controller_repo": {
"id": 557804416,
"node_id": "R_kgDOIT9rgA",
"name": "mrva-demo-controller-repo",
"full_name": "github/mrva-demo-controller-repo",
"private": true,
"owner": {
"login": "github",
"id": 9919,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=",
"avatar_url": "https://avatars.githubusercontent.com/u/9919?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/github",
"html_url": "https://github.com/github",
"followers_url": "https://api.github.com/users/github/followers",
"following_url": "https://api.github.com/users/github/following{/other_user}",
"gists_url": "https://api.github.com/users/github/gists{/gist_id}",
"starred_url": "https://api.github.com/users/github/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/github/subscriptions",
"organizations_url": "https://api.github.com/users/github/orgs",
"repos_url": "https://api.github.com/users/github/repos",
"events_url": "https://api.github.com/users/github/events{/privacy}",
"received_events_url": "https://api.github.com/users/github/received_events",
"type": "Organization",
"site_admin": false
},
"html_url": "https://github.com/github/mrva-demo-controller-repo",
"description": null,
"fork": false,
"url": "https://api.github.com/repos/github/mrva-demo-controller-repo",
"forks_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/forks",
"keys_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/teams",
"hooks_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/hooks",
"issue_events_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues/events{/number}",
"events_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/events",
"assignees_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/assignees{/user}",
"branches_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/branches{/branch}",
"tags_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/tags",
"blobs_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/statuses/{sha}",
"languages_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/languages",
"stargazers_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/stargazers",
"contributors_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/contributors",
"subscribers_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/subscribers",
"subscription_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/subscription",
"commits_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/contents/{+path}",
"compare_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/merges",
"archive_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/downloads",
"issues_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues{/number}",
"pulls_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/pulls{/number}",
"milestones_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/milestones{/number}",
"notifications_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/labels{/name}",
"releases_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/releases{/id}",
"deployments_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/deployments"
},
"actor": {
"login": "charisk",
"id": 311693,
"node_id": "MDQ6VXNlcjMxMTY5Mw==",
"avatar_url": "https://avatars.githubusercontent.com/u/311693?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/charisk",
"html_url": "https://github.com/charisk",
"followers_url": "https://api.github.com/users/charisk/followers",
"following_url": "https://api.github.com/users/charisk/following{/other_user}",
"gists_url": "https://api.github.com/users/charisk/gists{/gist_id}",
"starred_url": "https://api.github.com/users/charisk/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/charisk/subscriptions",
"organizations_url": "https://api.github.com/users/charisk/orgs",
"repos_url": "https://api.github.com/users/charisk/repos",
"events_url": "https://api.github.com/users/charisk/events{/privacy}",
"received_events_url": "https://api.github.com/users/charisk/received_events",
"type": "User",
"site_admin": true
},
"query_language": "javascript",
"query_pack_url": "https://objects-origin.githubusercontent.com/codeql-query-console/variant_analyses/146/query_pack?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=queryconsoleprod%2F20221026%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20221026T124513Z&X-Amz-Expires=3600&X-Amz-Signature=0f5f84090c84c1b915e47960bcbc6f66433cd345cdc81cc08669920b48f6b622&X-Amz-SignedHeaders=host",
"created_at": "2022-10-26T12:45:12Z",
"updated_at": "2022-10-26T12:45:13Z",
"status": "in_progress",
"skipped_repositories": {}
}
}
}

View File

@@ -0,0 +1,11 @@
{
"request": {
"kind": "getVariantAnalysisRepoResult",
"repositoryId": 206444
},
"response": {
"status": 200,
"body": "file:17-getVariantAnalysisRepoResult.body.zip",
"contentType": "application/zip"
}
}

View File

@@ -0,0 +1,181 @@
{
"request": {
"kind": "getVariantAnalysis"
},
"response": {
"status": 200,
"body": {
"id": 146,
"controller_repo": {
"id": 557804416,
"node_id": "R_kgDOIT9rgA",
"name": "mrva-demo-controller-repo",
"full_name": "github/mrva-demo-controller-repo",
"private": true,
"owner": {
"login": "github",
"id": 9919,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=",
"avatar_url": "https://avatars.githubusercontent.com/u/9919?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/github",
"html_url": "https://github.com/github",
"followers_url": "https://api.github.com/users/github/followers",
"following_url": "https://api.github.com/users/github/following{/other_user}",
"gists_url": "https://api.github.com/users/github/gists{/gist_id}",
"starred_url": "https://api.github.com/users/github/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/github/subscriptions",
"organizations_url": "https://api.github.com/users/github/orgs",
"repos_url": "https://api.github.com/users/github/repos",
"events_url": "https://api.github.com/users/github/events{/privacy}",
"received_events_url": "https://api.github.com/users/github/received_events",
"type": "Organization",
"site_admin": false
},
"html_url": "https://github.com/github/mrva-demo-controller-repo",
"description": null,
"fork": false,
"url": "https://api.github.com/repos/github/mrva-demo-controller-repo",
"forks_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/forks",
"keys_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/teams",
"hooks_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/hooks",
"issue_events_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues/events{/number}",
"events_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/events",
"assignees_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/assignees{/user}",
"branches_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/branches{/branch}",
"tags_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/tags",
"blobs_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/statuses/{sha}",
"languages_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/languages",
"stargazers_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/stargazers",
"contributors_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/contributors",
"subscribers_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/subscribers",
"subscription_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/subscription",
"commits_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/contents/{+path}",
"compare_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/merges",
"archive_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/downloads",
"issues_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues{/number}",
"pulls_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/pulls{/number}",
"milestones_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/milestones{/number}",
"notifications_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/labels{/name}",
"releases_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/releases{/id}",
"deployments_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/deployments"
},
"actor": {
"login": "charisk",
"id": 311693,
"node_id": "MDQ6VXNlcjMxMTY5Mw==",
"avatar_url": "https://avatars.githubusercontent.com/u/311693?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/charisk",
"html_url": "https://github.com/charisk",
"followers_url": "https://api.github.com/users/charisk/followers",
"following_url": "https://api.github.com/users/charisk/following{/other_user}",
"gists_url": "https://api.github.com/users/charisk/gists{/gist_id}",
"starred_url": "https://api.github.com/users/charisk/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/charisk/subscriptions",
"organizations_url": "https://api.github.com/users/charisk/orgs",
"repos_url": "https://api.github.com/users/charisk/repos",
"events_url": "https://api.github.com/users/charisk/events{/privacy}",
"received_events_url": "https://api.github.com/users/charisk/received_events",
"type": "User",
"site_admin": true
},
"query_language": "javascript",
"query_pack_url": "https://objects-origin.githubusercontent.com/codeql-query-console/variant_analyses/146/query_pack?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=queryconsoleprod%2F20221026%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20221026T124653Z&X-Amz-Expires=3600&X-Amz-Signature=2147ea8461603acdb32fc38544dffb62e74db12fbbe5a32f269420d4945841a1&X-Amz-SignedHeaders=host",
"created_at": "2022-10-26T12:45:12Z",
"updated_at": "2022-10-26T12:45:15Z",
"actions_workflow_run_id": 3329095282,
"status": "in_progress",
"scanned_repositories": [
{
"repository": {
"id": 206444,
"name": "hive",
"full_name": "apache/hive",
"private": false,
"stargazers_count": 4523,
"updated_at": "2022-11-02T10:04:02Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 81841,
"result_count": 4
},
{
"repository": {
"id": 20753500,
"name": "ng-nice",
"full_name": "angular-cn/ng-nice",
"private": false,
"stargazers_count": 192,
"updated_at": "2022-03-17T08:34:30Z"
},
"analysis_status": "in_progress"
},
{
"repository": {
"id": 23418517,
"name": "hadoop",
"full_name": "apache/hadoop",
"private": false,
"stargazers_count": 13030,
"updated_at": "2022-11-02T08:23:58Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 66895,
"result_count": 3
},
{
"repository": {
"id": 236095576,
"name": "backstage",
"full_name": "backstage/backstage",
"private": false,
"stargazers_count": 19033,
"updated_at": "2022-11-02T10:25:24Z"
},
"analysis_status": "in_progress"
},
{
"repository": {
"id": 257485422,
"name": "vite",
"full_name": "vitejs/vite",
"private": false,
"stargazers_count": 49064,
"updated_at": "2022-11-02T11:29:22Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 702,
"result_count": 0
}
],
"skipped_repositories": {
"access_mismatch_repos": {
"repository_count": 0,
"repositories": []
},
"no_codeql_db_repos": {
"repository_count": 0,
"repositories": []
},
"over_limit_repos": {
"repository_count": 0,
"repositories": []
}
}
}
}
}

View File

@@ -0,0 +1,84 @@
{
"request": {
"kind": "getVariantAnalysisRepo",
"repositoryId": 23418517
},
"response": {
"status": 200,
"body": {
"repository": {
"id": 23418517,
"node_id": "MDEwOlJlcG9zaXRvcnkyMzQxODUxNw==",
"name": "hadoop",
"full_name": "apache/hadoop",
"private": false,
"owner": {
"login": "apache",
"id": 47359,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjQ3MzU5",
"avatar_url": "https://avatars.githubusercontent.com/u/47359?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/apache",
"html_url": "https://github.com/apache",
"followers_url": "https://api.github.com/users/apache/followers",
"following_url": "https://api.github.com/users/apache/following{/other_user}",
"gists_url": "https://api.github.com/users/apache/gists{/gist_id}",
"starred_url": "https://api.github.com/users/apache/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/apache/subscriptions",
"organizations_url": "https://api.github.com/users/apache/orgs",
"repos_url": "https://api.github.com/users/apache/repos",
"events_url": "https://api.github.com/users/apache/events{/privacy}",
"received_events_url": "https://api.github.com/users/apache/received_events",
"type": "Organization",
"site_admin": false
},
"html_url": "https://github.com/apache/hadoop",
"description": "Apache Hadoop",
"fork": false,
"url": "https://api.github.com/repos/apache/hadoop",
"forks_url": "https://api.github.com/repos/apache/hadoop/forks",
"keys_url": "https://api.github.com/repos/apache/hadoop/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/apache/hadoop/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/apache/hadoop/teams",
"hooks_url": "https://api.github.com/repos/apache/hadoop/hooks",
"issue_events_url": "https://api.github.com/repos/apache/hadoop/issues/events{/number}",
"events_url": "https://api.github.com/repos/apache/hadoop/events",
"assignees_url": "https://api.github.com/repos/apache/hadoop/assignees{/user}",
"branches_url": "https://api.github.com/repos/apache/hadoop/branches{/branch}",
"tags_url": "https://api.github.com/repos/apache/hadoop/tags",
"blobs_url": "https://api.github.com/repos/apache/hadoop/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/apache/hadoop/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/apache/hadoop/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/apache/hadoop/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/apache/hadoop/statuses/{sha}",
"languages_url": "https://api.github.com/repos/apache/hadoop/languages",
"stargazers_url": "https://api.github.com/repos/apache/hadoop/stargazers",
"contributors_url": "https://api.github.com/repos/apache/hadoop/contributors",
"subscribers_url": "https://api.github.com/repos/apache/hadoop/subscribers",
"subscription_url": "https://api.github.com/repos/apache/hadoop/subscription",
"commits_url": "https://api.github.com/repos/apache/hadoop/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/apache/hadoop/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/apache/hadoop/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/apache/hadoop/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/apache/hadoop/contents/{+path}",
"compare_url": "https://api.github.com/repos/apache/hadoop/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/apache/hadoop/merges",
"archive_url": "https://api.github.com/repos/apache/hadoop/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/apache/hadoop/downloads",
"issues_url": "https://api.github.com/repos/apache/hadoop/issues{/number}",
"pulls_url": "https://api.github.com/repos/apache/hadoop/pulls{/number}",
"milestones_url": "https://api.github.com/repos/apache/hadoop/milestones{/number}",
"notifications_url": "https://api.github.com/repos/apache/hadoop/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/apache/hadoop/labels{/name}",
"releases_url": "https://api.github.com/repos/apache/hadoop/releases{/id}",
"deployments_url": "https://api.github.com/repos/apache/hadoop/deployments"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 66895,
"result_count": 3,
"database_commit_sha": "aac87ffe76451c2fd535350b7aefb384e2be6241",
"source_location_prefix": "/home/runner/work/bulk-builder/bulk-builder",
"artifact_url": "https://objects-origin.githubusercontent.com/codeql-query-console/codeql-variant-analysis-repo-tasks/146/23418517/425ed1e9-c214-4f71-832d-798da3ed7452?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=queryconsoleprod%2F20221026%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20221026T124654Z&X-Amz-Expires=300&X-Amz-Signature=98dc5dfcc4c70c4cc40fb62fb87a21671b1ee26266e8ade3109d6f39cfceef5a&X-Amz-SignedHeaders=host&actor_id=311693&key_id=0&repo_id=557804416"
}
}
}

View File

@@ -0,0 +1,11 @@
{
"request": {
"kind": "getVariantAnalysisRepoResult",
"repositoryId": 23418517
},
"response": {
"status": 200,
"body": "file:13-getVariantAnalysisRepoResult.body.zip",
"contentType": "application/zip"
}
}

View File

@@ -0,0 +1,84 @@
{
"request": {
"kind": "getVariantAnalysisRepo",
"repositoryId": 257485422
},
"response": {
"status": 200,
"body": {
"repository": {
"id": 257485422,
"node_id": "MDEwOlJlcG9zaXRvcnkyNTc0ODU0MjI=",
"name": "vite",
"full_name": "vitejs/vite",
"private": false,
"owner": {
"login": "vitejs",
"id": 65625612,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjY1NjI1NjEy",
"avatar_url": "https://avatars.githubusercontent.com/u/65625612?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/vitejs",
"html_url": "https://github.com/vitejs",
"followers_url": "https://api.github.com/users/vitejs/followers",
"following_url": "https://api.github.com/users/vitejs/following{/other_user}",
"gists_url": "https://api.github.com/users/vitejs/gists{/gist_id}",
"starred_url": "https://api.github.com/users/vitejs/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/vitejs/subscriptions",
"organizations_url": "https://api.github.com/users/vitejs/orgs",
"repos_url": "https://api.github.com/users/vitejs/repos",
"events_url": "https://api.github.com/users/vitejs/events{/privacy}",
"received_events_url": "https://api.github.com/users/vitejs/received_events",
"type": "Organization",
"site_admin": false
},
"html_url": "https://github.com/vitejs/vite",
"description": "Next generation frontend tooling. It's fast!",
"fork": false,
"url": "https://api.github.com/repos/vitejs/vite",
"forks_url": "https://api.github.com/repos/vitejs/vite/forks",
"keys_url": "https://api.github.com/repos/vitejs/vite/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/vitejs/vite/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/vitejs/vite/teams",
"hooks_url": "https://api.github.com/repos/vitejs/vite/hooks",
"issue_events_url": "https://api.github.com/repos/vitejs/vite/issues/events{/number}",
"events_url": "https://api.github.com/repos/vitejs/vite/events",
"assignees_url": "https://api.github.com/repos/vitejs/vite/assignees{/user}",
"branches_url": "https://api.github.com/repos/vitejs/vite/branches{/branch}",
"tags_url": "https://api.github.com/repos/vitejs/vite/tags",
"blobs_url": "https://api.github.com/repos/vitejs/vite/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/vitejs/vite/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/vitejs/vite/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/vitejs/vite/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/vitejs/vite/statuses/{sha}",
"languages_url": "https://api.github.com/repos/vitejs/vite/languages",
"stargazers_url": "https://api.github.com/repos/vitejs/vite/stargazers",
"contributors_url": "https://api.github.com/repos/vitejs/vite/contributors",
"subscribers_url": "https://api.github.com/repos/vitejs/vite/subscribers",
"subscription_url": "https://api.github.com/repos/vitejs/vite/subscription",
"commits_url": "https://api.github.com/repos/vitejs/vite/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/vitejs/vite/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/vitejs/vite/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/vitejs/vite/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/vitejs/vite/contents/{+path}",
"compare_url": "https://api.github.com/repos/vitejs/vite/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/vitejs/vite/merges",
"archive_url": "https://api.github.com/repos/vitejs/vite/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/vitejs/vite/downloads",
"issues_url": "https://api.github.com/repos/vitejs/vite/issues{/number}",
"pulls_url": "https://api.github.com/repos/vitejs/vite/pulls{/number}",
"milestones_url": "https://api.github.com/repos/vitejs/vite/milestones{/number}",
"notifications_url": "https://api.github.com/repos/vitejs/vite/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/vitejs/vite/labels{/name}",
"releases_url": "https://api.github.com/repos/vitejs/vite/releases{/id}",
"deployments_url": "https://api.github.com/repos/vitejs/vite/deployments"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 702,
"result_count": 0,
"database_commit_sha": "de6323f460dd3e7e3edf97443ece2acce6187ea0",
"source_location_prefix": "/home/runner/work/bulk-builder/bulk-builder",
"artifact_url": "https://objects-origin.githubusercontent.com/codeql-query-console/codeql-variant-analysis-repo-tasks/146/257485422/862ee5f1-0e34-4997-a60e-b97cea3eadc9?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=queryconsoleprod%2F20221026%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20221026T124658Z&X-Amz-Expires=300&X-Amz-Signature=df0ac0f0f8f746ad977ad859bc6b43e4cdc74ff285a33cba489b16bf9c161490&X-Amz-SignedHeaders=host&actor_id=311693&key_id=0&repo_id=557804416"
}
}
}

View File

@@ -0,0 +1,11 @@
{
"request": {
"kind": "getVariantAnalysisRepoResult",
"repositoryId": 257485422
},
"response": {
"status": 200,
"body": "file:15-getVariantAnalysisRepoResult.body.zip",
"contentType": "application/zip"
}
}

View File

@@ -0,0 +1,181 @@
{
"request": {
"kind": "getVariantAnalysis"
},
"response": {
"status": 200,
"body": {
"id": 146,
"controller_repo": {
"id": 557804416,
"node_id": "R_kgDOIT9rgA",
"name": "mrva-demo-controller-repo",
"full_name": "github/mrva-demo-controller-repo",
"private": true,
"owner": {
"login": "github",
"id": 9919,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=",
"avatar_url": "https://avatars.githubusercontent.com/u/9919?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/github",
"html_url": "https://github.com/github",
"followers_url": "https://api.github.com/users/github/followers",
"following_url": "https://api.github.com/users/github/following{/other_user}",
"gists_url": "https://api.github.com/users/github/gists{/gist_id}",
"starred_url": "https://api.github.com/users/github/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/github/subscriptions",
"organizations_url": "https://api.github.com/users/github/orgs",
"repos_url": "https://api.github.com/users/github/repos",
"events_url": "https://api.github.com/users/github/events{/privacy}",
"received_events_url": "https://api.github.com/users/github/received_events",
"type": "Organization",
"site_admin": false
},
"html_url": "https://github.com/github/mrva-demo-controller-repo",
"description": null,
"fork": false,
"url": "https://api.github.com/repos/github/mrva-demo-controller-repo",
"forks_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/forks",
"keys_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/teams",
"hooks_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/hooks",
"issue_events_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues/events{/number}",
"events_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/events",
"assignees_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/assignees{/user}",
"branches_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/branches{/branch}",
"tags_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/tags",
"blobs_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/statuses/{sha}",
"languages_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/languages",
"stargazers_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/stargazers",
"contributors_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/contributors",
"subscribers_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/subscribers",
"subscription_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/subscription",
"commits_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/contents/{+path}",
"compare_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/merges",
"archive_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/downloads",
"issues_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues{/number}",
"pulls_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/pulls{/number}",
"milestones_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/milestones{/number}",
"notifications_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/labels{/name}",
"releases_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/releases{/id}",
"deployments_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/deployments"
},
"actor": {
"login": "charisk",
"id": 311693,
"node_id": "MDQ6VXNlcjMxMTY5Mw==",
"avatar_url": "https://avatars.githubusercontent.com/u/311693?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/charisk",
"html_url": "https://github.com/charisk",
"followers_url": "https://api.github.com/users/charisk/followers",
"following_url": "https://api.github.com/users/charisk/following{/other_user}",
"gists_url": "https://api.github.com/users/charisk/gists{/gist_id}",
"starred_url": "https://api.github.com/users/charisk/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/charisk/subscriptions",
"organizations_url": "https://api.github.com/users/charisk/orgs",
"repos_url": "https://api.github.com/users/charisk/repos",
"events_url": "https://api.github.com/users/charisk/events{/privacy}",
"received_events_url": "https://api.github.com/users/charisk/received_events",
"type": "User",
"site_admin": true
},
"query_language": "javascript",
"query_pack_url": "https://objects-origin.githubusercontent.com/codeql-query-console/variant_analyses/146/query_pack?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=queryconsoleprod%2F20221026%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20221026T124659Z&X-Amz-Expires=3600&X-Amz-Signature=b791ede467cd1783d31d7ee148763d0d4f9eb7abad7506ef9c25017c94aaa1df&X-Amz-SignedHeaders=host",
"created_at": "2022-10-26T12:45:12Z",
"updated_at": "2022-10-26T12:45:15Z",
"actions_workflow_run_id": 3329095282,
"status": "in_progress",
"scanned_repositories": [
{
"repository": {
"id": 206444,
"name": "hive",
"full_name": "apache/hive",
"private": false,
"stargazers_count": 4523,
"updated_at": "2022-11-02T10:04:02Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 81841,
"result_count": 4
},
{
"repository": {
"id": 20753500,
"name": "ng-nice",
"full_name": "angular-cn/ng-nice",
"private": false,
"stargazers_count": 192,
"updated_at": "2022-03-17T08:34:30Z"
},
"analysis_status": "in_progress"
},
{
"repository": {
"id": 23418517,
"name": "hadoop",
"full_name": "apache/hadoop",
"private": false,
"stargazers_count": 13030,
"updated_at": "2022-11-02T08:23:58Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 66895,
"result_count": 3
},
{
"repository": {
"id": 236095576,
"name": "backstage",
"full_name": "backstage/backstage",
"private": false,
"stargazers_count": 19033,
"updated_at": "2022-11-02T10:25:24Z"
},
"analysis_status": "in_progress"
},
{
"repository": {
"id": 257485422,
"name": "vite",
"full_name": "vitejs/vite",
"private": false,
"stargazers_count": 49064,
"updated_at": "2022-11-02T11:29:22Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 702,
"result_count": 0
}
],
"skipped_repositories": {
"access_mismatch_repos": {
"repository_count": 0,
"repositories": []
},
"no_codeql_db_repos": {
"repository_count": 0,
"repositories": []
},
"over_limit_repos": {
"repository_count": 0,
"repositories": []
}
}
}
}
}

View File

@@ -0,0 +1,181 @@
{
"request": {
"kind": "getVariantAnalysis"
},
"response": {
"status": 200,
"body": {
"id": 146,
"controller_repo": {
"id": 557804416,
"node_id": "R_kgDOIT9rgA",
"name": "mrva-demo-controller-repo",
"full_name": "github/mrva-demo-controller-repo",
"private": true,
"owner": {
"login": "github",
"id": 9919,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=",
"avatar_url": "https://avatars.githubusercontent.com/u/9919?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/github",
"html_url": "https://github.com/github",
"followers_url": "https://api.github.com/users/github/followers",
"following_url": "https://api.github.com/users/github/following{/other_user}",
"gists_url": "https://api.github.com/users/github/gists{/gist_id}",
"starred_url": "https://api.github.com/users/github/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/github/subscriptions",
"organizations_url": "https://api.github.com/users/github/orgs",
"repos_url": "https://api.github.com/users/github/repos",
"events_url": "https://api.github.com/users/github/events{/privacy}",
"received_events_url": "https://api.github.com/users/github/received_events",
"type": "Organization",
"site_admin": false
},
"html_url": "https://github.com/github/mrva-demo-controller-repo",
"description": null,
"fork": false,
"url": "https://api.github.com/repos/github/mrva-demo-controller-repo",
"forks_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/forks",
"keys_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/teams",
"hooks_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/hooks",
"issue_events_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues/events{/number}",
"events_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/events",
"assignees_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/assignees{/user}",
"branches_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/branches{/branch}",
"tags_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/tags",
"blobs_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/statuses/{sha}",
"languages_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/languages",
"stargazers_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/stargazers",
"contributors_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/contributors",
"subscribers_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/subscribers",
"subscription_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/subscription",
"commits_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/contents/{+path}",
"compare_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/merges",
"archive_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/downloads",
"issues_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues{/number}",
"pulls_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/pulls{/number}",
"milestones_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/milestones{/number}",
"notifications_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/labels{/name}",
"releases_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/releases{/id}",
"deployments_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/deployments"
},
"actor": {
"login": "charisk",
"id": 311693,
"node_id": "MDQ6VXNlcjMxMTY5Mw==",
"avatar_url": "https://avatars.githubusercontent.com/u/311693?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/charisk",
"html_url": "https://github.com/charisk",
"followers_url": "https://api.github.com/users/charisk/followers",
"following_url": "https://api.github.com/users/charisk/following{/other_user}",
"gists_url": "https://api.github.com/users/charisk/gists{/gist_id}",
"starred_url": "https://api.github.com/users/charisk/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/charisk/subscriptions",
"organizations_url": "https://api.github.com/users/charisk/orgs",
"repos_url": "https://api.github.com/users/charisk/repos",
"events_url": "https://api.github.com/users/charisk/events{/privacy}",
"received_events_url": "https://api.github.com/users/charisk/received_events",
"type": "User",
"site_admin": true
},
"query_language": "javascript",
"query_pack_url": "https://objects-origin.githubusercontent.com/codeql-query-console/variant_analyses/146/query_pack?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=queryconsoleprod%2F20221026%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20221026T124705Z&X-Amz-Expires=3600&X-Amz-Signature=dae9aa87c393b62ad6f84fd280c731fcd8e4551917920bf978eac5dd6102caec&X-Amz-SignedHeaders=host",
"created_at": "2022-10-26T12:45:12Z",
"updated_at": "2022-10-26T12:45:15Z",
"actions_workflow_run_id": 3329095282,
"status": "in_progress",
"scanned_repositories": [
{
"repository": {
"id": 206444,
"name": "hive",
"full_name": "apache/hive",
"private": false,
"stargazers_count": 4523,
"updated_at": "2022-11-02T10:04:02Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 81841,
"result_count": 4
},
{
"repository": {
"id": 20753500,
"name": "ng-nice",
"full_name": "angular-cn/ng-nice",
"private": false,
"stargazers_count": 192,
"updated_at": "2022-03-17T08:34:30Z"
},
"analysis_status": "in_progress"
},
{
"repository": {
"id": 23418517,
"name": "hadoop",
"full_name": "apache/hadoop",
"private": false,
"stargazers_count": 13030,
"updated_at": "2022-11-02T08:23:58Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 66895,
"result_count": 3
},
{
"repository": {
"id": 236095576,
"name": "backstage",
"full_name": "backstage/backstage",
"private": false,
"stargazers_count": 19033,
"updated_at": "2022-11-02T10:25:24Z"
},
"analysis_status": "in_progress"
},
{
"repository": {
"id": 257485422,
"name": "vite",
"full_name": "vitejs/vite",
"private": false,
"stargazers_count": 49064,
"updated_at": "2022-11-02T11:29:22Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 702,
"result_count": 0
}
],
"skipped_repositories": {
"access_mismatch_repos": {
"repository_count": 0,
"repositories": []
},
"no_codeql_db_repos": {
"repository_count": 0,
"repositories": []
},
"over_limit_repos": {
"repository_count": 0,
"repositories": []
}
}
}
}
}

View File

@@ -0,0 +1,183 @@
{
"request": {
"kind": "getVariantAnalysis"
},
"response": {
"status": 200,
"body": {
"id": 146,
"controller_repo": {
"id": 557804416,
"node_id": "R_kgDOIT9rgA",
"name": "mrva-demo-controller-repo",
"full_name": "github/mrva-demo-controller-repo",
"private": true,
"owner": {
"login": "github",
"id": 9919,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=",
"avatar_url": "https://avatars.githubusercontent.com/u/9919?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/github",
"html_url": "https://github.com/github",
"followers_url": "https://api.github.com/users/github/followers",
"following_url": "https://api.github.com/users/github/following{/other_user}",
"gists_url": "https://api.github.com/users/github/gists{/gist_id}",
"starred_url": "https://api.github.com/users/github/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/github/subscriptions",
"organizations_url": "https://api.github.com/users/github/orgs",
"repos_url": "https://api.github.com/users/github/repos",
"events_url": "https://api.github.com/users/github/events{/privacy}",
"received_events_url": "https://api.github.com/users/github/received_events",
"type": "Organization",
"site_admin": false
},
"html_url": "https://github.com/github/mrva-demo-controller-repo",
"description": null,
"fork": false,
"url": "https://api.github.com/repos/github/mrva-demo-controller-repo",
"forks_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/forks",
"keys_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/teams",
"hooks_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/hooks",
"issue_events_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues/events{/number}",
"events_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/events",
"assignees_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/assignees{/user}",
"branches_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/branches{/branch}",
"tags_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/tags",
"blobs_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/statuses/{sha}",
"languages_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/languages",
"stargazers_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/stargazers",
"contributors_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/contributors",
"subscribers_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/subscribers",
"subscription_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/subscription",
"commits_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/contents/{+path}",
"compare_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/merges",
"archive_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/downloads",
"issues_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues{/number}",
"pulls_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/pulls{/number}",
"milestones_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/milestones{/number}",
"notifications_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/labels{/name}",
"releases_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/releases{/id}",
"deployments_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/deployments"
},
"actor": {
"login": "charisk",
"id": 311693,
"node_id": "MDQ6VXNlcjMxMTY5Mw==",
"avatar_url": "https://avatars.githubusercontent.com/u/311693?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/charisk",
"html_url": "https://github.com/charisk",
"followers_url": "https://api.github.com/users/charisk/followers",
"following_url": "https://api.github.com/users/charisk/following{/other_user}",
"gists_url": "https://api.github.com/users/charisk/gists{/gist_id}",
"starred_url": "https://api.github.com/users/charisk/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/charisk/subscriptions",
"organizations_url": "https://api.github.com/users/charisk/orgs",
"repos_url": "https://api.github.com/users/charisk/repos",
"events_url": "https://api.github.com/users/charisk/events{/privacy}",
"received_events_url": "https://api.github.com/users/charisk/received_events",
"type": "User",
"site_admin": true
},
"query_language": "javascript",
"query_pack_url": "https://objects-origin.githubusercontent.com/codeql-query-console/variant_analyses/146/query_pack?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=queryconsoleprod%2F20221026%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20221026T124726Z&X-Amz-Expires=3600&X-Amz-Signature=6698289315bd8d8378a17784ba0be9955e6e9161497137c4ccb29b1d2a3f3587&X-Amz-SignedHeaders=host",
"created_at": "2022-10-26T12:45:12Z",
"updated_at": "2022-10-26T12:45:15Z",
"actions_workflow_run_id": 3329095282,
"status": "in_progress",
"scanned_repositories": [
{
"repository": {
"id": 206444,
"name": "hive",
"full_name": "apache/hive",
"private": false,
"stargazers_count": 4523,
"updated_at": "2022-11-02T10:04:02Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 81841,
"result_count": 4
},
{
"repository": {
"id": 20753500,
"name": "ng-nice",
"full_name": "angular-cn/ng-nice",
"private": false,
"stargazers_count": 192,
"updated_at": "2022-03-17T08:34:30Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 156706,
"result_count": 8
},
{
"repository": {
"id": 23418517,
"name": "hadoop",
"full_name": "apache/hadoop",
"private": false,
"stargazers_count": 13030,
"updated_at": "2022-11-02T08:23:58Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 66895,
"result_count": 3
},
{
"repository": {
"id": 236095576,
"name": "backstage",
"full_name": "backstage/backstage",
"private": false,
"stargazers_count": 19033,
"updated_at": "2022-11-02T10:25:24Z"
},
"analysis_status": "in_progress"
},
{
"repository": {
"id": 257485422,
"name": "vite",
"full_name": "vitejs/vite",
"private": false,
"stargazers_count": 49064,
"updated_at": "2022-11-02T11:29:22Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 702,
"result_count": 0
}
],
"skipped_repositories": {
"access_mismatch_repos": {
"repository_count": 0,
"repositories": []
},
"no_codeql_db_repos": {
"repository_count": 0,
"repositories": []
},
"over_limit_repos": {
"repository_count": 0,
"repositories": []
}
}
}
}
}

View File

@@ -0,0 +1,84 @@
{
"request": {
"kind": "getVariantAnalysisRepo",
"repositoryId": 20753500
},
"response": {
"status": 200,
"body": {
"repository": {
"id": 20753500,
"node_id": "MDEwOlJlcG9zaXRvcnkyMDc1MzUwMA==",
"name": "ng-nice",
"full_name": "angular-cn/ng-nice",
"private": false,
"owner": {
"login": "angular-cn",
"id": 6211039,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjYyMTEwMzk=",
"avatar_url": "https://avatars.githubusercontent.com/u/6211039?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/angular-cn",
"html_url": "https://github.com/angular-cn",
"followers_url": "https://api.github.com/users/angular-cn/followers",
"following_url": "https://api.github.com/users/angular-cn/following{/other_user}",
"gists_url": "https://api.github.com/users/angular-cn/gists{/gist_id}",
"starred_url": "https://api.github.com/users/angular-cn/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/angular-cn/subscriptions",
"organizations_url": "https://api.github.com/users/angular-cn/orgs",
"repos_url": "https://api.github.com/users/angular-cn/repos",
"events_url": "https://api.github.com/users/angular-cn/events{/privacy}",
"received_events_url": "https://api.github.com/users/angular-cn/received_events",
"type": "Organization",
"site_admin": false
},
"html_url": "https://github.com/angular-cn/ng-nice",
"description": "NgNice Web Site http://ngnice.com",
"fork": false,
"url": "https://api.github.com/repos/angular-cn/ng-nice",
"forks_url": "https://api.github.com/repos/angular-cn/ng-nice/forks",
"keys_url": "https://api.github.com/repos/angular-cn/ng-nice/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/angular-cn/ng-nice/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/angular-cn/ng-nice/teams",
"hooks_url": "https://api.github.com/repos/angular-cn/ng-nice/hooks",
"issue_events_url": "https://api.github.com/repos/angular-cn/ng-nice/issues/events{/number}",
"events_url": "https://api.github.com/repos/angular-cn/ng-nice/events",
"assignees_url": "https://api.github.com/repos/angular-cn/ng-nice/assignees{/user}",
"branches_url": "https://api.github.com/repos/angular-cn/ng-nice/branches{/branch}",
"tags_url": "https://api.github.com/repos/angular-cn/ng-nice/tags",
"blobs_url": "https://api.github.com/repos/angular-cn/ng-nice/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/angular-cn/ng-nice/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/angular-cn/ng-nice/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/angular-cn/ng-nice/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/angular-cn/ng-nice/statuses/{sha}",
"languages_url": "https://api.github.com/repos/angular-cn/ng-nice/languages",
"stargazers_url": "https://api.github.com/repos/angular-cn/ng-nice/stargazers",
"contributors_url": "https://api.github.com/repos/angular-cn/ng-nice/contributors",
"subscribers_url": "https://api.github.com/repos/angular-cn/ng-nice/subscribers",
"subscription_url": "https://api.github.com/repos/angular-cn/ng-nice/subscription",
"commits_url": "https://api.github.com/repos/angular-cn/ng-nice/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/angular-cn/ng-nice/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/angular-cn/ng-nice/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/angular-cn/ng-nice/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/angular-cn/ng-nice/contents/{+path}",
"compare_url": "https://api.github.com/repos/angular-cn/ng-nice/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/angular-cn/ng-nice/merges",
"archive_url": "https://api.github.com/repos/angular-cn/ng-nice/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/angular-cn/ng-nice/downloads",
"issues_url": "https://api.github.com/repos/angular-cn/ng-nice/issues{/number}",
"pulls_url": "https://api.github.com/repos/angular-cn/ng-nice/pulls{/number}",
"milestones_url": "https://api.github.com/repos/angular-cn/ng-nice/milestones{/number}",
"notifications_url": "https://api.github.com/repos/angular-cn/ng-nice/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/angular-cn/ng-nice/labels{/name}",
"releases_url": "https://api.github.com/repos/angular-cn/ng-nice/releases{/id}",
"deployments_url": "https://api.github.com/repos/angular-cn/ng-nice/deployments"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 156706,
"result_count": 8,
"database_commit_sha": "85f9118fa7c10395eb01b019ba57680805897efa",
"source_location_prefix": "/home/runner/work/bulk-builder/bulk-builder",
"artifact_url": "https://objects-origin.githubusercontent.com/codeql-query-console/codeql-variant-analysis-repo-tasks/146/20753500/7cb3d923-6312-4453-8df2-e98382437ddd?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=queryconsoleprod%2F20221026%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20221026T124729Z&X-Amz-Expires=300&X-Amz-Signature=d8e403e6ed13e7ce8b305d07be139e3ffac8a26f2e010acdbeaf9365588ab17f&X-Amz-SignedHeaders=host&actor_id=311693&key_id=0&repo_id=557804416"
}
}
}

View File

@@ -0,0 +1,175 @@
{
"request": {
"kind": "getVariantAnalysis"
},
"response": {
"status": 200,
"body": {
"id": 146,
"controller_repo": {
"id": 557804416,
"node_id": "R_kgDOIT9rgA",
"name": "mrva-demo-controller-repo",
"full_name": "github/mrva-demo-controller-repo",
"private": true,
"owner": {
"login": "github",
"id": 9919,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=",
"avatar_url": "https://avatars.githubusercontent.com/u/9919?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/github",
"html_url": "https://github.com/github",
"followers_url": "https://api.github.com/users/github/followers",
"following_url": "https://api.github.com/users/github/following{/other_user}",
"gists_url": "https://api.github.com/users/github/gists{/gist_id}",
"starred_url": "https://api.github.com/users/github/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/github/subscriptions",
"organizations_url": "https://api.github.com/users/github/orgs",
"repos_url": "https://api.github.com/users/github/repos",
"events_url": "https://api.github.com/users/github/events{/privacy}",
"received_events_url": "https://api.github.com/users/github/received_events",
"type": "Organization",
"site_admin": false
},
"html_url": "https://github.com/github/mrva-demo-controller-repo",
"description": null,
"fork": false,
"url": "https://api.github.com/repos/github/mrva-demo-controller-repo",
"forks_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/forks",
"keys_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/teams",
"hooks_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/hooks",
"issue_events_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues/events{/number}",
"events_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/events",
"assignees_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/assignees{/user}",
"branches_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/branches{/branch}",
"tags_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/tags",
"blobs_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/statuses/{sha}",
"languages_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/languages",
"stargazers_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/stargazers",
"contributors_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/contributors",
"subscribers_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/subscribers",
"subscription_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/subscription",
"commits_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/contents/{+path}",
"compare_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/merges",
"archive_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/downloads",
"issues_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues{/number}",
"pulls_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/pulls{/number}",
"milestones_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/milestones{/number}",
"notifications_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/labels{/name}",
"releases_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/releases{/id}",
"deployments_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/deployments"
},
"actor": {
"login": "charisk",
"id": 311693,
"node_id": "MDQ6VXNlcjMxMTY5Mw==",
"avatar_url": "https://avatars.githubusercontent.com/u/311693?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/charisk",
"html_url": "https://github.com/charisk",
"followers_url": "https://api.github.com/users/charisk/followers",
"following_url": "https://api.github.com/users/charisk/following{/other_user}",
"gists_url": "https://api.github.com/users/charisk/gists{/gist_id}",
"starred_url": "https://api.github.com/users/charisk/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/charisk/subscriptions",
"organizations_url": "https://api.github.com/users/charisk/orgs",
"repos_url": "https://api.github.com/users/charisk/repos",
"events_url": "https://api.github.com/users/charisk/events{/privacy}",
"received_events_url": "https://api.github.com/users/charisk/received_events",
"type": "User",
"site_admin": true
},
"query_language": "javascript",
"query_pack_url": "https://objects-origin.githubusercontent.com/codeql-query-console/variant_analyses/146/query_pack?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=queryconsoleprod%2F20221026%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20221026T124518Z&X-Amz-Expires=3600&X-Amz-Signature=5fbb5b3fa99984d065d3229c83f19cb9741218e6e1ba5b7bb81a7d6df88cb66b&X-Amz-SignedHeaders=host",
"created_at": "2022-10-26T12:45:12Z",
"updated_at": "2022-10-26T12:45:15Z",
"actions_workflow_run_id": 3329095282,
"status": "in_progress",
"scanned_repositories": [
{
"repository": {
"id": 206444,
"name": "hive",
"full_name": "apache/hive",
"private": false,
"stargazers_count": 4523,
"updated_at": "2022-11-02T10:04:02Z"
},
"analysis_status": "pending"
},
{
"repository": {
"id": 20753500,
"name": "ng-nice",
"full_name": "angular-cn/ng-nice",
"private": false,
"stargazers_count": 192,
"updated_at": "2022-03-17T08:34:30Z"
},
"analysis_status": "pending"
},
{
"repository": {
"id": 23418517,
"name": "hadoop",
"full_name": "apache/hadoop",
"private": false,
"stargazers_count": 13030,
"updated_at": "2022-11-02T08:23:58Z"
},
"analysis_status": "pending"
},
{
"repository": {
"id": 236095576,
"name": "backstage",
"full_name": "backstage/backstage",
"private": false,
"stargazers_count": 19033,
"updated_at": "2022-11-02T10:25:24Z"
},
"analysis_status": "pending"
},
{
"repository": {
"id": 257485422,
"name": "vite",
"full_name": "vitejs/vite",
"private": false,
"stargazers_count": 49064,
"updated_at": "2022-11-02T11:29:22Z"
},
"analysis_status": "pending"
}
],
"skipped_repositories": {
"access_mismatch_repos": {
"repository_count": 0,
"repositories": []
},
"no_codeql_db_repos": {
"repository_count": 0,
"repositories": []
},
"over_limit_repos": {
"repository_count": 0,
"repositories": []
}
}
}
}
}

View File

@@ -0,0 +1,11 @@
{
"request": {
"kind": "getVariantAnalysisRepoResult",
"repositoryId": 20753500
},
"response": {
"status": 200,
"body": "file:20-getVariantAnalysisRepoResult.body.zip",
"contentType": "application/zip"
}
}

View File

@@ -0,0 +1,183 @@
{
"request": {
"kind": "getVariantAnalysis"
},
"response": {
"status": 200,
"body": {
"id": 146,
"controller_repo": {
"id": 557804416,
"node_id": "R_kgDOIT9rgA",
"name": "mrva-demo-controller-repo",
"full_name": "github/mrva-demo-controller-repo",
"private": true,
"owner": {
"login": "github",
"id": 9919,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=",
"avatar_url": "https://avatars.githubusercontent.com/u/9919?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/github",
"html_url": "https://github.com/github",
"followers_url": "https://api.github.com/users/github/followers",
"following_url": "https://api.github.com/users/github/following{/other_user}",
"gists_url": "https://api.github.com/users/github/gists{/gist_id}",
"starred_url": "https://api.github.com/users/github/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/github/subscriptions",
"organizations_url": "https://api.github.com/users/github/orgs",
"repos_url": "https://api.github.com/users/github/repos",
"events_url": "https://api.github.com/users/github/events{/privacy}",
"received_events_url": "https://api.github.com/users/github/received_events",
"type": "Organization",
"site_admin": false
},
"html_url": "https://github.com/github/mrva-demo-controller-repo",
"description": null,
"fork": false,
"url": "https://api.github.com/repos/github/mrva-demo-controller-repo",
"forks_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/forks",
"keys_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/teams",
"hooks_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/hooks",
"issue_events_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues/events{/number}",
"events_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/events",
"assignees_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/assignees{/user}",
"branches_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/branches{/branch}",
"tags_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/tags",
"blobs_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/statuses/{sha}",
"languages_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/languages",
"stargazers_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/stargazers",
"contributors_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/contributors",
"subscribers_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/subscribers",
"subscription_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/subscription",
"commits_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/contents/{+path}",
"compare_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/merges",
"archive_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/downloads",
"issues_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues{/number}",
"pulls_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/pulls{/number}",
"milestones_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/milestones{/number}",
"notifications_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/labels{/name}",
"releases_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/releases{/id}",
"deployments_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/deployments"
},
"actor": {
"login": "charisk",
"id": 311693,
"node_id": "MDQ6VXNlcjMxMTY5Mw==",
"avatar_url": "https://avatars.githubusercontent.com/u/311693?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/charisk",
"html_url": "https://github.com/charisk",
"followers_url": "https://api.github.com/users/charisk/followers",
"following_url": "https://api.github.com/users/charisk/following{/other_user}",
"gists_url": "https://api.github.com/users/charisk/gists{/gist_id}",
"starred_url": "https://api.github.com/users/charisk/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/charisk/subscriptions",
"organizations_url": "https://api.github.com/users/charisk/orgs",
"repos_url": "https://api.github.com/users/charisk/repos",
"events_url": "https://api.github.com/users/charisk/events{/privacy}",
"received_events_url": "https://api.github.com/users/charisk/received_events",
"type": "User",
"site_admin": true
},
"query_language": "javascript",
"query_pack_url": "https://objects-origin.githubusercontent.com/codeql-query-console/variant_analyses/146/query_pack?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=queryconsoleprod%2F20221026%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20221026T124732Z&X-Amz-Expires=3600&X-Amz-Signature=ad791eb1a754f473a50454616e9bd04663dfed60a5c84f2c61f27ced47ee25d0&X-Amz-SignedHeaders=host",
"created_at": "2022-10-26T12:45:12Z",
"updated_at": "2022-10-26T12:45:15Z",
"actions_workflow_run_id": 3329095282,
"status": "in_progress",
"scanned_repositories": [
{
"repository": {
"id": 206444,
"name": "hive",
"full_name": "apache/hive",
"private": false,
"stargazers_count": 4523,
"updated_at": "2022-11-02T10:04:02Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 81841,
"result_count": 4
},
{
"repository": {
"id": 20753500,
"name": "ng-nice",
"full_name": "angular-cn/ng-nice",
"private": false,
"stargazers_count": 192,
"updated_at": "2022-03-17T08:34:30Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 156706,
"result_count": 8
},
{
"repository": {
"id": 23418517,
"name": "hadoop",
"full_name": "apache/hadoop",
"private": false,
"stargazers_count": 13030,
"updated_at": "2022-11-02T08:23:58Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 66895,
"result_count": 3
},
{
"repository": {
"id": 236095576,
"name": "backstage",
"full_name": "backstage/backstage",
"private": false,
"stargazers_count": 19033,
"updated_at": "2022-11-02T10:25:24Z"
},
"analysis_status": "in_progress"
},
{
"repository": {
"id": 257485422,
"name": "vite",
"full_name": "vitejs/vite",
"private": false,
"stargazers_count": 49064,
"updated_at": "2022-11-02T11:29:22Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 702,
"result_count": 0
}
],
"skipped_repositories": {
"access_mismatch_repos": {
"repository_count": 0,
"repositories": []
},
"no_codeql_db_repos": {
"repository_count": 0,
"repositories": []
},
"over_limit_repos": {
"repository_count": 0,
"repositories": []
}
}
}
}
}

View File

@@ -0,0 +1,183 @@
{
"request": {
"kind": "getVariantAnalysis"
},
"response": {
"status": 200,
"body": {
"id": 146,
"controller_repo": {
"id": 557804416,
"node_id": "R_kgDOIT9rgA",
"name": "mrva-demo-controller-repo",
"full_name": "github/mrva-demo-controller-repo",
"private": true,
"owner": {
"login": "github",
"id": 9919,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=",
"avatar_url": "https://avatars.githubusercontent.com/u/9919?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/github",
"html_url": "https://github.com/github",
"followers_url": "https://api.github.com/users/github/followers",
"following_url": "https://api.github.com/users/github/following{/other_user}",
"gists_url": "https://api.github.com/users/github/gists{/gist_id}",
"starred_url": "https://api.github.com/users/github/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/github/subscriptions",
"organizations_url": "https://api.github.com/users/github/orgs",
"repos_url": "https://api.github.com/users/github/repos",
"events_url": "https://api.github.com/users/github/events{/privacy}",
"received_events_url": "https://api.github.com/users/github/received_events",
"type": "Organization",
"site_admin": false
},
"html_url": "https://github.com/github/mrva-demo-controller-repo",
"description": null,
"fork": false,
"url": "https://api.github.com/repos/github/mrva-demo-controller-repo",
"forks_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/forks",
"keys_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/teams",
"hooks_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/hooks",
"issue_events_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues/events{/number}",
"events_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/events",
"assignees_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/assignees{/user}",
"branches_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/branches{/branch}",
"tags_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/tags",
"blobs_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/statuses/{sha}",
"languages_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/languages",
"stargazers_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/stargazers",
"contributors_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/contributors",
"subscribers_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/subscribers",
"subscription_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/subscription",
"commits_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/contents/{+path}",
"compare_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/merges",
"archive_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/downloads",
"issues_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues{/number}",
"pulls_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/pulls{/number}",
"milestones_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/milestones{/number}",
"notifications_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/labels{/name}",
"releases_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/releases{/id}",
"deployments_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/deployments"
},
"actor": {
"login": "charisk",
"id": 311693,
"node_id": "MDQ6VXNlcjMxMTY5Mw==",
"avatar_url": "https://avatars.githubusercontent.com/u/311693?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/charisk",
"html_url": "https://github.com/charisk",
"followers_url": "https://api.github.com/users/charisk/followers",
"following_url": "https://api.github.com/users/charisk/following{/other_user}",
"gists_url": "https://api.github.com/users/charisk/gists{/gist_id}",
"starred_url": "https://api.github.com/users/charisk/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/charisk/subscriptions",
"organizations_url": "https://api.github.com/users/charisk/orgs",
"repos_url": "https://api.github.com/users/charisk/repos",
"events_url": "https://api.github.com/users/charisk/events{/privacy}",
"received_events_url": "https://api.github.com/users/charisk/received_events",
"type": "User",
"site_admin": true
},
"query_language": "javascript",
"query_pack_url": "https://objects-origin.githubusercontent.com/codeql-query-console/variant_analyses/146/query_pack?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=queryconsoleprod%2F20221026%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20221026T124759Z&X-Amz-Expires=3600&X-Amz-Signature=5b0be34c426152c37e3d4c761bf576a07c9d4bb6222f32c438e02605600f0394&X-Amz-SignedHeaders=host",
"created_at": "2022-10-26T12:45:12Z",
"updated_at": "2022-10-26T12:45:15Z",
"actions_workflow_run_id": 3329095282,
"status": "in_progress",
"scanned_repositories": [
{
"repository": {
"id": 206444,
"name": "hive",
"full_name": "apache/hive",
"private": false,
"stargazers_count": 4523,
"updated_at": "2022-11-02T10:04:02Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 81841,
"result_count": 4
},
{
"repository": {
"id": 20753500,
"name": "ng-nice",
"full_name": "angular-cn/ng-nice",
"private": false,
"stargazers_count": 192,
"updated_at": "2022-03-17T08:34:30Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 156706,
"result_count": 8
},
{
"repository": {
"id": 23418517,
"name": "hadoop",
"full_name": "apache/hadoop",
"private": false,
"stargazers_count": 13030,
"updated_at": "2022-11-02T08:23:58Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 66895,
"result_count": 3
},
{
"repository": {
"id": 236095576,
"name": "backstage",
"full_name": "backstage/backstage",
"private": false,
"stargazers_count": 19033,
"updated_at": "2022-11-02T10:25:24Z"
},
"analysis_status": "in_progress"
},
{
"repository": {
"id": 257485422,
"name": "vite",
"full_name": "vitejs/vite",
"private": false,
"stargazers_count": 49064,
"updated_at": "2022-11-02T11:29:22Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 702,
"result_count": 0
}
],
"skipped_repositories": {
"access_mismatch_repos": {
"repository_count": 0,
"repositories": []
},
"no_codeql_db_repos": {
"repository_count": 0,
"repositories": []
},
"over_limit_repos": {
"repository_count": 0,
"repositories": []
}
}
}
}
}

View File

@@ -0,0 +1,183 @@
{
"request": {
"kind": "getVariantAnalysis"
},
"response": {
"status": 200,
"body": {
"id": 146,
"controller_repo": {
"id": 557804416,
"node_id": "R_kgDOIT9rgA",
"name": "mrva-demo-controller-repo",
"full_name": "github/mrva-demo-controller-repo",
"private": true,
"owner": {
"login": "github",
"id": 9919,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=",
"avatar_url": "https://avatars.githubusercontent.com/u/9919?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/github",
"html_url": "https://github.com/github",
"followers_url": "https://api.github.com/users/github/followers",
"following_url": "https://api.github.com/users/github/following{/other_user}",
"gists_url": "https://api.github.com/users/github/gists{/gist_id}",
"starred_url": "https://api.github.com/users/github/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/github/subscriptions",
"organizations_url": "https://api.github.com/users/github/orgs",
"repos_url": "https://api.github.com/users/github/repos",
"events_url": "https://api.github.com/users/github/events{/privacy}",
"received_events_url": "https://api.github.com/users/github/received_events",
"type": "Organization",
"site_admin": false
},
"html_url": "https://github.com/github/mrva-demo-controller-repo",
"description": null,
"fork": false,
"url": "https://api.github.com/repos/github/mrva-demo-controller-repo",
"forks_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/forks",
"keys_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/teams",
"hooks_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/hooks",
"issue_events_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues/events{/number}",
"events_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/events",
"assignees_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/assignees{/user}",
"branches_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/branches{/branch}",
"tags_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/tags",
"blobs_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/statuses/{sha}",
"languages_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/languages",
"stargazers_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/stargazers",
"contributors_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/contributors",
"subscribers_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/subscribers",
"subscription_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/subscription",
"commits_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/contents/{+path}",
"compare_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/merges",
"archive_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/downloads",
"issues_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues{/number}",
"pulls_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/pulls{/number}",
"milestones_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/milestones{/number}",
"notifications_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/labels{/name}",
"releases_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/releases{/id}",
"deployments_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/deployments"
},
"actor": {
"login": "charisk",
"id": 311693,
"node_id": "MDQ6VXNlcjMxMTY5Mw==",
"avatar_url": "https://avatars.githubusercontent.com/u/311693?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/charisk",
"html_url": "https://github.com/charisk",
"followers_url": "https://api.github.com/users/charisk/followers",
"following_url": "https://api.github.com/users/charisk/following{/other_user}",
"gists_url": "https://api.github.com/users/charisk/gists{/gist_id}",
"starred_url": "https://api.github.com/users/charisk/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/charisk/subscriptions",
"organizations_url": "https://api.github.com/users/charisk/orgs",
"repos_url": "https://api.github.com/users/charisk/repos",
"events_url": "https://api.github.com/users/charisk/events{/privacy}",
"received_events_url": "https://api.github.com/users/charisk/received_events",
"type": "User",
"site_admin": true
},
"query_language": "javascript",
"query_pack_url": "https://objects-origin.githubusercontent.com/codeql-query-console/variant_analyses/146/query_pack?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=queryconsoleprod%2F20221026%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20221026T124805Z&X-Amz-Expires=3600&X-Amz-Signature=73b43f47ee53938b91fa7d23c33e750c466fff777ea94ceb052771ee8dc25b6c&X-Amz-SignedHeaders=host",
"created_at": "2022-10-26T12:45:12Z",
"updated_at": "2022-10-26T12:45:15Z",
"actions_workflow_run_id": 3329095282,
"status": "in_progress",
"scanned_repositories": [
{
"repository": {
"id": 206444,
"name": "hive",
"full_name": "apache/hive",
"private": false,
"stargazers_count": 4523,
"updated_at": "2022-11-02T10:04:02Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 81841,
"result_count": 4
},
{
"repository": {
"id": 20753500,
"name": "ng-nice",
"full_name": "angular-cn/ng-nice",
"private": false,
"stargazers_count": 192,
"updated_at": "2022-03-17T08:34:30Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 156706,
"result_count": 8
},
{
"repository": {
"id": 23418517,
"name": "hadoop",
"full_name": "apache/hadoop",
"private": false,
"stargazers_count": 13030,
"updated_at": "2022-11-02T08:23:58Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 66895,
"result_count": 3
},
{
"repository": {
"id": 236095576,
"name": "backstage",
"full_name": "backstage/backstage",
"private": false,
"stargazers_count": 19033,
"updated_at": "2022-11-02T10:25:24Z"
},
"analysis_status": "in_progress"
},
{
"repository": {
"id": 257485422,
"name": "vite",
"full_name": "vitejs/vite",
"private": false,
"stargazers_count": 49064,
"updated_at": "2022-11-02T11:29:22Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 702,
"result_count": 0
}
],
"skipped_repositories": {
"access_mismatch_repos": {
"repository_count": 0,
"repositories": []
},
"no_codeql_db_repos": {
"repository_count": 0,
"repositories": []
},
"over_limit_repos": {
"repository_count": 0,
"repositories": []
}
}
}
}
}

View File

@@ -0,0 +1,185 @@
{
"request": {
"kind": "getVariantAnalysis"
},
"response": {
"status": 200,
"body": {
"id": 146,
"controller_repo": {
"id": 557804416,
"node_id": "R_kgDOIT9rgA",
"name": "mrva-demo-controller-repo",
"full_name": "github/mrva-demo-controller-repo",
"private": true,
"owner": {
"login": "github",
"id": 9919,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=",
"avatar_url": "https://avatars.githubusercontent.com/u/9919?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/github",
"html_url": "https://github.com/github",
"followers_url": "https://api.github.com/users/github/followers",
"following_url": "https://api.github.com/users/github/following{/other_user}",
"gists_url": "https://api.github.com/users/github/gists{/gist_id}",
"starred_url": "https://api.github.com/users/github/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/github/subscriptions",
"organizations_url": "https://api.github.com/users/github/orgs",
"repos_url": "https://api.github.com/users/github/repos",
"events_url": "https://api.github.com/users/github/events{/privacy}",
"received_events_url": "https://api.github.com/users/github/received_events",
"type": "Organization",
"site_admin": false
},
"html_url": "https://github.com/github/mrva-demo-controller-repo",
"description": null,
"fork": false,
"url": "https://api.github.com/repos/github/mrva-demo-controller-repo",
"forks_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/forks",
"keys_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/teams",
"hooks_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/hooks",
"issue_events_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues/events{/number}",
"events_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/events",
"assignees_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/assignees{/user}",
"branches_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/branches{/branch}",
"tags_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/tags",
"blobs_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/statuses/{sha}",
"languages_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/languages",
"stargazers_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/stargazers",
"contributors_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/contributors",
"subscribers_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/subscribers",
"subscription_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/subscription",
"commits_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/contents/{+path}",
"compare_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/merges",
"archive_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/downloads",
"issues_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/issues{/number}",
"pulls_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/pulls{/number}",
"milestones_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/milestones{/number}",
"notifications_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/labels{/name}",
"releases_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/releases{/id}",
"deployments_url": "https://api.github.com/repos/github/mrva-demo-controller-repo/deployments"
},
"actor": {
"login": "charisk",
"id": 311693,
"node_id": "MDQ6VXNlcjMxMTY5Mw==",
"avatar_url": "https://avatars.githubusercontent.com/u/311693?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/charisk",
"html_url": "https://github.com/charisk",
"followers_url": "https://api.github.com/users/charisk/followers",
"following_url": "https://api.github.com/users/charisk/following{/other_user}",
"gists_url": "https://api.github.com/users/charisk/gists{/gist_id}",
"starred_url": "https://api.github.com/users/charisk/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/charisk/subscriptions",
"organizations_url": "https://api.github.com/users/charisk/orgs",
"repos_url": "https://api.github.com/users/charisk/repos",
"events_url": "https://api.github.com/users/charisk/events{/privacy}",
"received_events_url": "https://api.github.com/users/charisk/received_events",
"type": "User",
"site_admin": true
},
"query_language": "javascript",
"query_pack_url": "https://objects-origin.githubusercontent.com/codeql-query-console/variant_analyses/146/query_pack?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=queryconsoleprod%2F20221026%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20221026T124815Z&X-Amz-Expires=3600&X-Amz-Signature=0f42201f27ad08ac1fa9caccf5005d9dac7bdcae33e88e33d62e2fc337194164&X-Amz-SignedHeaders=host",
"created_at": "2022-10-26T12:45:12Z",
"updated_at": "2022-10-26T12:45:15Z",
"actions_workflow_run_id": 3329095282,
"status": "in_progress",
"scanned_repositories": [
{
"repository": {
"id": 206444,
"name": "hive",
"full_name": "apache/hive",
"private": false,
"stargazers_count": 4523,
"updated_at": "2022-11-02T10:04:02Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 81841,
"result_count": 4
},
{
"repository": {
"id": 20753500,
"name": "ng-nice",
"full_name": "angular-cn/ng-nice",
"private": false,
"stargazers_count": 192,
"updated_at": "2022-03-17T08:34:30Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 156706,
"result_count": 8
},
{
"repository": {
"id": 23418517,
"name": "hadoop",
"full_name": "apache/hadoop",
"private": false,
"stargazers_count": 13030,
"updated_at": "2022-11-02T08:23:58Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 66895,
"result_count": 3
},
{
"repository": {
"id": 236095576,
"name": "backstage",
"full_name": "backstage/backstage",
"private": false,
"stargazers_count": 19033,
"updated_at": "2022-11-02T10:25:24Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 710,
"result_count": 0
},
{
"repository": {
"id": 257485422,
"name": "vite",
"full_name": "vitejs/vite",
"private": false,
"stargazers_count": 49064,
"updated_at": "2022-11-02T11:29:22Z"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 702,
"result_count": 0
}
],
"skipped_repositories": {
"access_mismatch_repos": {
"repository_count": 0,
"repositories": []
},
"no_codeql_db_repos": {
"repository_count": 0,
"repositories": []
},
"over_limit_repos": {
"repository_count": 0,
"repositories": []
}
}
}
}
}

View File

@@ -0,0 +1,84 @@
{
"request": {
"kind": "getVariantAnalysisRepo",
"repositoryId": 236095576
},
"response": {
"status": 200,
"body": {
"repository": {
"id": 236095576,
"node_id": "MDEwOlJlcG9zaXRvcnkyMzYwOTU1NzY=",
"name": "backstage",
"full_name": "backstage/backstage",
"private": false,
"owner": {
"login": "backstage",
"id": 72526453,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjcyNTI2NDUz",
"avatar_url": "https://avatars.githubusercontent.com/u/72526453?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/backstage",
"html_url": "https://github.com/backstage",
"followers_url": "https://api.github.com/users/backstage/followers",
"following_url": "https://api.github.com/users/backstage/following{/other_user}",
"gists_url": "https://api.github.com/users/backstage/gists{/gist_id}",
"starred_url": "https://api.github.com/users/backstage/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/backstage/subscriptions",
"organizations_url": "https://api.github.com/users/backstage/orgs",
"repos_url": "https://api.github.com/users/backstage/repos",
"events_url": "https://api.github.com/users/backstage/events{/privacy}",
"received_events_url": "https://api.github.com/users/backstage/received_events",
"type": "Organization",
"site_admin": false
},
"html_url": "https://github.com/backstage/backstage",
"description": "Backstage is an open platform for building developer portals",
"fork": false,
"url": "https://api.github.com/repos/backstage/backstage",
"forks_url": "https://api.github.com/repos/backstage/backstage/forks",
"keys_url": "https://api.github.com/repos/backstage/backstage/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/backstage/backstage/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/backstage/backstage/teams",
"hooks_url": "https://api.github.com/repos/backstage/backstage/hooks",
"issue_events_url": "https://api.github.com/repos/backstage/backstage/issues/events{/number}",
"events_url": "https://api.github.com/repos/backstage/backstage/events",
"assignees_url": "https://api.github.com/repos/backstage/backstage/assignees{/user}",
"branches_url": "https://api.github.com/repos/backstage/backstage/branches{/branch}",
"tags_url": "https://api.github.com/repos/backstage/backstage/tags",
"blobs_url": "https://api.github.com/repos/backstage/backstage/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/backstage/backstage/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/backstage/backstage/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/backstage/backstage/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/backstage/backstage/statuses/{sha}",
"languages_url": "https://api.github.com/repos/backstage/backstage/languages",
"stargazers_url": "https://api.github.com/repos/backstage/backstage/stargazers",
"contributors_url": "https://api.github.com/repos/backstage/backstage/contributors",
"subscribers_url": "https://api.github.com/repos/backstage/backstage/subscribers",
"subscription_url": "https://api.github.com/repos/backstage/backstage/subscription",
"commits_url": "https://api.github.com/repos/backstage/backstage/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/backstage/backstage/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/backstage/backstage/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/backstage/backstage/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/backstage/backstage/contents/{+path}",
"compare_url": "https://api.github.com/repos/backstage/backstage/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/backstage/backstage/merges",
"archive_url": "https://api.github.com/repos/backstage/backstage/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/backstage/backstage/downloads",
"issues_url": "https://api.github.com/repos/backstage/backstage/issues{/number}",
"pulls_url": "https://api.github.com/repos/backstage/backstage/pulls{/number}",
"milestones_url": "https://api.github.com/repos/backstage/backstage/milestones{/number}",
"notifications_url": "https://api.github.com/repos/backstage/backstage/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/backstage/backstage/labels{/name}",
"releases_url": "https://api.github.com/repos/backstage/backstage/releases{/id}",
"deployments_url": "https://api.github.com/repos/backstage/backstage/deployments"
},
"analysis_status": "succeeded",
"artifact_size_in_bytes": 710,
"result_count": 0,
"database_commit_sha": "18536a76c5efb0f0706c309f3295ed7f11f80491",
"source_location_prefix": "/home/runner/work/backstage/backstage",
"artifact_url": "https://objects-origin.githubusercontent.com/codeql-query-console/codeql-variant-analysis-repo-tasks/146/236095576/b4e1e158-d7ce-45e8-8fac-dad3524f2d54?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=queryconsoleprod%2F20221026%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20221026T124816Z&X-Amz-Expires=300&X-Amz-Signature=c215823eebb9d0ca92045e1c99591dfd28005562815b46d68cbfad25621375ea&X-Amz-SignedHeaders=host&actor_id=311693&key_id=0&repo_id=557804416"
}
}
}

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