-
Notifications
You must be signed in to change notification settings - Fork 2
Update --language
support for new-query
subcommand
#28
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
Open
data-douser
wants to merge
2
commits into
main
Choose a base branch
from
language-support-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 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
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
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
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
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
1 change: 1 addition & 0 deletions
1
src/CodeQLToolkit.Features/Templates/Query/csharp/expected.liquid
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// not implemented |
30 changes: 30 additions & 0 deletions
30
src/CodeQLToolkit.Features/Templates/Query/csharp/new-dataflow-query.liquid
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* @id {{language}}/{{query_pack_name}}/{{query_name}} | ||
* @name {{query_name}} | ||
* @description {{description}} | ||
* @kind path-problem | ||
* @precision high | ||
* @problem.severity error | ||
* @tags {{query_pack_name}} | ||
*/ | ||
|
||
import {{ql_language_import}} | ||
import DataFlow::PathGraph | ||
|
||
class Config extends TaintTracking::Configuration { | ||
Config() { this = "MyConfig" } | ||
|
||
override predicate isSource(DataFlow::Node source) { | ||
// Define your sources here | ||
none() | ||
} | ||
|
||
override predicate isSink(DataFlow::Node sink) { | ||
// Define your sinks here | ||
none() | ||
} | ||
} | ||
|
||
from Config config, DataFlow::PathNode source, DataFlow::PathNode sink | ||
where config.hasFlowPath(source, sink) | ||
select sink.getNode(), source, sink, "Replace this with your dataflow query." |
14 changes: 14 additions & 0 deletions
14
src/CodeQLToolkit.Features/Templates/Query/csharp/new-query.liquid
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* @id {{language}}/{{query_pack_name}}/{{query_name}} | ||
* @name {{query_name}} | ||
* @description {{description}} | ||
* @kind problem | ||
* @precision medium | ||
* @problem.severity error | ||
* @tags {{query_pack_name}} | ||
*/ | ||
|
||
import {{ql_language_import}} | ||
|
||
from Expr e | ||
select e, "Replace this with your query." |
7 changes: 7 additions & 0 deletions
7
src/CodeQLToolkit.Features/Templates/Query/csharp/qlpack-query.liquid
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
name: {{query_pack_scope}}/{{query_pack_name}} | ||
version: 0.0.0 | ||
description: Default description | ||
suites: | ||
license: | ||
dependencies: | ||
codeql/csharp-all: "^0.6.3" |
8 changes: 8 additions & 0 deletions
8
src/CodeQLToolkit.Features/Templates/Query/csharp/qlpack-test.liquid
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: {{query_pack_scope}}/{{query_pack_name}} | ||
version: 0.0.0 | ||
description: Default description | ||
suites: | ||
license: | ||
extractor: csharp | ||
dependencies: | ||
{{query_pack_dependency}}: '*' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// not implemented |
1 change: 1 addition & 0 deletions
1
src/CodeQLToolkit.Features/Templates/Query/csharp/testref.liquid
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{query_name}}.ql |
2 changes: 2 additions & 0 deletions
2
src/CodeQLToolkit.Features/Templates/Query/go/expected.liquid
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
edges | ||
| {{ query_name }}.go:0:0:0:0 | {{ query_name }} | |
30 changes: 30 additions & 0 deletions
30
src/CodeQLToolkit.Features/Templates/Query/go/new-dataflow-query.liquid
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* @id {{language}}/{{query_pack_name}}/{{query_name}} | ||
* @name {{query_name}} | ||
* @description {{description}} | ||
* @kind path-problem | ||
* @precision high | ||
* @problem.severity error | ||
* @tags {{query_pack_name}} | ||
*/ | ||
|
||
import {{ql_language_import}} | ||
import DataFlow::PathGraph | ||
|
||
class Config extends TaintTracking::Configuration { | ||
Config() { this = "MyConfig" } | ||
|
||
override predicate isSource(DataFlow::Node source) { | ||
// Define your sources here | ||
none() | ||
} | ||
|
||
override predicate isSink(DataFlow::Node sink) { | ||
// Define your sinks here | ||
none() | ||
} | ||
} | ||
|
||
from Config config, DataFlow::PathNode source, DataFlow::PathNode sink | ||
where config.hasFlowPath(source, sink) | ||
select sink.getNode(), source, sink, "Replace this with your dataflow query." |
14 changes: 14 additions & 0 deletions
14
src/CodeQLToolkit.Features/Templates/Query/go/new-query.liquid
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* @id {{language}}/{{query_pack_name}}/{{query_name}} | ||
* @name {{query_name}} | ||
* @description {{description}} | ||
* @kind problem | ||
* @precision medium | ||
* @problem.severity error | ||
* @tags {{query_pack_name}} | ||
*/ | ||
|
||
import {{ql_language_import}} | ||
|
||
from Expr e | ||
select e, "Replace this with your query." |
5 changes: 5 additions & 0 deletions
5
src/CodeQLToolkit.Features/Templates/Query/go/qlpack-query.liquid
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
name: {{query_pack_name}} | ||
version: 0.0.0 | ||
library: false | ||
dependencies: | ||
codeql/{{ql_language}}-all: "*" |
5 changes: 5 additions & 0 deletions
5
src/CodeQLToolkit.Features/Templates/Query/go/qlpack-test.liquid
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
name: {{query_pack_name}}-tests | ||
version: 0.0.0 | ||
dependencies: | ||
codeql/{{ql_language}}-all: "*" | ||
{{query_pack_name}}: "*" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import {{ql_language_import}} | ||
import TestUtilities.InlineExpectationsTest | ||
|
||
module {{query_name}}Test implements TestSig { | ||
string getARelevantTag() { result = "{{query_name}}" } | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Test case for {{query_name}} | ||
package main | ||
|
||
func main() { | ||
// ${{query_name}} | ||
} |
2 changes: 2 additions & 0 deletions
2
src/CodeQLToolkit.Features/Templates/Query/java/expected.liquid
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
edges | ||
| {{ query_name }}.java:0:0:0:0 | {{ query_name }} | |
30 changes: 30 additions & 0 deletions
30
src/CodeQLToolkit.Features/Templates/Query/java/new-dataflow-query.liquid
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* @id {{language}}/{{query_pack_name}}/{{query_name}} | ||
* @name {{query_name}} | ||
* @description {{description}} | ||
* @kind path-problem | ||
* @precision medium | ||
* @problem.severity error | ||
* @tags {{query_pack_name}} | ||
*/ | ||
|
||
import {{ql_language_import}} | ||
import DataFlow::PathGraph | ||
|
||
module Config implements DataFlow::ConfigSig { | ||
predicate isSource(DataFlow::Node node) { | ||
// Define your source here | ||
none() | ||
} | ||
|
||
predicate isSink(DataFlow::Node node) { | ||
// Define your sink here | ||
none() | ||
} | ||
} | ||
|
||
module Flow = TaintTracking::Global<Config>; | ||
|
||
from Flow::PathNode source, Flow::PathNode sink | ||
where Flow::flowPath(source, sink) | ||
select sink.getNode(), source, sink, "Replace this with your query." |
Oops, something went wrong.
Oops, something went wrong.
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.
The Go dataflow template uses an outdated API pattern. Line 22 is missing the
override
keyword for theisSink
predicate, and the template should use the newer module-based configuration pattern consistent with other language templates.Copilot uses AI. Check for mistakes.