Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions extensions/ql-vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## [UNRELEASED]

- Avoid showing an error popup when user runs a query with `@kind table` metadata. [#814](https://github.com/github/vscode-codeql/pull/814)

## 1.4.5 - 22 March 2021

- Avoid showing an error popup when user runs a query without `@kind` metadata. [#801](https://github.com/github/vscode-codeql/pull/801)
Expand Down
5 changes: 4 additions & 1 deletion extensions/ql-vscode/src/run-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ export class QueryInfo {
if (!hasKind) {
logger.log('Cannot produce interpreted results since the query does not have @kind metadata.');
}
return hasMetadataFile && hasKind;

const isTable = hasKind && this.metadata?.kind === 'table';

return hasMetadataFile && hasKind && !isTable;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,23 @@ describe('run-queries', () => {
expect(info.dataset).to.eq('file:///abc');
});

it('should check if interpreted results can be created', async () => {
const info = createMockQueryInfo();
(info.dbItem.hasMetadataFile as sinon.SinonStub).returns(true);

expect(await info.canHaveInterpretedResults()).to.eq(true);

(info.dbItem.hasMetadataFile as sinon.SinonStub).returns(false);
expect(await info.canHaveInterpretedResults()).to.eq(false);

(info.dbItem.hasMetadataFile as sinon.SinonStub).returns(true);
info.metadata!.kind = undefined;
expect(await info.canHaveInterpretedResults()).to.eq(false);

info.metadata!.kind = 'table';
expect(await info.canHaveInterpretedResults()).to.eq(false);
});

describe('compile', () => {
it('should compile', async () => {
const info = createMockQueryInfo();
Expand Down Expand Up @@ -73,9 +90,14 @@ describe('run-queries', () => {
{
contents: {
datasetUri: 'file:///abc'
}
},
hasMetadataFile: sinon.stub()
} as unknown as DatabaseItem,
'my-scheme' // queryDbscheme
'my-scheme', // queryDbscheme,
undefined,
{
kind: 'problem'
}
);
}

Expand Down