-
Notifications
You must be signed in to change notification settings - Fork 217
Adapt skeleton pack generation to work with new queries panel #2250
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
Conversation
0ee62f8 to
29fc648
Compare
29fc648 to
09b50eb
Compare
09b50eb to
926688e
Compare
e1cb0b9 to
c00240a
Compare
|
CI has been failing remotely, but not locally. I hope I've cleaned up the remote failures as well. 🤞 |
2f70963 to
0ec1c6c
Compare
extensions/ql-vscode/test/vscode-tests/cli-integration/skeleton-query-wizard.test.ts
Fixed
Show fixed
Hide fixed
extensions/ql-vscode/test/vscode-tests/cli-integration/skeleton-query-wizard.test.ts
Fixed
Show fixed
Hide fixed
extensions/ql-vscode/test/vscode-tests/cli-integration/skeleton-query-wizard.test.ts
Fixed
Show fixed
Hide fixed
extensions/ql-vscode/test/vscode-tests/cli-integration/skeleton-query-wizard.test.ts
Fixed
Show fixed
Hide fixed
ebf9c5b to
0545eb5
Compare
We initially defined the default database to download as one from the `github/codeql` repo as it was convenient. However, this repo doesn't have a lot of vulnerabilities to discover. Let's use repos that are in our MRVA top 10 list to allow users to write more interesting queries.
Instead of assigning this property in a method, let's make the method return a value and assign it more visibly.
Replaces `file[0]` with a more meaningful `filename`.
Let's only ask for the language when the language is not provided OR it's invalid. Let's also add tests for these cases.
And add tests for getFirstStoragePath method
We've now added more tests and pushed the total duration over 5 seconds for all the tests in this file. This limitation seems to be a recent development where files with tests that last longer than 5 seconds start failing in jest. We're bumping the timeout limit to 40 seconds for now.
When we try to determine the next file name for our example query, we only look at `example<n>.ql` files. e.g. if the files in the folder are: - `example.ql` - `example2.ql` - `MyQuery.ql` we will create an `example3.ql` file. Previously we were counting all existing `.ql` files.
e198a79 to
460da1e
Compare
|
Thanks for the reviews @koesie10 & @shati-patel! I'm going to pair with @shati-patel tomorrow to look at the windows issues she's discovered. I plan to address those in a subsequent PR as this is getting quite heavy on replies + reviews. In the meantime, this PR is ready for review again. |
shati-patel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! 🎉 I'm also keen to get this merged, since I'm struggling to review/keep track of the parallel PRs and changes 🙈
I've left a bunch of comments/questions, but they are all non-blocking 💚 The main important thing for me is to (temporarily) hide the command, so that we can do more testing/debugging without disrupting users.
| await this.selectExistingDatabase(); | ||
| } else { | ||
| // generate a new skeleton QL pack with query file | ||
| await this.createQlPack(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Discussed offline: Turns out this isn't a Windows thing)
Let's fix this is in a follow-up issue/PR, since we might want to discuss the options with product/design.
- Do we want to just add the
custom-queriesfolder to whichever place happens to be the first workspace folder, or should it be a top-level workspace folder? - If the latter, where do we actually create the folder on-disk? (In the extension's workspace storage?)
|
Thanks for the reviews @koesie10 & @shati-patel 🙇♀️ I'm gonna merge this and follow up with you on the remaining issues tomorrow. |
Please review this PR commit-by-commit.
In a previous PR, we implemented a feature where if you add a new database, we generate a skeleton QL pack for you to work with the database. The skeleton pack would contain an example query file and would match the language of the database.
We've found it's hard for the user to discover this workflow in the
codespaces-codeqlrepo.After some input from design, we want to reverse this flow by starting with generating the query file and skeleton pack first, and then downloading the database. This means the user immediately focuses on the query file instead of having to switch away from the extension and look for the query file in the explorer view. (see videos below for a visual illustration of what this all means)
This new flow should trigger via a command in the extension ("Create Query") which takes you through a wizard and generates everything.
When the new queries panel is ready, we can also hook up this command with the link suggesting how to create a query ("Create one to start"):
Finally, we're making sure that both the
codespaces-codeqlandvscode-codeql-starterrepos work as expected with this new command:codespaces-codeql repo
Screen.Recording.2023-03-30.at.14.25.05.mov
vscode-codeql-starter repo
Screen.Recording.2023-03-30.at.14.26.50.mov