Граф коммитов

311 Коммитов

Автор SHA1 Сообщение Дата
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
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 131e72b162 Decouple `join-order.ts` from VS Code for testing purposes 2022-10-14 15:32:03 -04:00
Koen Vlaswinkel 1d02c19854 Add tests for RepoRow expansion 2022-10-07 14:00:46 +02:00
Robert 4d3385825b Move test to pure-tests directory 2022-09-23 13:05:07 +01:00
Koen Vlaswinkel 70098aa19c Fix running unit tests on Windows 2022-09-16 14:58:26 +02:00
Koen Vlaswinkel cd2b5a8c59 Set timezone and locale for tests 2022-09-16 14:36:12 +02:00
Koen Vlaswinkel cbc2650f30 Add tests for date and number formatting functions 2022-09-16 13:18:21 +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
Shati Patel 4d6076c4ea
Escape HTML characters when rendering MRVA results as markdown (#1462) 2022-08-17 10:52:36 +01:00
Dave Bartolomeo 841f1d3310 Replace console logging to route through problem reporter 2022-08-12 16:43:21 -04:00
Dave Bartolomeo d58fb54928 Better formatting of metrics 2022-08-11 13:51:11 -04:00
Dave Bartolomeo fdc209ca08 Test for log scanning 2022-08-10 18:07:59 -04:00
Dave Bartolomeo 02270aaeee Fix lint 2022-08-10 13:13:59 -04:00
Dave Bartolomeo 51fb03b4b1 Fix tests to match code changes 2022-08-10 13:11:34 -04:00
Dave Bartolomeo 6b9f73e156 Add comment to test data file 2022-08-01 13:19:15 -04:00
Dave Bartolomeo 7c1fce3319 Merge remote-tracking branch 'origin/main' into dbartol/goto-ql 2022-07-28 22:29:45 -04:00
Dave Bartolomeo 476ea7aef0 Integration test 2022-07-28 22:20:22 -04:00
Angela P Wen 833f8e06ca
Add a tree viewer UI for the evaluator logs (#1433)
Co-authored-by: Aditya Sharad <6874315+adityasharad@users.noreply.github.com>
2022-07-22 12:01:39 +02:00
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 a3bbdafabb Add tests for 'tryGetRemoteLocation' 2022-06-01 21:19:35 +01:00
shati-patel 5efc3835db Add sourceLocationPrefix to one of the test files 2022-06-01 21:19:35 +01:00
Andrew Eisenberg 615cf86fc0 Refactor time functions
Rename, add comments, and extract some local variables.
2022-05-27 08:51:14 -07:00
Andrew Eisenberg 9d26304f7a Extract time functions
Create the `time.ts` module as a place to put fime functions.
Move two time functions there and create tests for them.

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

Also, fix a small bug in the results view to enure `repository`
is correctly pluralized.
2022-05-26 15:47:03 -07:00
Andrew Eisenberg 351db4efc8 Fix cli-integration tests
The main problem this commit fixes is with vscode 1.67.0, an error is
thrown when inside of integration tests and a dialog box is opened. We
were opening the telemetry dialog box. Now, an env variable is set
during cli-integration tests that prevents the dialog from being
opened.

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

- `vscode-test` dependency has been renamed to `@vscode/test-electron`,
  so use that instead and make the small API changes to support it.
- Commit the codeql-pack.lock.yml file so it isn't recreated on each
  test run.
- Ensure all databases are removed before _and after_ each test run
  that manipulates the set of installed databases
- Similarly, for quick query files, delete them before and after each
  test.
- Change some async `forEach` blocks to for loops in order to support
  sequential operations more easily.
2022-05-09 13:50:28 -07:00
shati-patel e1adc7b428 MRVA: Rename summary file to make it appear first alphabetically 2022-05-05 14:32:55 +01:00
shati-patel dc34adadcd Tidy up tests to use expected directory 2022-05-05 14:01:39 +01:00
shati-patel 6e06381640 Move `expected` files into subdirectory 2022-05-05 14:01:39 +01:00
shati-patel f55389cd26 MRVA: Also test names of generated markdown files 2022-05-05 14:01:39 +01:00
shati-patel f7616cf685 Refactor: Include filename when generating markdown 2022-05-04 17:18:00 +01:00
Charis Kyriakou a97c5fe836
MRVA: Support both local and gist links when generating markdown 2022-05-03 13:27:53 +01:00
shati-patel 9b6eddddae MRVA: Expand path results individually 2022-04-29 18:50:30 +01:00
shati-patel cb84003c31 Actually fix the test + code scanning error 🤞🏽 2022-04-29 14:58:16 +01:00
shati-patel a1cd87aa3a Update test data + try to fix code scanning error 2022-04-29 14:58:16 +01:00
shati-patel 7d3b015e20 Generate markdown for raw result tables 2022-04-29 14:58:16 +01:00
shati-patel ffcc1f82f1 Generate markdown summary file for raw results 2022-04-27 16:45:01 +01:00
shati-patel 3e33b00a75 Add test data for raw results 2022-04-27 16:45:01 +01:00
shati-patel c55e801d00 Add example with multiple paths 2022-04-26 10:15:45 +01:00
shati-patel b363f77a83 Tidy up how we display paths 2022-04-26 10:15:45 +01:00
shati-patel f55f46f95b Markdown rendering: Display paths 2022-04-26 10:15:45 +01:00
shati-patel 2b8b621298 10% nicer way of wrapping code lines 😄
+ update test data to contain a single-line example
2022-04-25 12:42:10 +01:00
shati-patel aed4c9fc58 MRVA: Make markdown code snippets look nicer
Remove some extraneous newlines
2022-04-25 12:42:10 +01:00
shati-patel 908a862dd1 Tidy up test 2022-04-21 09:57:23 +01:00
shati-patel 6676ba99d0 Add initial test data for problem query 2022-04-21 09:57:23 +01:00
shati-patel 6d3c6e598f Change folder structure to have separate folders for path-problem and problem queries 2022-04-21 09:57:23 +01:00
shati-patel e1a10fc827 Markdown results: Highlight snippets with "<strong>" 2022-04-21 09:17:31 +01:00
shati-patel a74dfea08b Use HTML code blocks
This is so that we can highlight code snippets using `<strong>` tags
2022-04-20 10:32:24 +01:00
shati-patel 8b2d79a7f7 Formatting fixes and code tidy-up 2022-04-12 12:32:45 +01:00
shati-patel c4db8b6d4b Create markdown summary file for sharing MRVA results 2022-04-12 12:32:45 +01:00
shati-patel 47ec074cfb Tidy-up and address review comments 2022-04-11 15:24:08 +01:00
shati-patel e44835e795 Make line endings consistent? 2022-04-11 15:24:08 +01:00
shati-patel 2e28146a58 Create markdown files for sharing results 2022-04-11 15:24:08 +01:00
Andrew Eisenberg 43f314b2b5 Change missing code snippet handling in UI
Also, simplify sarif tests.
2022-03-30 12:02:19 -07:00
Andrew Eisenberg 61e674e9f6 Allow for undefined codeSnippets
This reverts commit 006cc8c52a.
2022-03-29 13:10:28 -07:00
Andrew Eisenberg 006cc8c52a Undo sarif-processing change
Will move to a different PR.
2022-03-29 13:07:56 -07:00
Andrew Eisenberg ffe7fdcb46 Rename methods and address comments 2022-03-29 13:04:00 -07:00
Andrew Eisenberg 0383a91a68 Display proper download state in remote results view
Before displaying any results for a remote query, ensure that all
downloaded results are in memory. This ensures the proper download icon
is displayed alongside each NWO.
2022-03-28 12:38:13 -07:00
Andrew Eisenberg 23e29a1fdc Update tsc to 4.5.5
The default version of tsc in vscode is now 4.5.4. This version
has changed the type of the variable in the catch block.
Previously, it was `any`. Now it is `unknown`.

This change updates vscode so that it can build with 4.5.4.

Previously, this had been a bit of a pain since sometimes running
a compile task in vscode will use the global default version of
tsc.
2022-03-25 09:48:51 -07:00
Shati Patel 26244efc50
Create remote file links to GitHub URL (#1209)
Co-authored-by: Charis Kyriakou <charisk@github.com>
2022-03-16 14:11:17 +00:00
Charis Kyriakou 8cc2f598eb
Fix highlight region end column calculation (#1210) 2022-03-16 09:47:09 +00:00
Charis Kyriakou ed61eb0a95
Deal with analysis messages that have links to locations (#1195) 2022-03-14 08:14:09 +00:00
Charis Kyriakou 9af75634fa
Remove .only from mocha test (#1188) 2022-03-07 10:04:29 +00:00
Andrew Eisenberg 5ad754a3a2
Merge pull request #1178 from github/aeisenberg/log-history
Save log files to the query history directory
2022-03-03 08:14:25 -08:00
Charis Kyriakou c609377a9c
Add SARIF processing and basic alert rendering (#1171) 2022-03-03 09:03:27 +00:00
Andrew Eisenberg 2579d12f24 Save log files to the query history directory
This commit deprecates the the cutsom log directory option by saving
all log files with query history.

There is a simplification of the `OutputChannelLogger` since it no
longer needs to manage deleting log files on exit.

Also, the `codeQL.runningQueries.customLogDirectory` is marked as
deprecated. If this value is being used, a warning message is popped
up after the query completes.
2022-03-02 12:21:15 -08:00
Andrew Eisenberg 277869ebca Ensure graph queries with ids that have slashes work
Do this by actually walking the interpretation directory.

Move the directory walker from tests to prod and make it async. Also
add tests for it.

And add a warning on graph views to let users know that it is not
production quality.

Finally, change the interpreted directory to be `graphResults` instead
of `interpretedResults.sarif`.
2022-02-25 18:03:14 -08:00
marcnjaramillo 0bb1501e72 Move sarif parser and tests, build completing 2021-11-19 17:21:42 -08:00
marcnjaramillo d53abd815d Make suggested changes, build currently failing 2021-11-19 16:01:18 -08:00
shati-patel 2f3be92a71 Make functions async + other review comments 2021-05-21 21:41:40 +01:00
shati-patel e591236c4e Update tests 2021-05-21 21:41:40 +01:00
Andrew Eisenberg f2620c65af Add disposeHandlers
These functions assist with object disposal. They add custom behaviour
during disposal. The primary usage of disposalHandlers is during testing
where some objects should not be disposed in order to avoid testing
errors.

Additionally, move DisposableObject to the pure folder and create unit
tests for it.

Also, add `--disable-gpu` to command line options when running tests.
It helps to avoid error messages like this:

```- [19141:19141:0425/011526.129520:ERROR:sandbox_linux.cc(374)] InitializeSandbox() called with multiple threads in process gpu-process.```

See also https://askubuntu.com/a/1288969
2021-02-11 12:32:42 -08:00
Andrew Eisenberg 16eac45822 Add integration tests with the CLI
This commit adds integration tests that run commands using the CLI. This
change introduces a number of enhancements in order to get there.

1. Augments the index-template.ts file so that it downloads an
appropriate cli version if requested.
2. Adds the ensureCli.ts that performs the download if a a suitable
version is not already installed. See the comments in the file for how
this is done.
3. Changes how run-integration-tests is done so that the directories
run are specified through a cli argument.
4. Updates the main.yml workflow so that it also runs the
cli-integration tests.
5. Takes advantage of the return value of the call to `activate` on the
extension. This allows the integration tests to have access to internal
variables of the extension like the context, cli, and query server.
6. And of course, adds a handful of simple tests that ensure we have a
cli installed of the correct version.
2020-12-04 10:08:15 -08:00
Andrew Eisenberg 3c08baf062 Add query running test for computeDefaultStrings flag 2020-12-01 14:31:39 -08:00
Andrew Eisenberg e0cd041d98
Clean databases folder on startup (#675)
Cleans orphan databases on startup. This commit also bumps the fs-extra
dependency to get readdir with dirent objects.

Adds the `asyncFilter` to filter arrays asynchronously.
2020-11-16 16:32:05 +00:00
Andrew Eisenberg b2b1021207 Disable codeql test commands from the command palette
These commands are not applicable from the global context. They require
an argument to be passed in. So, they should be hidden in the command
palette.
2020-11-03 15:52:00 -08:00
Andrew Eisenberg fe1476f875
Ensure uris are using encoded strings (#653)
This fixes a bug where if there are special characters in a database
path, it is not possible to navigate to that file from the results view.

Note that the results from our BQRS returned properly encoded URIs, but
our paths coming from sarif were unencoded. Our path parsing handled
the latter correctly (even though these are not correct URIs) and the
former incorrectly.

The fix here is to first ensure all uris are properly encoded. We do
this by running `encodeURI` in sarif-utils (can't run encodeURIComponent
or else the path separators `/` will also be encoded).

Then, we ensure that when we resolve locations, we decode all file
paths.

This works in all cases I have tried. I still have an issue with running
View AST on some of these databases, but that I believe is a separate
issue.
2020-11-03 18:06:44 +00:00
Andrew Eisenberg 5133ee713f Add the assert-pure query
This query ensures that all of our files marked as "pure" remain that
way. In this case "pure" means that it does not depend on vscode and
can therefore be run in tests outside of a runtime environment.

This commit also explicitly moves all of our "pure" files to the
`src/pure` directory.
2020-11-02 18:40:45 -08:00
Andrew Eisenberg ef5d7bf684 Add version info to cli
And also only add the `--kind=DIL` to `generateDil` if version is
>= 2.3.0.
2020-10-26 09:03:43 -07:00
Andrew Eisenberg d8ab85748f Add some config listener tests
This also renames the config listeners for more consistency.
2020-10-21 15:48:35 -07:00
Andrew Eisenberg 68fe3bfbef Use the codeQL.runningTests.numberOfThreads
This setting has existed for a while, but it was not used for some
reason.
2020-10-21 15:48:35 -07:00
Andrew Eisenberg 06b6a4705a Ensure backslashes are properly escaped in sarif messages
Problem was that we were not globally replaceing `\\` with `\`.

Also, this PR adds some new tests to sarif-utils.ts. In doing so, we
have fixed a small bug in getPathRelativeToSourceLocationPrefix.

Previously, we were uri decoding the sarifRelativeUri. However, this is
no longer correct because the result is another URI and it should
remain encoded if it originally was.

Resolves #585
2020-10-01 07:44:47 -07:00
Andrew Eisenberg 84028434e0 Refactor: Remove duplicated BQRS types
This refactoring combines the types in `bqrs-types.ts` and
`bqrs-cli-types.ts`. Historically, the former was used for BQRS files
parsed by the extension and the latter for BQRS files parsed by the cli.
They describe the same file types, but using different property and type
names.

We have moved to parsing all BQRS files by the cli. This refactoring
removes the `bqrs-types.ts` file and replaces all BQRS references to
use types in `bqrs-cli-types.ts`.

Additionally, the `adapt.ts` file has been deleted since its purpose
was to convert between extension and cli BQRS types. Some one type and
one function from `adapt.ts` has been moved from `adapt.ts` to
`bqrs-types.ts`. It's possible that we want to do a further refactoring
to simply remove them both.
2020-09-24 07:54:50 -07:00
Andrew Eisenberg 8459edb57c Fix tests and reformatting
* Fix command-linting tests.
* Fix failing windows test and Use Uri.parse(_, true)
* Use  Uri.parse(_, true). That is the preferred API.
* Reformat comments.
2020-07-16 14:42:48 -07:00
Jason Reed 2dd841e667 Pacify lint.
Apparently the linter wants a tsconfig file to be able to lint the
compare view typescript. I made the configFile specification in the
webpack.config.ts more specific so that we use the same config
every time during webview build.
2020-07-13 13:04:22 -04:00
Jason Reed 10156b1f49 Remove semmle-bqrs dependency from test. 2020-07-13 12:46:17 -04:00
Jason Reed 4c30374dc3 Extract tryGetResolvableLocation from semmle-bqrs 2020-07-13 11:01:11 -04:00
Jason Reed 26d83b5cef Reduce dependencies on semmle-bqrs.
Eliminate references to types in library semmle-bqrs in favor of a
local copy of those same types in bqrs-types.ts.
2020-07-13 10:56:11 -04:00
Andrew Eisenberg 3a23f05a0a Add command to run multiple queries at once from file explorer
New command called `codeQL.runQueries`.

When invoked, gather all selected files and folders, and recursively
search for ql files to run. Warn the user if a directory is selected.
See comment inline for reason.
2020-06-22 09:08:12 -07:00
Andrew Eisenberg ff8e72a318 Run eslint --fix on the extension 2020-06-16 08:44:37 -07:00
Andrew Eisenberg 8262ecf990 Fix syntax error in ql library 2020-05-26 12:01:22 -07:00
Jason Reed dd1bdf54bb Add integrity check for commands in package.json
Attempt to enforce some regularity in how we name commands, and fix
one command that was showing up improperly in the command palette.
2020-05-19 12:20:45 -04:00
Andrew Eisenberg 7d23a833b1 Add semi-colon linting 2020-05-13 12:06:53 -07:00
Andrew Eisenberg 2f92477bd9 Move storagePath calculation to extension.ts 2020-05-13 08:10:38 -07:00
Andrew Eisenberg c3e3390647 Extract BQRS locations from string results 2020-05-08 11:49:46 -07:00
Andrew Eisenberg bb28dafc43 lint: Add proper linting for react 2020-03-25 12:02:12 -07:00
Andrew Eisenberg 7ce3dc2c43 feat: Display warning when codeql.cmd is used
The old launcher has been deprecated and codeql.exe is
recommended.

Fixes #287.
2020-03-23 09:06:53 -07:00
Andrew Eisenberg 6793f8e92d feat: Adds command to show query log in editor
Right clicking on the history page will now have a new option to show
the associated log.

Closes #236
Closes #234
2020-03-19 08:11:20 -07:00
Andrew Eisenberg 5facab1f9e lint: Fix linting and update linting rules 2020-03-19 08:11:20 -07:00
Andrew Eisenberg a6043f2518 feat: Save log files per query
This feature adds logging per-query. Each query will be logged in its
own location in either workspace or globally shared location in
vscode.

There are limitations here. We are only guessing when one query ends
and another begins. We assume that queries don't occur in parallel.
If they do, the previous query will have its results intermingled
with the current query's results.

To fix that, we will need to update how the query-server emits log
messages so that each query message is attached to a tag that
specifies the query that emitted it.
2020-03-19 08:11:20 -07:00
Jason Reed dc09925149 Add test for quick-query in .qll fix. 2020-03-18 10:42:49 -04:00
Andrew Eisenberg 443abea7d7 chore: Introduce eslint
Adds eslint support and fixes linting problems in a few files.

This change adds an npm task, but does not enforce linting for builds.

The idea is to slowly fix linting problems over time.

Closes #238.
2020-03-17 09:14:02 -07:00
Andrew Eisenberg 1efa9f1082 Update contributing documentation and launch config
Adds section in CONTRIBUTING.md to document how to run tests. Also,
fixes some markdown linting warnings.

And fixes the launch config for running unit tests.
2020-03-07 16:36:09 -08:00
Jason Reed 71898ac4ce Add command for restarting the query server.
Include a convenience button to show the query server log in case the
reason the user wants to restart the server is that it's acting
unexpectedly and they want to investigate why.
2020-02-19 08:58:59 -05:00
Henry Mercer 2d19498f1f Increase timeout for query unit tests
This gives the query server sufficient time to startup.
2020-01-03 15:32:03 +00:00
Henry Mercer 5fef262d6e Add additional checkpoints to query server tests
Some of the query server tests are async, so multiple tests can be in
progress at once.
2019-12-20 16:40:25 +00:00
Henry Mercer 8190e7c642 Enable unused value compiler checks
Specifically, enable the noUnusedLocals and noUnusedParameters options.
2019-12-11 11:57:07 +00:00
Aditya Sharad d9a1dce7fa CodeQL for VS Code: Initial commit. 2019-11-13 12:23:53 -08:00