-
Notifications
You must be signed in to change notification settings - Fork 226
Integrate codeql database unbundle #971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
1980f86
b5cdd83
b22a869
7d8e63c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -451,27 +451,46 @@ export class DatabaseUI extends DisposableObject { | |||||||||||||||||||||||||||||||||||||||||||||||||
| handleChooseDatabaseInternet = async ( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| progress: ProgressCallback, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| token: CancellationToken | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ): Promise< | ||||||||||||||||||||||||||||||||||||||||||||||||||
| DatabaseItem | undefined | ||||||||||||||||||||||||||||||||||||||||||||||||||
| > => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return await promptImportInternetDatabase( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| this.databaseManager, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| this.storagePath, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| progress, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| token | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ): Promise<DatabaseItem | undefined> => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if (this.queryServer && await this.queryServer.cliServer.cliConstraints.supportsDatabaseUnbundle()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return await promptImportInternetDatabase( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| this.databaseManager, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| this.storagePath, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| progress, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| token, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| this.queryServer.cliServer | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return await promptImportInternetDatabase( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| this.databaseManager, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| this.storagePath, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| progress, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| token | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This check is redundant. It is already taking place in
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Making this change gives me an error, specifically that queryServer could be undefined. Doing it this way gives no error: |
||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| handleChooseDatabaseLgtm = async ( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| progress: ProgressCallback, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| token: CancellationToken | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ): Promise<DatabaseItem | undefined> => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return await promptImportLgtmDatabase( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| this.databaseManager, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| this.storagePath, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| progress, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| token | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| if (this.queryServer && await this.queryServer.cliServer.cliConstraints.supportsDatabaseUnbundle()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return await promptImportLgtmDatabase( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| this.databaseManager, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| this.storagePath, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| progress, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| token, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| this.queryServer.cliServer | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return await promptImportLgtmDatabase( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| this.databaseManager, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| this.storagePath, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| progress, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| token | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When I remove the else block completely, I get a warning that not all code paths return a value. Is that what you'd like me to do? Or should it look like this:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops...should be the same as above. You don't need the if statement at all. This works because you are testing for the cliServer later when you actually try to call unbundle. |
||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| async tryUpgradeCurrentDatabase( | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -572,6 +591,10 @@ export class DatabaseUI extends DisposableObject { | |||||||||||||||||||||||||||||||||||||||||||||||||
| token: CancellationToken, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| uri: Uri, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ): Promise<void> => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!this.queryServer) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| throw new Error('Query server not started'); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See comment below, this is no longer needed |
||||||||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // Assume user has selected an archive if the file has a .zip extension | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if (uri.path.endsWith('.zip')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -580,7 +603,8 @@ export class DatabaseUI extends DisposableObject { | |||||||||||||||||||||||||||||||||||||||||||||||||
| this.databaseManager, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| this.storagePath, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| progress, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| token | ||||||||||||||||||||||||||||||||||||||||||||||||||
| token, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| this.queryServer.cliServer | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| await this.setCurrentDatabase(progress, token, uri); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -695,8 +719,11 @@ export class DatabaseUI extends DisposableObject { | |||||||||||||||||||||||||||||||||||||||||||||||||
| progress: ProgressCallback, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| token: CancellationToken, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ): Promise<DatabaseItem | undefined> { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const uri = await chooseDatabaseDir(byFolder); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!this.queryServer) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| throw new Error('Query server not started'); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now, this check is no longer needed. You can just fall back to the old behaviour if hte query server doesn't exist.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| const uri = await chooseDatabaseDir(byFolder); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!uri) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return undefined; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -713,7 +740,8 @@ export class DatabaseUI extends DisposableObject { | |||||||||||||||||||||||||||||||||||||||||||||||||
| this.databaseManager, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| this.storagePath, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| progress, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| token | ||||||||||||||||||||||||||||||||||||||||||||||||||
| token, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| this.queryServer.cliServer | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.