Skip to content
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

New setting to specify number of paths per alert #931

Merged
merged 2 commits into from
Aug 25, 2021
Merged

Conversation

shati-patel
Copy link
Contributor

@shati-patel shati-patel commented Aug 23, 2021

Will fix #919 .

Added a new setting codeQL.runningQueries.maxPaths that lets you configure how many paths to display 🙂 I tested this with a few databases/queries (e.g. this one)

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • Issues have been created for any UI or other user-facing changes made by this pull request.
  • @github/docs-content-codeql has been cc'd in all issues for UI or other user-facing changes made by this pull request. No docs updates needed.

@shati-patel shati-patel marked this pull request as ready for review August 23, 2021 18:29
@shati-patel shati-patel requested a review from a team as a code owner August 23, 2021 18:29
Copy link
Contributor

@aeisenberg aeisenberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

Copy link
Contributor

@adityasharad adityasharad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! A few suggestions but overall structure looks good :)

extensions/ql-vscode/package.json Show resolved Hide resolved
extensions/ql-vscode/src/cli.ts Show resolved Hide resolved

export interface CliConfig {
additionalTestArguments: string[];
numberTestThreads: number;
numberThreads: number;
maxPaths: number;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can unit test this - take a look at https://github.com/github/vscode-codeql/blob/main/extensions/ql-vscode/src/vscode-tests/minimal-workspace/config.test.ts and add it to the list of values. (I think it will go under the CLIConfigListener rather than the QueryServerConfigListener.)

Copy link
Contributor Author

@shati-patel shati-patel Aug 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added it to that test file here. Silly question, but what should values be? I couldn't work out if there's a logic to it 🙃 Is it just any valid values?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a silly question, I wondered the same while looking at it. I think the intent is to test a range of values that we expect to be handled: for this kind of test it's a good idea to check the minimum, the maximum, some common value in the middle, and a zero/empty value. If the test is capable of handling errors, then also test some value that shouldn't be allowed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the test only lets me test 2 values?

name: string;
property: string;
values: [T, T];

I can't quite work out if the test is doing anything with the values themselves, or just listening for when they change 😕

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh you are right. The test is just making sure the listeners handle a change. So [0, 1] sounds fine.
We can look separately at creating an integration test that produces multiple paths - right now we have none so there's nothing to update.

@shati-patel
Copy link
Contributor Author

Thanks for the review and the helpful pointers! 🎉 I've addressed comments in the latest commit (and added some more questions)

@shati-patel shati-patel enabled auto-merge (rebase) August 25, 2021 08:20
@shati-patel shati-patel merged commit f856e3a into main Aug 25, 2021
@shati-patel shati-patel deleted the paths-per-alert branch August 25, 2021 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Customize number of paths per alert
3 participants