Skip to content

Commit 070b051

Browse files
committed
Bump verbosity of database finalize in debug mode
1 parent 649f3e8 commit 070b051

File tree

9 files changed

+39
-15
lines changed

9 files changed

+39
-15
lines changed

lib/analyze.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/analyze.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.js

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.test.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.test.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/analyze.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ async function finalizeDatabaseCreation(
263263
util.getCodeQLDatabasePath(config, language),
264264
threadsFlag,
265265
memoryFlag,
266+
config.debugMode,
266267
);
267268
logger.endGroup();
268269
}

src/codeql.test.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@ test("database finalize recognises JavaScript no code found error on CodeQL 2.11
873873
sinon.stub(safeWhich, "safeWhich").resolves("");
874874

875875
await t.throwsAsync(
876-
async () => await codeqlObject.finalizeDatabase("", "", ""),
876+
async () => await codeqlObject.finalizeDatabase("", "", "", false),
877877
{
878878
instanceOf: util.ConfigurationError,
879879
message: new RegExp(
@@ -892,7 +892,7 @@ test("database finalize overrides no code found error on CodeQL 2.11.6", async (
892892
sinon.stub(safeWhich, "safeWhich").resolves("");
893893

894894
await t.throwsAsync(
895-
async () => await codeqlObject.finalizeDatabase("", "", ""),
895+
async () => await codeqlObject.finalizeDatabase("", "", "", false),
896896
{
897897
instanceOf: util.ConfigurationError,
898898
message: new RegExp(
@@ -915,7 +915,12 @@ test("database finalize does not override no code found error on CodeQL 2.12.4",
915915

916916
await t.throwsAsync(
917917
async () =>
918-
await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"),
918+
await codeqlObject.finalizeDatabase(
919+
"db",
920+
"--threads=2",
921+
"--ram=2048",
922+
false,
923+
),
919924
{
920925
message:
921926
'Encountered a fatal error while running "codeql-for-testing database finalize --finalize-dataset --threads=2 --ram=2048 db". ' +
@@ -940,7 +945,12 @@ test("runTool summarizes several fatal errors", async (t) => {
940945

941946
await t.throwsAsync(
942947
async () =>
943-
await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"),
948+
await codeqlObject.finalizeDatabase(
949+
"db",
950+
"--threads=2",
951+
"--ram=2048",
952+
false,
953+
),
944954
{
945955
instanceOf: util.ConfigurationError,
946956
message: new RegExp(
@@ -967,7 +977,12 @@ test("runTool outputs last line of stderr if fatal error could not be found", as
967977

968978
await t.throwsAsync(
969979
async () =>
970-
await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"),
980+
await codeqlObject.finalizeDatabase(
981+
"db",
982+
"--threads=2",
983+
"--ram=2048",
984+
false,
985+
),
971986
{
972987
instanceOf: util.ConfigurationError,
973988
message: new RegExp(

src/codeql.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export interface CodeQL {
100100
databasePath: string,
101101
threadsFlag: string,
102102
memoryFlag: string,
103+
enableDebugLogging: boolean,
103104
): Promise<void>;
104105
/**
105106
* Run 'codeql resolve languages'.
@@ -715,13 +716,17 @@ export async function getCodeQLForCmd(
715716
databasePath: string,
716717
threadsFlag: string,
717718
memoryFlag: string,
719+
enableDebugLogging: boolean,
718720
) {
719721
const args = [
720722
"database",
721723
"finalize",
722724
"--finalize-dataset",
723725
threadsFlag,
724726
memoryFlag,
727+
...(enableDebugLogging
728+
? [`--verbosity=${EXTRACTION_DEBUG_MODE_VERBOSITY}`]
729+
: []),
725730
...getExtraOptionsFromEnv(["database", "finalize"]),
726731
databasePath,
727732
];

0 commit comments

Comments
 (0)