Nit: Simplify code with optional chaining
This commit is contained in:
parent
501fe7ff12
commit
f888be73ce
3 changed files with 5 additions and 8 deletions
4
lib/config-utils.js
generated
4
lib/config-utils.js
generated
|
|
@ -120,6 +120,7 @@ const builtinSuites = ["security-extended", "security-and-quality"];
|
||||||
* Throws an error if suiteName is not a valid builtin suite.
|
* Throws an error if suiteName is not a valid builtin suite.
|
||||||
*/
|
*/
|
||||||
async function addBuiltinSuiteQueries(languages, codeQL, resultMap, packs, suiteName, featureFlags, configFile) {
|
async function addBuiltinSuiteQueries(languages, codeQL, resultMap, packs, suiteName, featureFlags, configFile) {
|
||||||
|
var _a;
|
||||||
const found = builtinSuites.find((suite) => suite === suiteName);
|
const found = builtinSuites.find((suite) => suite === suiteName);
|
||||||
if (!found) {
|
if (!found) {
|
||||||
throw new Error(getQueryUsesInvalid(configFile, suiteName));
|
throw new Error(getQueryUsesInvalid(configFile, suiteName));
|
||||||
|
|
@ -129,8 +130,7 @@ async function addBuiltinSuiteQueries(languages, codeQL, resultMap, packs, suite
|
||||||
// pack, then add the ML-powered query pack so that we run ML-powered queries.
|
// pack, then add the ML-powered query pack so that we run ML-powered queries.
|
||||||
if (languages.includes("javascript") &&
|
if (languages.includes("javascript") &&
|
||||||
(found === "security-extended" || found === "security-and-quality") &&
|
(found === "security-extended" || found === "security-and-quality") &&
|
||||||
!(packs.javascript &&
|
!((_a = packs.javascript) === null || _a === void 0 ? void 0 : _a.some((pack) => pack.packName === util_1.ML_POWERED_JS_QUERIES_PACK_NAME)) &&
|
||||||
packs.javascript.some((pack) => pack.packName === util_1.ML_POWERED_JS_QUERIES_PACK_NAME)) &&
|
|
||||||
(await featureFlags.getValue(feature_flags_1.FeatureFlag.MlPoweredQueriesEnabled)) &&
|
(await featureFlags.getValue(feature_flags_1.FeatureFlag.MlPoweredQueriesEnabled)) &&
|
||||||
(await (0, util_1.codeQlVersionAbove)(codeQL, codeql_1.CODEQL_VERSION_ML_POWERED_QUERIES))) {
|
(await (0, util_1.codeQlVersionAbove)(codeQL, codeql_1.CODEQL_VERSION_ML_POWERED_QUERIES))) {
|
||||||
if (!packs.javascript) {
|
if (!packs.javascript) {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -295,11 +295,8 @@ async function addBuiltinSuiteQueries(
|
||||||
if (
|
if (
|
||||||
languages.includes("javascript") &&
|
languages.includes("javascript") &&
|
||||||
(found === "security-extended" || found === "security-and-quality") &&
|
(found === "security-extended" || found === "security-and-quality") &&
|
||||||
!(
|
!packs.javascript?.some(
|
||||||
packs.javascript &&
|
(pack) => pack.packName === ML_POWERED_JS_QUERIES_PACK_NAME
|
||||||
packs.javascript.some(
|
|
||||||
(pack) => pack.packName === ML_POWERED_JS_QUERIES_PACK_NAME
|
|
||||||
)
|
|
||||||
) &&
|
) &&
|
||||||
(await featureFlags.getValue(FeatureFlag.MlPoweredQueriesEnabled)) &&
|
(await featureFlags.getValue(FeatureFlag.MlPoweredQueriesEnabled)) &&
|
||||||
(await codeQlVersionAbove(codeQL, CODEQL_VERSION_ML_POWERED_QUERIES))
|
(await codeQlVersionAbove(codeQL, CODEQL_VERSION_ML_POWERED_QUERIES))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue