IaC Comment Class - #388
Open
Chanel (chanel-y) wants to merge 3 commits into
Open
Conversation
…nt and creating unifying Comment class
The generated AST printer now references the Tree-sitter Comment node, and the expected locations were normalized to LF line endings to match the generated output. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Mathias Vorreiter Pedersen (MathiasVP)
left a comment
Collaborator
There was a problem hiding this comment.
A couple of simplifcations, but otherwise this LGTM!
Comment on lines
+25
to
+29
| exists(YamlDocument document | | ||
| document.getFile() = file and | ||
| document instanceof YamlMapping and | ||
| document | ||
| .(YamlMapping) |
Collaborator
There was a problem hiding this comment.
Short(er) and sweet(er)!
Suggested change
| exists(YamlDocument document | | |
| document.getFile() = file and | |
| document instanceof YamlMapping and | |
| document | |
| .(YamlMapping) | |
| exists(YamlMapping document | | |
| document.getFile() = file and | |
| document |
| */ | ||
| class Comment extends Location { | ||
| Comment() { | ||
| exists(string text, string delimiterStyle | getIacCommentText(this, text, delimiterStyle)) |
Collaborator
There was a problem hiding this comment.
I really wish LLMs would start using _ in QL 😅
Suggested change
| exists(string text, string delimiterStyle | getIacCommentText(this, text, delimiterStyle)) | |
| getIacCommentText(this, _, _) |
|
|
||
| /** Gets the comment text without its delimiter. */ | ||
| string getText() { | ||
| exists(string delimiterStyle | getIacCommentText(this, result, delimiterStyle)) |
Collaborator
There was a problem hiding this comment.
Suggested change
| exists(string delimiterStyle | getIacCommentText(this, result, delimiterStyle)) | |
| getIacCommentText(this, result, _) |
| } | ||
|
|
||
| /** Holds if this comment uses `#` as its delimiter. */ | ||
| predicate hasHashDelimiter() { exists(string text | getIacCommentText(this, text, "hash")) } |
Collaborator
There was a problem hiding this comment.
Suggested change
| predicate hasHashDelimiter() { exists(string text | getIacCommentText(this, text, "hash")) } | |
| predicate hasHashDelimiter() { getIacCommentText(this, _, "hash") } |
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.
No description provided.