mirror of
https://github.com/github/codeql-action.git
synced 2025-12-24 08:10:06 +08:00
Linting: Prefer optional chaining
This commit is contained in:
6
lib/upload-lib.js
generated
6
lib/upload-lib.js
generated
@@ -89703,13 +89703,13 @@ async function getTarVersion() {
|
||||
}
|
||||
if (stdout.includes("GNU tar")) {
|
||||
const match = stdout.match(/tar \(GNU tar\) ([0-9.]+)/);
|
||||
if (!match || !match[1]) {
|
||||
if (!match?.[1]) {
|
||||
throw new Error("Failed to parse output of tar --version.");
|
||||
}
|
||||
return { type: "gnu", version: match[1] };
|
||||
} else if (stdout.includes("bsdtar")) {
|
||||
const match = stdout.match(/bsdtar ([0-9.]+)/);
|
||||
if (!match || !match[1]) {
|
||||
if (!match?.[1]) {
|
||||
throw new Error("Failed to parse output of tar --version.");
|
||||
}
|
||||
return { type: "bsd", version: match[1] };
|
||||
@@ -90089,7 +90089,7 @@ function tryGetTagNameFromUrl(url2, logger) {
|
||||
return void 0;
|
||||
}
|
||||
const match = matches[matches.length - 1];
|
||||
if (match === null || match.length !== 2) {
|
||||
if (match?.length !== 2) {
|
||||
logger.debug(
|
||||
`Could not determine tag name for URL ${url2}. Matched ${JSON.stringify(
|
||||
match
|
||||
|
||||
Reference in New Issue
Block a user