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

Move language and pack to top level of variant analysis object #3287

Merged
merged 3 commits into from
Jan 30, 2024

Conversation

robertbrignull
Copy link
Contributor

A slimmed down version of #3285 that doesn't modify the query object. The idea being to split up that change and make it easier if we do want to do it or something similar to it in the future.

My reasoning on pack and language is that they're really properties of the variant analysis rather than properties of the query. This becomes more true when you consider multiple queries, but I think it's still true now.

I'm deliberately not modifying the query history format in this PR. We could do, but since it's a lossless transformation in both directions we can just leave it. Or we could save the query history update for when we add in multiple query support and batch those changes together.

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.
  • [Maintainers only] If this pull request makes user-facing changes that require documentation changes, open a corresponding docs pull request in the github/codeql repo and add the ready-for-doc-review label there.

Copy link
Contributor

@charisk charisk left a comment

Choose a reason for hiding this comment

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

Makes sense to pull them up a bit! Thanks.

@@ -42,7 +42,7 @@ interface VariantAnalysisMarkdown {
* Generates markdown files with variant analysis results.
*/
export async function generateVariantAnalysisMarkdown(
variantAnalysis: Pick<VariantAnalysis, "query">,
variantAnalysis: Pick<VariantAnalysis, "language" | "query">,
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 problem necessarily introduced in this PR, but I would prefer to not use Pick if we're going to be getting more than 1 item, as it gradually becomes silly (e.g. https://github.com/github/vscode-codeql/pull/3287/files#diff-ba6fe1916e2a1bce3900880797ea49539e39f9f76c431c2742a4ca5926643b26R50)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For this PR I'll just keep it simple and add the extra field. I don't feel this PR crosses any new silliness-thresholds that weren't already crossed.

I'm not really sure why we're using Pick here (or the place you linked). I'm not sure what benefit it gives us in terms of ease of writing or maintainability, over taking the whole object. Perhaps it makes craft data in the tests easier, but we have createMockX methods for that generally.

@robertbrignull
Copy link
Contributor Author

I dug into the CI failure and uncovered a existing bug in the tests that we just didn't notice until now. I've opened #3290 to separate the test fix from this change.

@robertbrignull
Copy link
Contributor Author

I found another case of us mixing internal and DTO types in the tests. I've opened #3293 for this one.

@robertbrignull
Copy link
Contributor Author

At last the tests are green! 🎉

@robertbrignull robertbrignull merged commit 0391f97 into main Jan 30, 2024
15 checks passed
@robertbrignull robertbrignull deleted the robertbrignull/move_language_pack branch January 30, 2024 15:22
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.

2 participants