Commit Graph

1739 Commits

Author SHA1 Message Date
Elena Tanasoiu
9c598c2f06 Extract pluralize method
There are at least 4 different files where this method could DRY things up,
so let's extract it.

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

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

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

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

Previously we could only do this for local queries.

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

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

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

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

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

`<query_name> - <query_status>`

to

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

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

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

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

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

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

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

Co-authored-by: Shati Patel <shati-patel@github.com>
2022-07-18 19:52:51 +01:00
Elena Tanasoiu
c4df9dbec8 Extract method for creating Extension context
We'd like to re-use this to test the `exportResultsToGist` method in
`export-results.ts`.

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

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

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

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

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

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

Example of new title:

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

This translates to:

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

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

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

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

Co-authored-by: Shati Patel <shati-patel@github.com>
2022-07-18 19:20:58 +01:00
Shati Patel
f992679e94 MRVA: Include more info in query history label (#1427)
Co-authored-by: Elena Tanasoiu <elenatanasoiu@github.com>
2022-07-15 13:58:45 +01:00
Shati Patel
ffe1704ac0 Replace code paths dropdown with VS Code UI Toolkit (#1429) 2022-07-15 13:04:36 +01:00
Edoardo Pirovano
bd2dd04ac6 Regularly scrub query history view 2022-07-14 16:59:08 +01:00
Edoardo Pirovano
bbf4a03b03 Fix typo in config parameter name 2022-07-13 16:34:18 +01:00
Shati Patel
f38eb4895d Replace "repository search" filter box with VS Code UI Toolkit (#1424) 2022-07-13 15:13:31 +01:00
Andrew Eisenberg
f559b59ee5 Merge pull request #1420 from github/robertbrignull/api-retry
Add API retries for octokit requests
2022-07-12 08:12:21 -07:00
Angela P Wen
c9d895ea42 Parse summary of evaluator logs into data model (#1405)
Co-authored-by: Aditya Sharad <6874315+adityasharad@users.noreply.github.com>
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2022-07-12 14:04:55 +02:00
Shati Patel
e57bbcb711 Use VSCodeTags instead of Primer Labels in webview (#1421) 2022-07-01 16:21:44 +01:00
Shati Patel
b311991644 MRVA: Fix grammar in pop-up message (#1416) 2022-07-01 12:43:46 +01:00
Robert
825054a271 Use octokit retry module 2022-07-01 11:19:49 +00:00
Robert
f7aa0a5ae5 Install @octokot/plugin-retry 2022-07-01 11:06:22 +00:00
Andrew Eisenberg
f486ccfac6 Merge pull request #1418 from github/aeisenberg/resolve-ml-libs
Resolve ml-queries from directory
2022-06-30 08:56:15 -07:00
Andrew Eisenberg
70f74d3baf Resolve ml-queries from directory
Previously, there was a bug where quick eval queries would crash when
the eval snippet is in a library file.

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

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

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

(See CONTRIBUTING.md for details.)

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

The tests will still attempt to run.

Let's fail fast instead and add an actionable error message to the output.
2022-06-23 09:13:20 +01:00
Robert
8bc83a336a Show skipped private repos in log message 2022-06-22 17:18:29 +01:00