-
Notifications
You must be signed in to change notification settings - Fork 189
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
Add some commonly used QL snippets #782
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,134 @@ | ||||||
{ | ||||||
"Query Metadata": { | ||||||
"prefix": "querymetadata", | ||||||
"body": [ | ||||||
"/**", | ||||||
" * @name $1", | ||||||
" * @description $2", | ||||||
" * @kind $3", | ||||||
" * @id $4", | ||||||
" * @tags $5", | ||||||
" */" | ||||||
], | ||||||
"description": "Metadata for a query" | ||||||
}, | ||||||
"Class": { | ||||||
"prefix": "class", | ||||||
"body": ["class $1 extends $2 {", "\t$0", "}"], | ||||||
"description": "A class" | ||||||
}, | ||||||
"From/Where/Select": { | ||||||
"prefix": "from", | ||||||
"body": ["from $1", "where $2", "select $3"], | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I find it easier to read if there are default values for each replacement step.
Suggested change
|
||||||
"description": "A from/where/select statement" | ||||||
}, | ||||||
"Predicate": { | ||||||
"prefix": "predicate", | ||||||
"body": ["predicate $1($2) {", "\t$0", "}"], | ||||||
"description": "A predicate" | ||||||
}, | ||||||
"Dataflow Tracking Class": { | ||||||
"prefix": "dataflowtracking", | ||||||
"body": [ | ||||||
"class $1 extends DataFlow::Configuration {", | ||||||
"\t$1() { this = \"$1\" }", | ||||||
"\t", | ||||||
"\toverride predicate isSource(DataFlow::Node node) {", | ||||||
"\t\t${2:none()}", | ||||||
"\t}", | ||||||
"\t", | ||||||
"\toverride predicate isSink(DataFlow::Node node) {", | ||||||
"\t\t${3:none()}", | ||||||
"\t}", | ||||||
"}" | ||||||
], | ||||||
"description": "Boilerplate for a dataflow tracking class" | ||||||
}, | ||||||
"Taint Tracking Class": { | ||||||
"prefix": "tainttracking", | ||||||
"body": [ | ||||||
"class $1 extends TaintTracking::Configuration {", | ||||||
"\t$1() { this = \"$1\" }", | ||||||
"\t", | ||||||
"\toverride predicate isSource(DataFlow::Node node) {", | ||||||
"\t\t${2:none()}", | ||||||
"\t}", | ||||||
"\t", | ||||||
"\toverride predicate isSink(DataFlow::Node node) {", | ||||||
"\t\t${3:none()}", | ||||||
"\t}", | ||||||
"}" | ||||||
], | ||||||
"description": "Boilerplate for a taint tracking class" | ||||||
}, | ||||||
"Count": { | ||||||
"prefix": "count", | ||||||
"body": ["count($1 | $2 | $3)"], | ||||||
"description": "A count aggregate" | ||||||
}, | ||||||
"Max": { | ||||||
"prefix": "max", | ||||||
"body": ["max($1 | $2 | $3)"], | ||||||
"description": "A max aggregate" | ||||||
}, | ||||||
"Min": { | ||||||
"prefix": "min", | ||||||
"body": ["min($1 | $2 | $3)"], | ||||||
"description": "A min aggregate" | ||||||
}, | ||||||
"Average": { | ||||||
"prefix": "avg", | ||||||
"body": ["avg($1 | $2 | $3)"], | ||||||
"description": "An average aggregate" | ||||||
}, | ||||||
"Sum": { | ||||||
"prefix": "sum", | ||||||
"body": ["sum($1 | $2 | $3)"], | ||||||
"description": "A sum aggregate" | ||||||
}, | ||||||
"Concatenation": { | ||||||
"prefix": "concat", | ||||||
"body": ["concat($1 | $2 | $3)"], | ||||||
"description": "A concatenation aggregate" | ||||||
}, | ||||||
"Rank": { | ||||||
"prefix": "rank", | ||||||
"body": ["rank[$1]($2 | $3 | $4)"], | ||||||
"description": "A rank aggregate" | ||||||
}, | ||||||
"Strict Sum": { | ||||||
"prefix": "strictsum", | ||||||
"body": ["strictsum($1 | $2 | $3)"], | ||||||
"description": "A strict sum aggregate" | ||||||
}, | ||||||
"Strict Concatenation": { | ||||||
"prefix": "strictconcat", | ||||||
"body": ["strictconcat($1 | $2 | $3)"], | ||||||
"description": "A strict concatenation aggregate" | ||||||
}, | ||||||
"Strict Count": { | ||||||
"prefix": "strictcount", | ||||||
"body": ["strictcount($1 | $2 | $3)"], | ||||||
"description": "A strict count aggregate" | ||||||
}, | ||||||
"Unique": { | ||||||
"prefix": "unique", | ||||||
"body": ["unique($1 | $2 | $3)"], | ||||||
"description": "A unique aggregate" | ||||||
}, | ||||||
"Exists": { | ||||||
"prefix": "exists", | ||||||
"body": ["exists($1 | $2 | $3)"], | ||||||
"description": "An exists quantifier" | ||||||
}, | ||||||
"For All": { | ||||||
"prefix": "forall", | ||||||
"body": ["forall($1 | $2 | $3)"], | ||||||
"description": "A for all quantifier" | ||||||
}, | ||||||
"For All and Exists": { | ||||||
"prefix": "forex", | ||||||
"body": ["forex($1 | $2 | $3)"], | ||||||
"description": "A for all and exists quantifier" | ||||||
} | ||||||
} |
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.
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.
Either add a choice here, or separate this into multiple snippets, one for each metadata kind.
https://code.visualstudio.com/docs/editor/userdefinedsnippets#_choice