From 1746aed95b2536caf3bf8773c0d54bccfe968bb6 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Mon, 1 Sep 2025 15:59:51 +0100 Subject: [PATCH] Override query configuration for Code Quality only analyses --- lib/analyze-action-post.js | 50 ++++++++++++------------- lib/analyze-action.js | 36 +++++++++--------- lib/autobuild-action.js | 36 +++++++++--------- lib/init-action-post.js | 50 ++++++++++++------------- lib/init-action.js | 62 ++++++++++++++++++++++--------- lib/resolve-environment-action.js | 36 +++++++++--------- lib/start-proxy-action-post.js | 50 ++++++++++++------------- lib/upload-lib.js | 36 +++++++++--------- lib/upload-sarif-action-post.js | 50 ++++++++++++------------- lib/upload-sarif-action.js | 36 +++++++++--------- src/config-utils.test.ts | 37 ++++++++++++------ src/config-utils.ts | 40 ++++++++++++++++++++ 12 files changed, 299 insertions(+), 220 deletions(-) diff --git a/lib/analyze-action-post.js b/lib/analyze-action-post.js index 78bf97c9f..041680c20 100644 --- a/lib/analyze-action-post.js +++ b/lib/analyze-action-post.js @@ -20288,7 +20288,7 @@ var require_dist_node2 = __commonJS({ return value; } } - function isDefined(value) { + function isDefined2(value) { return value !== void 0 && value !== null; } function isKeyOperator(operator) { @@ -20296,7 +20296,7 @@ var require_dist_node2 = __commonJS({ } function getValues(context2, operator, key, modifier) { var value = context2[key], result = []; - if (isDefined(value) && value !== "") { + if (isDefined2(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { @@ -20308,14 +20308,14 @@ var require_dist_node2 = __commonJS({ } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { result.push( encodeValue(operator, value2, isKeyOperator(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { result.push(encodeValue(operator, value[k], k)); } }); @@ -20323,12 +20323,12 @@ var require_dist_node2 = __commonJS({ } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { tmp.push(encodeValue(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { tmp.push(encodeUnreserved(k)); tmp.push(encodeValue(operator, value[k].toString())); } @@ -20343,7 +20343,7 @@ var require_dist_node2 = __commonJS({ } } else { if (operator === ";") { - if (isDefined(value)) { + if (isDefined2(value)) { result.push(encodeUnreserved(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { @@ -21028,7 +21028,7 @@ var require_dist_node6 = __commonJS({ return value; } } - function isDefined(value) { + function isDefined2(value) { return value !== void 0 && value !== null; } function isKeyOperator(operator) { @@ -21036,7 +21036,7 @@ var require_dist_node6 = __commonJS({ } function getValues(context2, operator, key, modifier) { var value = context2[key], result = []; - if (isDefined(value) && value !== "") { + if (isDefined2(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { @@ -21048,14 +21048,14 @@ var require_dist_node6 = __commonJS({ } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { result.push( encodeValue(operator, value2, isKeyOperator(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { result.push(encodeValue(operator, value[k], k)); } }); @@ -21063,12 +21063,12 @@ var require_dist_node6 = __commonJS({ } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { tmp.push(encodeValue(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { tmp.push(encodeUnreserved(k)); tmp.push(encodeValue(operator, value[k].toString())); } @@ -21083,7 +21083,7 @@ var require_dist_node6 = __commonJS({ } } else { if (operator === ";") { - if (isDefined(value)) { + if (isDefined2(value)) { result.push(encodeUnreserved(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { @@ -40969,14 +40969,14 @@ var require_typeGuards = __commonJS({ "node_modules/@azure/core-util/dist/commonjs/typeGuards.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isDefined = isDefined; + exports2.isDefined = isDefined2; exports2.isObjectWithProperties = isObjectWithProperties; exports2.objectHasProperty = objectHasProperty; - function isDefined(thing) { + function isDefined2(thing) { return typeof thing !== "undefined" && thing !== null; } function isObjectWithProperties(thing, properties) { - if (!isDefined(thing) || typeof thing !== "object") { + if (!isDefined2(thing) || typeof thing !== "object") { return false; } for (const property of properties) { @@ -40987,7 +40987,7 @@ var require_typeGuards = __commonJS({ return true; } function objectHasProperty(thing, property) { - return isDefined(thing) && typeof thing === "object" && property in thing; + return isDefined2(thing) && typeof thing === "object" && property in thing; } } }); @@ -111239,7 +111239,7 @@ var require_dist_node16 = __commonJS({ return value; } } - function isDefined(value) { + function isDefined2(value) { return value !== void 0 && value !== null; } function isKeyOperator(operator) { @@ -111247,7 +111247,7 @@ var require_dist_node16 = __commonJS({ } function getValues(context2, operator, key, modifier) { var value = context2[key], result = []; - if (isDefined(value) && value !== "") { + if (isDefined2(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { @@ -111257,12 +111257,12 @@ var require_dist_node16 = __commonJS({ } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { result.push(encodeValue(operator, value2, isKeyOperator(operator) ? key : "")); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { result.push(encodeValue(operator, value[k], k)); } }); @@ -111270,12 +111270,12 @@ var require_dist_node16 = __commonJS({ } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { tmp.push(encodeValue(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { tmp.push(encodeUnreserved(k)); tmp.push(encodeValue(operator, value[k].toString())); } @@ -111290,7 +111290,7 @@ var require_dist_node16 = __commonJS({ } } else { if (operator === ";") { - if (isDefined(value)) { + if (isDefined2(value)) { result.push(encodeUnreserved(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { diff --git a/lib/analyze-action.js b/lib/analyze-action.js index b6ff57203..85402fc80 100644 --- a/lib/analyze-action.js +++ b/lib/analyze-action.js @@ -20288,7 +20288,7 @@ var require_dist_node2 = __commonJS({ return value; } } - function isDefined(value) { + function isDefined2(value) { return value !== void 0 && value !== null; } function isKeyOperator(operator) { @@ -20296,7 +20296,7 @@ var require_dist_node2 = __commonJS({ } function getValues(context2, operator, key, modifier) { var value = context2[key], result = []; - if (isDefined(value) && value !== "") { + if (isDefined2(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { @@ -20308,14 +20308,14 @@ var require_dist_node2 = __commonJS({ } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { result.push( encodeValue(operator, value2, isKeyOperator(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { result.push(encodeValue(operator, value[k], k)); } }); @@ -20323,12 +20323,12 @@ var require_dist_node2 = __commonJS({ } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { tmp.push(encodeValue(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { tmp.push(encodeUnreserved(k)); tmp.push(encodeValue(operator, value[k].toString())); } @@ -20343,7 +20343,7 @@ var require_dist_node2 = __commonJS({ } } else { if (operator === ";") { - if (isDefined(value)) { + if (isDefined2(value)) { result.push(encodeUnreserved(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { @@ -21028,7 +21028,7 @@ var require_dist_node6 = __commonJS({ return value; } } - function isDefined(value) { + function isDefined2(value) { return value !== void 0 && value !== null; } function isKeyOperator(operator) { @@ -21036,7 +21036,7 @@ var require_dist_node6 = __commonJS({ } function getValues(context2, operator, key, modifier) { var value = context2[key], result = []; - if (isDefined(value) && value !== "") { + if (isDefined2(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { @@ -21048,14 +21048,14 @@ var require_dist_node6 = __commonJS({ } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { result.push( encodeValue(operator, value2, isKeyOperator(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { result.push(encodeValue(operator, value[k], k)); } }); @@ -21063,12 +21063,12 @@ var require_dist_node6 = __commonJS({ } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { tmp.push(encodeValue(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { tmp.push(encodeUnreserved(k)); tmp.push(encodeValue(operator, value[k].toString())); } @@ -21083,7 +21083,7 @@ var require_dist_node6 = __commonJS({ } } else { if (operator === ";") { - if (isDefined(value)) { + if (isDefined2(value)) { result.push(encodeUnreserved(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { @@ -40969,14 +40969,14 @@ var require_typeGuards = __commonJS({ "node_modules/@azure/core-util/dist/commonjs/typeGuards.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isDefined = isDefined; + exports2.isDefined = isDefined2; exports2.isObjectWithProperties = isObjectWithProperties; exports2.objectHasProperty = objectHasProperty; - function isDefined(thing) { + function isDefined2(thing) { return typeof thing !== "undefined" && thing !== null; } function isObjectWithProperties(thing, properties) { - if (!isDefined(thing) || typeof thing !== "object") { + if (!isDefined2(thing) || typeof thing !== "object") { return false; } for (const property of properties) { @@ -40987,7 +40987,7 @@ var require_typeGuards = __commonJS({ return true; } function objectHasProperty(thing, property) { - return isDefined(thing) && typeof thing === "object" && property in thing; + return isDefined2(thing) && typeof thing === "object" && property in thing; } } }); diff --git a/lib/autobuild-action.js b/lib/autobuild-action.js index 3b97b29fe..664893926 100644 --- a/lib/autobuild-action.js +++ b/lib/autobuild-action.js @@ -20288,7 +20288,7 @@ var require_dist_node2 = __commonJS({ return value; } } - function isDefined(value) { + function isDefined2(value) { return value !== void 0 && value !== null; } function isKeyOperator(operator) { @@ -20296,7 +20296,7 @@ var require_dist_node2 = __commonJS({ } function getValues(context2, operator, key, modifier) { var value = context2[key], result = []; - if (isDefined(value) && value !== "") { + if (isDefined2(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { @@ -20308,14 +20308,14 @@ var require_dist_node2 = __commonJS({ } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { result.push( encodeValue(operator, value2, isKeyOperator(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { result.push(encodeValue(operator, value[k], k)); } }); @@ -20323,12 +20323,12 @@ var require_dist_node2 = __commonJS({ } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { tmp.push(encodeValue(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { tmp.push(encodeUnreserved(k)); tmp.push(encodeValue(operator, value[k].toString())); } @@ -20343,7 +20343,7 @@ var require_dist_node2 = __commonJS({ } } else { if (operator === ";") { - if (isDefined(value)) { + if (isDefined2(value)) { result.push(encodeUnreserved(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { @@ -21028,7 +21028,7 @@ var require_dist_node6 = __commonJS({ return value; } } - function isDefined(value) { + function isDefined2(value) { return value !== void 0 && value !== null; } function isKeyOperator(operator) { @@ -21036,7 +21036,7 @@ var require_dist_node6 = __commonJS({ } function getValues(context2, operator, key, modifier) { var value = context2[key], result = []; - if (isDefined(value) && value !== "") { + if (isDefined2(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { @@ -21048,14 +21048,14 @@ var require_dist_node6 = __commonJS({ } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { result.push( encodeValue(operator, value2, isKeyOperator(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { result.push(encodeValue(operator, value[k], k)); } }); @@ -21063,12 +21063,12 @@ var require_dist_node6 = __commonJS({ } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { tmp.push(encodeValue(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { tmp.push(encodeUnreserved(k)); tmp.push(encodeValue(operator, value[k].toString())); } @@ -21083,7 +21083,7 @@ var require_dist_node6 = __commonJS({ } } else { if (operator === ";") { - if (isDefined(value)) { + if (isDefined2(value)) { result.push(encodeUnreserved(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { @@ -40969,14 +40969,14 @@ var require_typeGuards = __commonJS({ "node_modules/@azure/core-util/dist/commonjs/typeGuards.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isDefined = isDefined; + exports2.isDefined = isDefined2; exports2.isObjectWithProperties = isObjectWithProperties; exports2.objectHasProperty = objectHasProperty; - function isDefined(thing) { + function isDefined2(thing) { return typeof thing !== "undefined" && thing !== null; } function isObjectWithProperties(thing, properties) { - if (!isDefined(thing) || typeof thing !== "object") { + if (!isDefined2(thing) || typeof thing !== "object") { return false; } for (const property of properties) { @@ -40987,7 +40987,7 @@ var require_typeGuards = __commonJS({ return true; } function objectHasProperty(thing, property) { - return isDefined(thing) && typeof thing === "object" && property in thing; + return isDefined2(thing) && typeof thing === "object" && property in thing; } } }); diff --git a/lib/init-action-post.js b/lib/init-action-post.js index b3d9d1945..d3d206e35 100644 --- a/lib/init-action-post.js +++ b/lib/init-action-post.js @@ -20288,7 +20288,7 @@ var require_dist_node2 = __commonJS({ return value; } } - function isDefined(value) { + function isDefined2(value) { return value !== void 0 && value !== null; } function isKeyOperator(operator) { @@ -20296,7 +20296,7 @@ var require_dist_node2 = __commonJS({ } function getValues(context3, operator, key, modifier) { var value = context3[key], result = []; - if (isDefined(value) && value !== "") { + if (isDefined2(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { @@ -20308,14 +20308,14 @@ var require_dist_node2 = __commonJS({ } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { result.push( encodeValue(operator, value2, isKeyOperator(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { result.push(encodeValue(operator, value[k], k)); } }); @@ -20323,12 +20323,12 @@ var require_dist_node2 = __commonJS({ } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { tmp.push(encodeValue(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { tmp.push(encodeUnreserved(k)); tmp.push(encodeValue(operator, value[k].toString())); } @@ -20343,7 +20343,7 @@ var require_dist_node2 = __commonJS({ } } else { if (operator === ";") { - if (isDefined(value)) { + if (isDefined2(value)) { result.push(encodeUnreserved(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { @@ -21028,7 +21028,7 @@ var require_dist_node6 = __commonJS({ return value; } } - function isDefined(value) { + function isDefined2(value) { return value !== void 0 && value !== null; } function isKeyOperator(operator) { @@ -21036,7 +21036,7 @@ var require_dist_node6 = __commonJS({ } function getValues(context3, operator, key, modifier) { var value = context3[key], result = []; - if (isDefined(value) && value !== "") { + if (isDefined2(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { @@ -21048,14 +21048,14 @@ var require_dist_node6 = __commonJS({ } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { result.push( encodeValue(operator, value2, isKeyOperator(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { result.push(encodeValue(operator, value[k], k)); } }); @@ -21063,12 +21063,12 @@ var require_dist_node6 = __commonJS({ } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { tmp.push(encodeValue(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { tmp.push(encodeUnreserved(k)); tmp.push(encodeValue(operator, value[k].toString())); } @@ -21083,7 +21083,7 @@ var require_dist_node6 = __commonJS({ } } else { if (operator === ";") { - if (isDefined(value)) { + if (isDefined2(value)) { result.push(encodeUnreserved(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { @@ -40969,14 +40969,14 @@ var require_typeGuards = __commonJS({ "node_modules/@azure/core-util/dist/commonjs/typeGuards.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isDefined = isDefined; + exports2.isDefined = isDefined2; exports2.isObjectWithProperties = isObjectWithProperties; exports2.objectHasProperty = objectHasProperty; - function isDefined(thing) { + function isDefined2(thing) { return typeof thing !== "undefined" && thing !== null; } function isObjectWithProperties(thing, properties) { - if (!isDefined(thing) || typeof thing !== "object") { + if (!isDefined2(thing) || typeof thing !== "object") { return false; } for (const property of properties) { @@ -40987,7 +40987,7 @@ var require_typeGuards = __commonJS({ return true; } function objectHasProperty(thing, property) { - return isDefined(thing) && typeof thing === "object" && property in thing; + return isDefined2(thing) && typeof thing === "object" && property in thing; } } }); @@ -111239,7 +111239,7 @@ var require_dist_node16 = __commonJS({ return value; } } - function isDefined(value) { + function isDefined2(value) { return value !== void 0 && value !== null; } function isKeyOperator(operator) { @@ -111247,7 +111247,7 @@ var require_dist_node16 = __commonJS({ } function getValues(context3, operator, key, modifier) { var value = context3[key], result = []; - if (isDefined(value) && value !== "") { + if (isDefined2(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { @@ -111257,12 +111257,12 @@ var require_dist_node16 = __commonJS({ } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { result.push(encodeValue(operator, value2, isKeyOperator(operator) ? key : "")); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { result.push(encodeValue(operator, value[k], k)); } }); @@ -111270,12 +111270,12 @@ var require_dist_node16 = __commonJS({ } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { tmp.push(encodeValue(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { tmp.push(encodeUnreserved(k)); tmp.push(encodeValue(operator, value[k].toString())); } @@ -111290,7 +111290,7 @@ var require_dist_node16 = __commonJS({ } } else { if (operator === ";") { - if (isDefined(value)) { + if (isDefined2(value)) { result.push(encodeUnreserved(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { diff --git a/lib/init-action.js b/lib/init-action.js index d4cc5226c..9551b70f0 100644 --- a/lib/init-action.js +++ b/lib/init-action.js @@ -22196,7 +22196,7 @@ var require_dist_node2 = __commonJS({ return value; } } - function isDefined(value) { + function isDefined2(value) { return value !== void 0 && value !== null; } function isKeyOperator(operator) { @@ -22204,7 +22204,7 @@ var require_dist_node2 = __commonJS({ } function getValues(context2, operator, key, modifier) { var value = context2[key], result = []; - if (isDefined(value) && value !== "") { + if (isDefined2(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { @@ -22216,14 +22216,14 @@ var require_dist_node2 = __commonJS({ } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { result.push( encodeValue(operator, value2, isKeyOperator(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { result.push(encodeValue(operator, value[k], k)); } }); @@ -22231,12 +22231,12 @@ var require_dist_node2 = __commonJS({ } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { tmp.push(encodeValue(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { tmp.push(encodeUnreserved(k)); tmp.push(encodeValue(operator, value[k].toString())); } @@ -22251,7 +22251,7 @@ var require_dist_node2 = __commonJS({ } } else { if (operator === ";") { - if (isDefined(value)) { + if (isDefined2(value)) { result.push(encodeUnreserved(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { @@ -22936,7 +22936,7 @@ var require_dist_node6 = __commonJS({ return value; } } - function isDefined(value) { + function isDefined2(value) { return value !== void 0 && value !== null; } function isKeyOperator(operator) { @@ -22944,7 +22944,7 @@ var require_dist_node6 = __commonJS({ } function getValues(context2, operator, key, modifier) { var value = context2[key], result = []; - if (isDefined(value) && value !== "") { + if (isDefined2(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { @@ -22956,14 +22956,14 @@ var require_dist_node6 = __commonJS({ } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { result.push( encodeValue(operator, value2, isKeyOperator(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { result.push(encodeValue(operator, value[k], k)); } }); @@ -22971,12 +22971,12 @@ var require_dist_node6 = __commonJS({ } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { tmp.push(encodeValue(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { tmp.push(encodeUnreserved(k)); tmp.push(encodeValue(operator, value[k].toString())); } @@ -22991,7 +22991,7 @@ var require_dist_node6 = __commonJS({ } } else { if (operator === ";") { - if (isDefined(value)) { + if (isDefined2(value)) { result.push(encodeUnreserved(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { @@ -40969,14 +40969,14 @@ var require_typeGuards = __commonJS({ "node_modules/@azure/core-util/dist/commonjs/typeGuards.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isDefined = isDefined; + exports2.isDefined = isDefined2; exports2.isObjectWithProperties = isObjectWithProperties; exports2.objectHasProperty = objectHasProperty; - function isDefined(thing) { + function isDefined2(thing) { return typeof thing !== "undefined" && thing !== null; } function isObjectWithProperties(thing, properties) { - if (!isDefined(thing) || typeof thing !== "object") { + if (!isDefined2(thing) || typeof thing !== "object") { return false; } for (const property of properties) { @@ -40987,7 +40987,7 @@ var require_typeGuards = __commonJS({ return true; } function objectHasProperty(thing, property) { - return isDefined(thing) && typeof thing === "object" && property in thing; + return isDefined2(thing) && typeof thing === "object" && property in thing; } } }); @@ -88296,6 +88296,9 @@ async function asyncSome(array, predicate) { const results = await Promise.all(array.map(predicate)); return results.some((result) => result); } +function isDefined(value) { + return value !== void 0 && value !== null; +} // src/actions-util.ts var pkg = require_package(); @@ -88685,6 +88688,7 @@ async function parseAnalysisKinds(input) { new Set(components.map((component) => component)) ); } +var codeQualityQueries = ["code-quality"]; // src/feature-flags.ts var fs4 = __toESM(require("fs")); @@ -90101,6 +90105,9 @@ function dbLocationOrDefault(dbLocation, tempDir) { function userConfigFromActionPath(tempDir) { return path6.resolve(tempDir, "user-config-from-action.yml"); } +function hasQueryCustomisation(userConfig) { + return isDefined(userConfig["disable-default-queries"]) || isDefined(userConfig.queries) || isDefined(userConfig["query-filters"]); +} async function initConfig(inputs) { const { logger, tempDir } = inputs; if (inputs.configInput) { @@ -90131,6 +90138,22 @@ async function initConfig(inputs) { userConfig, config.augmentationProperties ); + if (!isCodeScanningEnabled(config)) { + if (hasQueryCustomisation(codeScanningConfig)) { + logger.warning( + "Query customizations will be ignored, because only `code-quality` analysis is enabled." + ); + } + const queries = codeQualityQueries.map((v) => ({ uses: v })); + config.originalUserInput["disable-default-queries"] = true; + config.originalUserInput.queries = queries; + config.originalUserInput["query-filters"] = []; + config.augmentationProperties.extraQueryExclusions = []; + config.augmentationProperties.queriesInput = void 0; + codeScanningConfig["disable-default-queries"] = true; + codeScanningConfig.queries = queries; + codeScanningConfig["query-filters"] = []; + } const { overlayDatabaseMode, useOverlayDatabaseCaching } = await getOverlayDatabaseMode( inputs.codeql, inputs.repository, @@ -90357,6 +90380,9 @@ function generateCodeScanningConfig(originalUserInput, augmentationProperties) { } return augmentedConfig; } +function isCodeScanningEnabled(config) { + return config.analysisKinds.includes("code-scanning" /* CodeScanning */); +} // src/dependency-caching.ts var os2 = __toESM(require("os")); diff --git a/lib/resolve-environment-action.js b/lib/resolve-environment-action.js index ecbbc698c..b0e588ee9 100644 --- a/lib/resolve-environment-action.js +++ b/lib/resolve-environment-action.js @@ -20288,7 +20288,7 @@ var require_dist_node2 = __commonJS({ return value; } } - function isDefined(value) { + function isDefined2(value) { return value !== void 0 && value !== null; } function isKeyOperator(operator) { @@ -20296,7 +20296,7 @@ var require_dist_node2 = __commonJS({ } function getValues(context2, operator, key, modifier) { var value = context2[key], result = []; - if (isDefined(value) && value !== "") { + if (isDefined2(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { @@ -20308,14 +20308,14 @@ var require_dist_node2 = __commonJS({ } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { result.push( encodeValue(operator, value2, isKeyOperator(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { result.push(encodeValue(operator, value[k], k)); } }); @@ -20323,12 +20323,12 @@ var require_dist_node2 = __commonJS({ } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { tmp.push(encodeValue(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { tmp.push(encodeUnreserved(k)); tmp.push(encodeValue(operator, value[k].toString())); } @@ -20343,7 +20343,7 @@ var require_dist_node2 = __commonJS({ } } else { if (operator === ";") { - if (isDefined(value)) { + if (isDefined2(value)) { result.push(encodeUnreserved(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { @@ -21028,7 +21028,7 @@ var require_dist_node6 = __commonJS({ return value; } } - function isDefined(value) { + function isDefined2(value) { return value !== void 0 && value !== null; } function isKeyOperator(operator) { @@ -21036,7 +21036,7 @@ var require_dist_node6 = __commonJS({ } function getValues(context2, operator, key, modifier) { var value = context2[key], result = []; - if (isDefined(value) && value !== "") { + if (isDefined2(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { @@ -21048,14 +21048,14 @@ var require_dist_node6 = __commonJS({ } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { result.push( encodeValue(operator, value2, isKeyOperator(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { result.push(encodeValue(operator, value[k], k)); } }); @@ -21063,12 +21063,12 @@ var require_dist_node6 = __commonJS({ } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { tmp.push(encodeValue(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { tmp.push(encodeUnreserved(k)); tmp.push(encodeValue(operator, value[k].toString())); } @@ -21083,7 +21083,7 @@ var require_dist_node6 = __commonJS({ } } else { if (operator === ";") { - if (isDefined(value)) { + if (isDefined2(value)) { result.push(encodeUnreserved(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { @@ -40969,14 +40969,14 @@ var require_typeGuards = __commonJS({ "node_modules/@azure/core-util/dist/commonjs/typeGuards.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isDefined = isDefined; + exports2.isDefined = isDefined2; exports2.isObjectWithProperties = isObjectWithProperties; exports2.objectHasProperty = objectHasProperty; - function isDefined(thing) { + function isDefined2(thing) { return typeof thing !== "undefined" && thing !== null; } function isObjectWithProperties(thing, properties) { - if (!isDefined(thing) || typeof thing !== "object") { + if (!isDefined2(thing) || typeof thing !== "object") { return false; } for (const property of properties) { @@ -40987,7 +40987,7 @@ var require_typeGuards = __commonJS({ return true; } function objectHasProperty(thing, property) { - return isDefined(thing) && typeof thing === "object" && property in thing; + return isDefined2(thing) && typeof thing === "object" && property in thing; } } }); diff --git a/lib/start-proxy-action-post.js b/lib/start-proxy-action-post.js index 1a28bad4d..a3e9750f9 100644 --- a/lib/start-proxy-action-post.js +++ b/lib/start-proxy-action-post.js @@ -20288,7 +20288,7 @@ var require_dist_node2 = __commonJS({ return value; } } - function isDefined(value) { + function isDefined2(value) { return value !== void 0 && value !== null; } function isKeyOperator(operator) { @@ -20296,7 +20296,7 @@ var require_dist_node2 = __commonJS({ } function getValues(context2, operator, key, modifier) { var value = context2[key], result = []; - if (isDefined(value) && value !== "") { + if (isDefined2(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { @@ -20308,14 +20308,14 @@ var require_dist_node2 = __commonJS({ } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { result.push( encodeValue(operator, value2, isKeyOperator(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { result.push(encodeValue(operator, value[k], k)); } }); @@ -20323,12 +20323,12 @@ var require_dist_node2 = __commonJS({ } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { tmp.push(encodeValue(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { tmp.push(encodeUnreserved(k)); tmp.push(encodeValue(operator, value[k].toString())); } @@ -20343,7 +20343,7 @@ var require_dist_node2 = __commonJS({ } } else { if (operator === ";") { - if (isDefined(value)) { + if (isDefined2(value)) { result.push(encodeUnreserved(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { @@ -21028,7 +21028,7 @@ var require_dist_node6 = __commonJS({ return value; } } - function isDefined(value) { + function isDefined2(value) { return value !== void 0 && value !== null; } function isKeyOperator(operator) { @@ -21036,7 +21036,7 @@ var require_dist_node6 = __commonJS({ } function getValues(context2, operator, key, modifier) { var value = context2[key], result = []; - if (isDefined(value) && value !== "") { + if (isDefined2(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { @@ -21048,14 +21048,14 @@ var require_dist_node6 = __commonJS({ } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { result.push( encodeValue(operator, value2, isKeyOperator(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { result.push(encodeValue(operator, value[k], k)); } }); @@ -21063,12 +21063,12 @@ var require_dist_node6 = __commonJS({ } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { tmp.push(encodeValue(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { tmp.push(encodeUnreserved(k)); tmp.push(encodeValue(operator, value[k].toString())); } @@ -21083,7 +21083,7 @@ var require_dist_node6 = __commonJS({ } } else { if (operator === ";") { - if (isDefined(value)) { + if (isDefined2(value)) { result.push(encodeUnreserved(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { @@ -40969,14 +40969,14 @@ var require_typeGuards = __commonJS({ "node_modules/@azure/core-util/dist/commonjs/typeGuards.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isDefined = isDefined; + exports2.isDefined = isDefined2; exports2.isObjectWithProperties = isObjectWithProperties; exports2.objectHasProperty = objectHasProperty; - function isDefined(thing) { + function isDefined2(thing) { return typeof thing !== "undefined" && thing !== null; } function isObjectWithProperties(thing, properties) { - if (!isDefined(thing) || typeof thing !== "object") { + if (!isDefined2(thing) || typeof thing !== "object") { return false; } for (const property of properties) { @@ -40987,7 +40987,7 @@ var require_typeGuards = __commonJS({ return true; } function objectHasProperty(thing, property) { - return isDefined(thing) && typeof thing === "object" && property in thing; + return isDefined2(thing) && typeof thing === "object" && property in thing; } } }); @@ -109899,7 +109899,7 @@ var require_dist_node16 = __commonJS({ return value; } } - function isDefined(value) { + function isDefined2(value) { return value !== void 0 && value !== null; } function isKeyOperator(operator) { @@ -109907,7 +109907,7 @@ var require_dist_node16 = __commonJS({ } function getValues(context2, operator, key, modifier) { var value = context2[key], result = []; - if (isDefined(value) && value !== "") { + if (isDefined2(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { @@ -109917,12 +109917,12 @@ var require_dist_node16 = __commonJS({ } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { result.push(encodeValue(operator, value2, isKeyOperator(operator) ? key : "")); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { result.push(encodeValue(operator, value[k], k)); } }); @@ -109930,12 +109930,12 @@ var require_dist_node16 = __commonJS({ } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { tmp.push(encodeValue(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { tmp.push(encodeUnreserved(k)); tmp.push(encodeValue(operator, value[k].toString())); } @@ -109950,7 +109950,7 @@ var require_dist_node16 = __commonJS({ } } else { if (operator === ";") { - if (isDefined(value)) { + if (isDefined2(value)) { result.push(encodeUnreserved(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { diff --git a/lib/upload-lib.js b/lib/upload-lib.js index 7fbb438d7..7b0ea7462 100644 --- a/lib/upload-lib.js +++ b/lib/upload-lib.js @@ -21611,7 +21611,7 @@ var require_dist_node2 = __commonJS({ return value; } } - function isDefined(value) { + function isDefined2(value) { return value !== void 0 && value !== null; } function isKeyOperator(operator) { @@ -21619,7 +21619,7 @@ var require_dist_node2 = __commonJS({ } function getValues(context2, operator, key, modifier) { var value = context2[key], result = []; - if (isDefined(value) && value !== "") { + if (isDefined2(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { @@ -21631,14 +21631,14 @@ var require_dist_node2 = __commonJS({ } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { result.push( encodeValue(operator, value2, isKeyOperator(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { result.push(encodeValue(operator, value[k], k)); } }); @@ -21646,12 +21646,12 @@ var require_dist_node2 = __commonJS({ } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { tmp.push(encodeValue(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { tmp.push(encodeUnreserved(k)); tmp.push(encodeValue(operator, value[k].toString())); } @@ -21666,7 +21666,7 @@ var require_dist_node2 = __commonJS({ } } else { if (operator === ";") { - if (isDefined(value)) { + if (isDefined2(value)) { result.push(encodeUnreserved(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { @@ -22351,7 +22351,7 @@ var require_dist_node6 = __commonJS({ return value; } } - function isDefined(value) { + function isDefined2(value) { return value !== void 0 && value !== null; } function isKeyOperator(operator) { @@ -22359,7 +22359,7 @@ var require_dist_node6 = __commonJS({ } function getValues(context2, operator, key, modifier) { var value = context2[key], result = []; - if (isDefined(value) && value !== "") { + if (isDefined2(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { @@ -22371,14 +22371,14 @@ var require_dist_node6 = __commonJS({ } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { result.push( encodeValue(operator, value2, isKeyOperator(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { result.push(encodeValue(operator, value[k], k)); } }); @@ -22386,12 +22386,12 @@ var require_dist_node6 = __commonJS({ } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { tmp.push(encodeValue(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { tmp.push(encodeUnreserved(k)); tmp.push(encodeValue(operator, value[k].toString())); } @@ -22406,7 +22406,7 @@ var require_dist_node6 = __commonJS({ } } else { if (operator === ";") { - if (isDefined(value)) { + if (isDefined2(value)) { result.push(encodeUnreserved(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { @@ -42292,14 +42292,14 @@ var require_typeGuards = __commonJS({ "node_modules/@azure/core-util/dist/commonjs/typeGuards.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isDefined = isDefined; + exports2.isDefined = isDefined2; exports2.isObjectWithProperties = isObjectWithProperties; exports2.objectHasProperty = objectHasProperty; - function isDefined(thing) { + function isDefined2(thing) { return typeof thing !== "undefined" && thing !== null; } function isObjectWithProperties(thing, properties) { - if (!isDefined(thing) || typeof thing !== "object") { + if (!isDefined2(thing) || typeof thing !== "object") { return false; } for (const property of properties) { @@ -42310,7 +42310,7 @@ var require_typeGuards = __commonJS({ return true; } function objectHasProperty(thing, property) { - return isDefined(thing) && typeof thing === "object" && property in thing; + return isDefined2(thing) && typeof thing === "object" && property in thing; } } }); diff --git a/lib/upload-sarif-action-post.js b/lib/upload-sarif-action-post.js index 84a45d5e5..11e2df651 100644 --- a/lib/upload-sarif-action-post.js +++ b/lib/upload-sarif-action-post.js @@ -20288,7 +20288,7 @@ var require_dist_node2 = __commonJS({ return value; } } - function isDefined(value) { + function isDefined2(value) { return value !== void 0 && value !== null; } function isKeyOperator(operator) { @@ -20296,7 +20296,7 @@ var require_dist_node2 = __commonJS({ } function getValues(context2, operator, key, modifier) { var value = context2[key], result = []; - if (isDefined(value) && value !== "") { + if (isDefined2(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { @@ -20308,14 +20308,14 @@ var require_dist_node2 = __commonJS({ } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { result.push( encodeValue(operator, value2, isKeyOperator(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { result.push(encodeValue(operator, value[k], k)); } }); @@ -20323,12 +20323,12 @@ var require_dist_node2 = __commonJS({ } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { tmp.push(encodeValue(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { tmp.push(encodeUnreserved(k)); tmp.push(encodeValue(operator, value[k].toString())); } @@ -20343,7 +20343,7 @@ var require_dist_node2 = __commonJS({ } } else { if (operator === ";") { - if (isDefined(value)) { + if (isDefined2(value)) { result.push(encodeUnreserved(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { @@ -21028,7 +21028,7 @@ var require_dist_node6 = __commonJS({ return value; } } - function isDefined(value) { + function isDefined2(value) { return value !== void 0 && value !== null; } function isKeyOperator(operator) { @@ -21036,7 +21036,7 @@ var require_dist_node6 = __commonJS({ } function getValues(context2, operator, key, modifier) { var value = context2[key], result = []; - if (isDefined(value) && value !== "") { + if (isDefined2(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { @@ -21048,14 +21048,14 @@ var require_dist_node6 = __commonJS({ } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { result.push( encodeValue(operator, value2, isKeyOperator(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { result.push(encodeValue(operator, value[k], k)); } }); @@ -21063,12 +21063,12 @@ var require_dist_node6 = __commonJS({ } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { tmp.push(encodeValue(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { tmp.push(encodeUnreserved(k)); tmp.push(encodeValue(operator, value[k].toString())); } @@ -21083,7 +21083,7 @@ var require_dist_node6 = __commonJS({ } } else { if (operator === ";") { - if (isDefined(value)) { + if (isDefined2(value)) { result.push(encodeUnreserved(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { @@ -45596,14 +45596,14 @@ var require_typeGuards = __commonJS({ "node_modules/@azure/core-util/dist/commonjs/typeGuards.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isDefined = isDefined; + exports2.isDefined = isDefined2; exports2.isObjectWithProperties = isObjectWithProperties; exports2.objectHasProperty = objectHasProperty; - function isDefined(thing) { + function isDefined2(thing) { return typeof thing !== "undefined" && thing !== null; } function isObjectWithProperties(thing, properties) { - if (!isDefined(thing) || typeof thing !== "object") { + if (!isDefined2(thing) || typeof thing !== "object") { return false; } for (const property of properties) { @@ -45614,7 +45614,7 @@ var require_typeGuards = __commonJS({ return true; } function objectHasProperty(thing, property) { - return isDefined(thing) && typeof thing === "object" && property in thing; + return isDefined2(thing) && typeof thing === "object" && property in thing; } } }); @@ -104756,7 +104756,7 @@ var require_dist_node16 = __commonJS({ return value; } } - function isDefined(value) { + function isDefined2(value) { return value !== void 0 && value !== null; } function isKeyOperator(operator) { @@ -104764,7 +104764,7 @@ var require_dist_node16 = __commonJS({ } function getValues(context2, operator, key, modifier) { var value = context2[key], result = []; - if (isDefined(value) && value !== "") { + if (isDefined2(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { @@ -104774,12 +104774,12 @@ var require_dist_node16 = __commonJS({ } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { result.push(encodeValue(operator, value2, isKeyOperator(operator) ? key : "")); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { result.push(encodeValue(operator, value[k], k)); } }); @@ -104787,12 +104787,12 @@ var require_dist_node16 = __commonJS({ } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { tmp.push(encodeValue(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { tmp.push(encodeUnreserved(k)); tmp.push(encodeValue(operator, value[k].toString())); } @@ -104807,7 +104807,7 @@ var require_dist_node16 = __commonJS({ } } else { if (operator === ";") { - if (isDefined(value)) { + if (isDefined2(value)) { result.push(encodeUnreserved(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { diff --git a/lib/upload-sarif-action.js b/lib/upload-sarif-action.js index a6db488e3..20204e24d 100644 --- a/lib/upload-sarif-action.js +++ b/lib/upload-sarif-action.js @@ -20288,7 +20288,7 @@ var require_dist_node2 = __commonJS({ return value; } } - function isDefined(value) { + function isDefined2(value) { return value !== void 0 && value !== null; } function isKeyOperator(operator) { @@ -20296,7 +20296,7 @@ var require_dist_node2 = __commonJS({ } function getValues(context2, operator, key, modifier) { var value = context2[key], result = []; - if (isDefined(value) && value !== "") { + if (isDefined2(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { @@ -20308,14 +20308,14 @@ var require_dist_node2 = __commonJS({ } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { result.push( encodeValue(operator, value2, isKeyOperator(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { result.push(encodeValue(operator, value[k], k)); } }); @@ -20323,12 +20323,12 @@ var require_dist_node2 = __commonJS({ } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { tmp.push(encodeValue(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { tmp.push(encodeUnreserved(k)); tmp.push(encodeValue(operator, value[k].toString())); } @@ -20343,7 +20343,7 @@ var require_dist_node2 = __commonJS({ } } else { if (operator === ";") { - if (isDefined(value)) { + if (isDefined2(value)) { result.push(encodeUnreserved(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { @@ -21028,7 +21028,7 @@ var require_dist_node6 = __commonJS({ return value; } } - function isDefined(value) { + function isDefined2(value) { return value !== void 0 && value !== null; } function isKeyOperator(operator) { @@ -21036,7 +21036,7 @@ var require_dist_node6 = __commonJS({ } function getValues(context2, operator, key, modifier) { var value = context2[key], result = []; - if (isDefined(value) && value !== "") { + if (isDefined2(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); if (modifier && modifier !== "*") { @@ -21048,14 +21048,14 @@ var require_dist_node6 = __commonJS({ } else { if (modifier === "*") { if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { result.push( encodeValue(operator, value2, isKeyOperator(operator) ? key : "") ); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { result.push(encodeValue(operator, value[k], k)); } }); @@ -21063,12 +21063,12 @@ var require_dist_node6 = __commonJS({ } else { const tmp = []; if (Array.isArray(value)) { - value.filter(isDefined).forEach(function(value2) { + value.filter(isDefined2).forEach(function(value2) { tmp.push(encodeValue(operator, value2)); }); } else { Object.keys(value).forEach(function(k) { - if (isDefined(value[k])) { + if (isDefined2(value[k])) { tmp.push(encodeUnreserved(k)); tmp.push(encodeValue(operator, value[k].toString())); } @@ -21083,7 +21083,7 @@ var require_dist_node6 = __commonJS({ } } else { if (operator === ";") { - if (isDefined(value)) { + if (isDefined2(value)) { result.push(encodeUnreserved(key)); } } else if (value === "" && (operator === "&" || operator === "?")) { @@ -40969,14 +40969,14 @@ var require_typeGuards = __commonJS({ "node_modules/@azure/core-util/dist/commonjs/typeGuards.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.isDefined = isDefined; + exports2.isDefined = isDefined2; exports2.isObjectWithProperties = isObjectWithProperties; exports2.objectHasProperty = objectHasProperty; - function isDefined(thing) { + function isDefined2(thing) { return typeof thing !== "undefined" && thing !== null; } function isObjectWithProperties(thing, properties) { - if (!isDefined(thing) || typeof thing !== "object") { + if (!isDefined2(thing) || typeof thing !== "object") { return false; } for (const property of properties) { @@ -40987,7 +40987,7 @@ var require_typeGuards = __commonJS({ return true; } function objectHasProperty(thing, property) { - return isDefined(thing) && typeof thing === "object" && property in thing; + return isDefined2(thing) && typeof thing === "object" && property in thing; } } }); diff --git a/src/config-utils.test.ts b/src/config-utils.test.ts index 857824d71..87a1b025c 100644 --- a/src/config-utils.test.ts +++ b/src/config-utils.test.ts @@ -197,18 +197,31 @@ test("load code quality config", async (t) => { }), ); - t.deepEqual( - config, - await configUtils.getDefaultConfig( - createTestInitConfigInputs({ - analysisKindsInput: "code-quality", - languagesInput: languages, - tempDir, - codeql, - logger, - }), - ), - ); + // And the config we expect it to result in + const expectedConfig: configUtils.Config = { + analysisKinds: [AnalysisKind.CodeQuality], + languages: [KnownLanguage.actions], + buildMode: undefined, + // This gets set because we only have `AnalysisKind.CodeQuality` + originalUserInput: { + "disable-default-queries": true, + queries: [{ uses: "code-quality" }], + "query-filters": [], + }, + tempDir, + codeQLCmd: codeql.getPath(), + gitHubVersion: githubVersion, + dbLocation: path.resolve(tempDir, "codeql_databases"), + debugMode: false, + debugArtifactName: "", + debugDatabaseName: "", + augmentationProperties: configUtils.defaultAugmentationProperties, + trapCaches: {}, + trapCacheDownloadTime: 0, + dependencyCachingEnabled: CachingKind.None, + }; + + t.deepEqual(config, expectedConfig); }); }); diff --git a/src/config-utils.ts b/src/config-utils.ts index 3aead4778..7cc72cf21 100644 --- a/src/config-utils.ts +++ b/src/config-utils.ts @@ -10,6 +10,7 @@ import { AnalysisConfig, AnalysisKind, CodeQuality, + codeQualityQueries, CodeScanning, parseAnalysisKinds, } from "./analyses"; @@ -34,6 +35,7 @@ import { BuildMode, codeQlVersionAtLeast, cloneObject, + isDefined, } from "./util"; // Property names from the user-supplied config file. @@ -1069,6 +1071,19 @@ function userConfigFromActionPath(tempDir: string): string { return path.resolve(tempDir, "user-config-from-action.yml"); } +/** + * Checks whether the given `UserConfig` contains any query customisations. + * + * @returns Returns `true` if the `UserConfig` customises which queries are run. + */ +function hasQueryCustomisation(userConfig: UserConfig): boolean { + return ( + isDefined(userConfig["disable-default-queries"]) || + isDefined(userConfig.queries) || + isDefined(userConfig["query-filters"]) + ); +} + /** * Load and return the config. * @@ -1117,6 +1132,31 @@ export async function initConfig(inputs: InitConfigInputs): Promise { config.augmentationProperties, ); + // If Code Scanning analysis is disabled, then we initialise the database for Code Quality. + // That entails disabling the default queries and only running quality queries. + if (!isCodeScanningEnabled(config)) { + // Warn if any query customisations are present in the computed configuration. + if (hasQueryCustomisation(codeScanningConfig)) { + logger.warning( + "Query customizations will be ignored, because only `code-quality` analysis is enabled.", + ); + } + + const queries = codeQualityQueries.map((v) => ({ uses: v })); + + // Set the query customisation options for Code Quality only analysis. + config.originalUserInput["disable-default-queries"] = true; + config.originalUserInput.queries = queries; + config.originalUserInput["query-filters"] = []; + config.augmentationProperties.extraQueryExclusions = []; + config.augmentationProperties.queriesInput = undefined; + + // Update the computed configuration for the call to `getOverlayDatabaseMode`. + codeScanningConfig["disable-default-queries"] = true; + codeScanningConfig.queries = queries; + codeScanningConfig["query-filters"] = []; + } + // The choice of overlay database mode depends on the selection of languages // and queries, which in turn depends on the user config and the augmentation // properties. So we need to calculate the overlay database mode after the