File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed
Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -227,9 +227,9 @@ export interface DatabaseItem {
227227 resolveSourceFile ( file : string | undefined ) : vscode . Uri ;
228228
229229 /**
230- * Holds if the database item has a `.dbinfo` file.
230+ * Holds if the database item has a `.dbinfo` or `codeql-database.yml` file.
231231 */
232- hasDbInfo ( ) : boolean ;
232+ hasMetadataFile ( ) : Promise < boolean > ;
233233
234234 /**
235235 * Returns `sourceLocationPrefix` of exported database.
@@ -359,9 +359,11 @@ class DatabaseItemImpl implements DatabaseItem {
359359 /**
360360 * Holds if the database item refers to an exported snapshot
361361 */
362- public hasDbInfo ( ) : boolean {
363- return fs . existsSync ( path . join ( this . databaseUri . fsPath , '.dbinfo' ) )
364- || fs . existsSync ( path . join ( this . databaseUri . fsPath , 'codeql-database.yml' ) ) ; ;
362+ public async hasMetadataFile ( ) : Promise < boolean > {
363+ return ( await Promise . all ( [
364+ fs . pathExists ( path . join ( this . databaseUri . fsPath , '.dbinfo' ) ) ,
365+ fs . pathExists ( path . join ( this . databaseUri . fsPath , 'codeql-database.yml' ) )
366+ ] ) ) . some ( x => x ) ;
365367 }
366368
367369 /**
Original file line number Diff line number Diff line change @@ -150,8 +150,12 @@ export class QueryInfo {
150150 /**
151151 * Holds if this query should produce interpreted results.
152152 */
153- hasInterpretedResults ( ) : boolean {
154- return this . dbItem . hasDbInfo ( ) ;
153+ async hasInterpretedResults ( ) : Promise < boolean > {
154+ const hasMetadataFile = await this . dbItem . hasMetadataFile ( ) ;
155+ if ( ! hasMetadataFile ) {
156+ logger . log ( "Cannot produce interpreted results since the database does not have a .dbinfo or codeql-database.yml file." ) ;
157+ }
158+ return hasMetadataFile ;
155159 }
156160
157161 async updateSortState ( server : cli . CodeQLCliServer , resultSetName : string , sortState : SortState | undefined ) : Promise < void > {
You can’t perform that action at this time.
0 commit comments