Skip to content

Commit dc63f23

Browse files
committed
Fix review findings
1 parent 6a35c8c commit dc63f23

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

misc/scripts/library-coverage/generate-report.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@ def add_package_stats_to_row(row, sorted_cwes, collect):
134134
db = "empty-" + lang
135135
ql_output = output_ql_csv.format(language=lang)
136136
utils.create_empty_database(lang, config.ext, db)
137-
utils.upgrade_codeql_database(db, query_prefix)
138-
utils.run_codeql_query(config.ql_path, db, ql_output)
137+
utils.run_codeql_query(config.ql_path, db, ql_output, query_prefix)
139138
shutil.rmtree(db)
140139

141140
packages = pack.PackageCollection(ql_output)

misc/scripts/library-coverage/generate-timeseries.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ def get_packages(lang, query, search_path):
4848
if os.path.isdir(db):
4949
shutil.rmtree(db)
5050
utils.create_empty_database(lang, ".java", db)
51-
utils.upgrade_codeql_database(db, search_path)
52-
utils.run_codeql_query(query, db, ql_output)
51+
utils.run_codeql_query(query, db, ql_output, search_path)
5352

5453
return pack.PackageCollection(ql_output)
5554
except:

misc/scripts/library-coverage/utils.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,11 @@ def create_empty_database(lang, extension, database):
2727
database, "--no-pre-finalize"])
2828

2929

30-
def upgrade_codeql_database(database, search_path):
31-
subprocess_run(["codeql", "database", "upgrade", database,
32-
"--search-path", search_path])
33-
34-
35-
def run_codeql_query(query, database, output):
30+
def run_codeql_query(query, database, output, search_path):
3631
"""Runs a codeql query on the given database."""
37-
subprocess_run(["codeql", "query", "run", query,
38-
"--database", database, "--output", output + ".bqrs"])
32+
# --search-path is required when the CLI needs to upgrade the database scheme.
33+
subprocess_run(["codeql", "query", "run", query, "--database", database,
34+
"--output", output + ".bqrs", "--search-path", search_path])
3935
subprocess_run(["codeql", "bqrs", "decode", output + ".bqrs",
4036
"--format=csv", "--no-titles", "--output", output])
4137
os.remove(output + ".bqrs")

0 commit comments

Comments
 (0)