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

Add CCR suite to query list #18708

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions misc/scripts/generate-code-scanning-query-list.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

# Define which languages and query packs to consider
languages = [ "actions", "cpp", "csharp", "go", "java", "javascript", "python", "ruby", "swift" ]
packs = [ "code-scanning", "security-and-quality", "security-extended", "security-experimental" ]
packs = [ "code-scanning", "security-and-quality", "security-extended", "security-experimental", "ccr"]

class CodeQL:
def __init__(self):
Expand Down Expand Up @@ -169,7 +169,7 @@ def subprocess_run(cmd):
for pack in packs:
# Get absolute paths to queries in this pack by using 'codeql resolve queries'
try:
queries_subp = codeql.command(["resolve","queries","--search-path", codeql_search_path, "%s-%s.qls" % (lang, pack)])
queries_subp = codeql.command(["resolve","queries","--search-path", codeql_search_path, "%s-%s.qls" % (lang, pack)]).strip()
except Exception as e:
# Resolving queries might go wrong if the github/codeql repository is not
# on the search path.
Expand All @@ -183,8 +183,13 @@ def subprocess_run(cmd):
else:
sys.exit("You can use '--ignore-missing-query-packs' to ignore this error")

# Exception for the CCR suites, which might be empty, but must be resolvable.
if pack == 'ccr' and queries_subp == '':
print(f'Warning: skipping empty suite ccr', file=sys.stderr)
continue

# Investigate metadata for every query by using 'codeql resolve metadata'
for queryfile in queries_subp.strip().split("\n"):
for queryfile in queries_subp.split("\n"):
query_metadata_json = codeql.command(["resolve","metadata",queryfile]).strip()

# Turn an absolute path to a query file into an nwo-prefixed path (e.g. github/codeql/java/ql/src/....)
Expand Down