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

150 Коммитов

Автор SHA1 Сообщение Дата
Andrew Eisenberg 292e695646 Add telemetry for commands
This commit adds telemetry capturing for command execution. The data
captured explicitly captured and sent to application insights is only
the command id, execution time, and command completion status. We also
capture errors thrown by any command execution, but these are not sent
to application insights.

Telemetry capturing is opt-in. No data will be sent to application
insights unless the user explicitly allows it.

There are two new config settings added. The first controls whether or
not telemetry should be sent. This setting AND the global telemetry setting
must be enabled in order for telemetry to be sent.

The second setting controls whether or not telemetry event data should
be logged to the extension console. The hope here is that users can
inspect exactly what data is sent to the server and can have confidence
that nothing concerning is being leaked.

Note that the global setting for disabling telemetry collection is
handled inside the  `vscode-extension-telemetry` package implicitly, so
this extension doesn't touch that setting explicitly.

The `codeql.canary` setting is being used to add an additional flag to
telemetry events. This flag will help us determine if a user in internal
or not.

The application insights key is injected at build time through a
repository secret.

This commit also includes a new `TELEMETRY.md` file that explains what
is being captured, and why.
2021-01-29 15:21:12 -08:00
Andrew Eisenberg f154206b47 Fix invalid property name on message 2021-01-29 11:24:07 -08:00
Andrew Eisenberg 07eb334e6c Ensure databases are re-registered when query server restarts
This commit fixes #733. It does it by ensuring that the query server
emits an event when it restarts the query server. The database manager
listens for this even and properly re-registers its databases.

A few caveats though:

1. Convert query restarts to using a command that includes progress.
   This will ensure that errors on restart are logged properly.
2. Because we want to log errors, we cannot use the vscode standard
   EventEmitters. They run in the next tick and therefore any errors
   will not be associated with this command execution.
3. Update the default cli version to run integration tests against to
   2.4.2.
4. Add a new integration test that fails if databases are not
   re-registered.
2021-01-29 11:24:07 -08:00
aeisenberg 650f4ca047 Bump version to v1.3.11 2021-01-21 19:06:58 +00:00
Andrew Eisenberg a7c73cc421 v1.3.10 2021-01-20 14:15:45 -08:00
Andrew Eisenberg 9c72e81264 Update changelog 2021-01-20 13:05:53 -08:00
aeisenberg 49ac9796a1 Bump version to v1.3.9 2020-12-17 11:55:58 -08:00
Andrew Eisenberg 89b6b5a945 v1.3.8 2020-12-17 11:52:33 -08:00
Andrew Eisenberg 53ac1ed70d Update changelog
Clarify a few entries.
2020-12-17 11:07:37 -08:00
Andrew Eisenberg 5824e3607a Add View AST Command to text editor where appropriate
Also, hide the `CodeQL: Run Queries` command inside of zip folders
since we do not allow queries to be in archives. I wish we could be more
specific about when to show that command, eg- only *.ql files and
directories, but I couldn't find a way to restrict a command to only
appear on directories.
2020-12-17 11:07:37 -08:00
Andrew Eisenberg b0e032be2c Fix set label command on history items
This removes the cached treeItem that is a property of the
completedQuery. We should not be caching them since they are cached by
the vscode api itself. Instead, we should recreate whenever requested.

Also, this change fixes #598 in a new way. Instead of adding the
context to the cached treeItem, we simply refresh only the item that has
changed. This is a fast operation.
2020-12-16 13:26:09 -08:00
Andrew Eisenberg 3ea3eda8aa Add descriptive text and a link at top of query results
The descriptive text is the same as the label in the query history view.
The link opens the file that ran the query.
2020-12-16 13:18:49 -08:00
Andrew Eisenberg 303cb3284c Avoid uninteresting user facing errors
This change avoids popping up error messages in two cases:

1. When doing test discovery, do not run discovery on non-existant
   directories. Also, if there is an error, print to the log, and do not
   pop up an error window. The reason is that test discovery is a
   background operation and these should not normally cause pop-ups.
2. When looking for orphaned databases, don't pop up an error if the
   storagePath can't be found. This is normal when working in a new,
   single root workspace.
