This change allows remote queries to run a query from a directory that
is not in the root of the qlpack.
The change is the following:
1. walk up the directory hierarchy to check for a non-local qlpack.yml
2. Copy over the files as before, but keep track of the relative
location of the query compared to the location of the qlpack.yml.
3. Change the defaultSuite of the qlpack.yml so that _only_ this query
is run as part of the default query.
Also, this adds a new integration test to ensure the nested query is
packaged appropriately.
* Add leniency in how positions are handled
Previously, positions with end column of 0 were rejected by the
extension. CodeQL positions are supposed to be 1-based, but the CLI
does handle 0-based and negative positions by using character offsets
from the current line start.
Instead of rejecting these kinds of positions, the extension should
handle them as gracefully as possible.
Fixes#999
* Update package lock
* Add leniency in how positions are handled
Previously, positions with end column of 0 were rejected by the
extension. CodeQL positions are supposed to be 1-based, but the CLI
does handle 0-based and negative positions by using character offsets
from the current line start.
Instead of rejecting these kinds of positions, the extension should
handle them as gracefully as possible.
Fixes#999
* Add changelog entry
When the extension loads a sorted result set, it takes a shortcut and
avoids loads a file with only the bqrs results for that sorted table.
However, it does not load the results for any other table. This causes
result set names to go away. This change ensures that if we are loading
a sorted table, we also load the result set names for all other tables
in that query.
Fixes#1005.
Now that the queries endpoint returns the id we can link straight
there. We'll make more changes to the progress tracking, but I think
it's worth making this minimal change now.
This is still a bit rough, but handles two cases:
1. There is a qlpack.yml or codeql-pack.yml file in the same directory
as the query to run remotely. In this case, run `codeql pack
packlist` to determine what files to include (and also always include
the lock file and the query itself. Copy to a temp folder and run
`pack install`, then `pack bundle`. Finally upload.
2. There is no qlpack in the current directory. Just copy the single
file to the temp folder and generate a synthetic qlpack before
installing, bundling and uploading.
Two cases that are not handled:
1. The query file is part of a workspace. Peer dependencies will not be
found.
2. The query file and its qlpack file are not in the same directory.
These should be possible to handle later. Also, need to create some
unit and integration tests for this.