CodeQL model editor: Make Type a selectable model kind for Ruby#3224
Merged
shati-patel merged 3 commits intomainfrom Jan 16, 2024
Merged
CodeQL model editor: Make Type a selectable model kind for Ruby#3224shati-patel merged 3 commits intomainfrom
Type a selectable model kind for Ruby#3224shati-patel merged 3 commits intomainfrom
Conversation
koesie10
reviewed
Jan 16, 2024
Member
koesie10
left a comment
There was a problem hiding this comment.
Any suggestions on if/how to test this? 🤔 Maybe a view test in MethodRow.spec.tsx or something?
I'd suggest creating a new test for the ModelTypeDropdown in src/view/model-editor/__tests__/ModelTypeDropdown.spec.tsx where we test that all options exist and that the "Type" option is only available for Ruby. Let me know if you'd like to pair on writing this test.
Comment on lines
+35
to
+49
| const options: Array<{ value: ModeledMethodType; label: string }> = [ | ||
| { value: "none", label: "Unmodeled" }, | ||
| { value: "source", label: "Source" }, | ||
| { value: "sink", label: "Sink" }, | ||
| { value: "summary", label: "Flow summary" }, | ||
| { value: "neutral", label: "Neutral" }, | ||
| ]; | ||
| if (language === QueryLanguage.Ruby) { | ||
| options.push({ value: "type", label: "Type" }); | ||
| } | ||
|
|
Member
There was a problem hiding this comment.
Can you make this a useMemo to avoid changing the identity of the array on every render? This should make it a little bit faster to render.
8c5976f to
ac64301
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently type models in Ruby are read-only, and you can't manually select/define one. This PR adds it as a selectable type. (Based on #3217, which turns the input/output dropdowns into free text fields. See internal linked issue for more details)
Any suggestions on if/how to test this? 🤔 Maybe a view test in MethodRow.spec.tsx or something?
Checklist
N/A
ready-for-doc-reviewlabel there.