2020-12-14 17:47:49 -08:00
Andrew Eisenberg 9ffb3a14c7
Save downloaded DB archives to disk before unzipping (#700)
This fixes two classes of DBs that can't be installed directly from
downloading:

1. DBs whose central directories do not align with their file headers.
   We need to download and save the entire archive  before we can read
   the central directory and use that to guide the unzipping.
2. Large DBs require too much memory so can't be downloaded and unzipped
   in a single stream.

We also add proper progress notifications to the download progress
monitor so users are aware of how many more MBs are left to download.

It's not yet possible to do the same for unzipping using the current
unzipper library, since unzipping using the central directory does not
expose a stream.

Co-authored-by: Alexander Eyers-Taylor <alexet@github.com>
2020-12-14 16:26:29 +00:00
Andrew Eisenberg b470e41431 Make error messages clearer for some common problems
1. Clicking on query history menu items when nothing is selected. Error
   message is clearer. It would be better to disable when nothing is
   selected, but waiting on
   https://github.com/microsoft/vscode/issues/99767 to be released.
2. Trying to run query with a missing or invalid qlpack has better
   message.
3. Better hover text for "Open query".

Co-authored-by: Aditya Sharad <6874315+adityasharad@users.noreply.github.com>
2020-12-09 15:35:59 -08:00
Andrew Eisenberg 43ef44ff12 Add a language label next to databases in the UI
This change will only work on databases created by cli >= 2.4.1. In that
version, a new `primaryLanguage` field in the `codeql-database.yml`
file. We use this property as the language.

This change also includes a refactoring of the logic around extracting
database information heuristically based on file location. As much
as possible, it is extracted to the `helpers` module. Also, the
initial quick query text is generated based on the language (if known)
otherwise it falls back to the old style of generation.
2020-12-04 09:36:54 -08:00
Andrew Eisenberg b6c7837fd7 Pluralize registration message names
And do a version check before adding `--require-db-registration` flag.
2020-12-02 11:49:56 -08:00
Andrew Eisenberg 1b4a992182 Update changelog 2020-12-02 11:49:56 -08:00
Andrew Eisenberg 3c08baf062 Add query running test for computeDefaultStrings flag 2020-12-01 14:31:39 -08:00
Andrew Eisenberg 6afb946200 Update changelog 2020-12-01 14:31:39 -08:00
Max Schaefer f4624f3dbf
Fix dubious index check (#692)
* Fix dubious index check

* Add unit tests for add/remove database

In order to do this, needed to move `databases.test.ts` to the
`minimal-workspace` test folder because these tests require that there
be some kind of workspace open in order to check on workspace folders.

Unfortunately, during tests vscode does not allow you to convert from a
single root workspace to multi-root and so several of the workspace
functions needed to be stubbed out.

* Update changelog

Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2020-11-30 11:34:47 -08:00
aeisenberg 1b4d8e303d Bump version to v1.3.8 2020-11-24 14:11:16 -08:00
Andrew Eisenberg b7b5a6ec30 v1.3.7 2020-11-24 14:02:25 -08:00
Andrew Eisenberg 579df25be4 Use the ast edge label when building the ast node label
The C PrintAST library now includes the edge name in the AST Viewer
tree.
2020-11-23 15:27:24 -08:00
Andrew Eisenberg 1886c0c9ec Add a setting to control page size
Also, set a max and min value on the input control of the page. This
prevents going to a negative page, or a page after the last one.
2020-11-21 09:45:52 -08:00
Andrew Eisenberg f48176bebf Re-sort databases list after db rename 2020-11-20 15:12:47 -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 966cc5af92 Add more structured output for tests
The diff and the errors were always available, but they were not being
sent to the output.

Additionally, make sure to send output to both the test explorer log and
the codeql test log.
2020-11-09 14:31:02 -08:00
Andrew Eisenberg f4998d90e7 Creates an empty `.expected` file when running test output compare
If the expected file does not already exists. This helps with test
creation and allows users to create tests more quickly.
2020-11-09 14:27:20 -08:00
Andrew Eisenberg afd0694111 Update changelog 2020-11-09 11:53:42 -08:00
Andrew Eisenberg 32db9cdec6 Open editor containing query location in non-preview mode 2020-11-05 10:32:58 -08:00
github-actions[bot] ad3cd7e7ac
Bump version to v1.3.7 (#672)
Co-authored-by: aeisenberg <aeisenberg@users.noreply.github.com>
2020-11-04 14:09:37 -08:00
Andrew Eisenberg ce3b4ed43d
v1.3.6 (#671) 2020-11-04 12:06:05 -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
aeisenberg 2ac7881cf2 Bump version to v1.3.6 2020-10-27 12:56:22 -07:00
Andrew Eisenberg 5e8773b2b0 Prepare for release v1.3.5 2020-10-27 12:37:06 -07:00
github-actions[bot] ea9f8d494c Bump version to v1.3.5 2020-10-22 10:55:20 -07:00
Andrew Eisenberg 7cfaeddbc0 Prepare for release v1.3.4 2020-10-22 10:45:18 -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 9547aa3851 Remove feature flag for the AST Viewer 2020-10-21 14:07:05 -07:00
Andrew Eisenberg 9300c07d42 Add command to view the DIL of a query 2020-10-13 11:07:43 -07:00
Andrew Eisenberg 8e817ee01a Refactor the commandRunner
Split commandRunner into two functions: commandRunner and
commandRunnerWithProgress.

Also, take advantage of default arguments for ProgressOptions.

And updates changelog.
2020-10-09 10:48:44 -07:00
Andrew Eisenberg e5d439ae89 Update changelog
Co-authored-by: Shati Patel <42641846+shati-patel@users.noreply.github.com>
2020-10-09 10:48:44 -07:00
Andrew Eisenberg 2c75a5c8cb Ensure database upgrade request happens only once
When a user runs multiple queries on a non-upgraded database, ensure
that only one dialog appears for upgrade.

This commit also migrates the upgrades.ts file to using the passed-in
cancellation token and progress monitor. This ensures that cancelling
a database upgrade command will also cancel out of any wrapper
operations.

Fixes #534
2020-10-09 10:48:44 -07:00
Andrew Eisenberg 43d5ee78ea Add comments to interfaces.ts and databases-ui.ts
Also, small refactoring of the vscodeMessageHandler.
2020-10-08 12:32:27 -07:00
Andrew Eisenberg 54fee0bed8 Add unit tests for event emitting in database manager 2020-10-08 12:32:27 -07:00
Andrew Eisenberg 6bc720468c Update changelog 2020-10-08 12:32:27 -07:00
Andrew Eisenberg 7e5d5922db Update changelog 2020-10-06 08:42:29 -07:00
Andrew Eisenberg 4adbfa4e81 Update changelog 2020-10-06 08:42:29 -07:00
Andrew Eisenberg 7800c68065 Allow setting number of threads to 0
Fixes #603
2020-10-05 07:54:42 -07:00