Avoid default arguments with historical values

This commit is contained in:
Michael B. Gale
2025-06-26 13:51:08 +01:00
parent 9ec0bb9605
commit ad6046ff97
15 changed files with 24 additions and 18 deletions

8
lib/upload-lib.js generated
View File

@@ -244,7 +244,7 @@ var SARIF_UPLOAD_ENDPOINT;
})(SARIF_UPLOAD_ENDPOINT || (exports.SARIF_UPLOAD_ENDPOINT = SARIF_UPLOAD_ENDPOINT = {}));
// Upload the given payload.
// If the request fails then this will retry a small number of times.
async function uploadPayload(payload, repositoryNwo, logger, target = SARIF_UPLOAD_ENDPOINT.CODE_SCANNING_UPLOAD_TARGET) {
async function uploadPayload(payload, repositoryNwo, logger, target) {
logger.info("Uploading results");
// If in test mode we don't want to upload the results
if (util.isInTestMode()) {
@@ -284,7 +284,7 @@ async function uploadPayload(payload, repositoryNwo, logger, target = SARIF_UPLO
}
// Recursively walks a directory and returns all SARIF files it finds.
// Does not follow symlinks.
function findSarifFilesInDir(sarifPath, isSarif = exports.CodeScanningTarget.sarifPredicate) {
function findSarifFilesInDir(sarifPath, isSarif) {
const sarifFiles = [];
const walkSarifFiles = (dir) => {
const entries = fs.readdirSync(dir, { withFileTypes: true });
@@ -300,7 +300,7 @@ function findSarifFilesInDir(sarifPath, isSarif = exports.CodeScanningTarget.sar
walkSarifFiles(sarifPath);
return sarifFiles;
}
function getSarifFilePaths(sarifPath, isSarif = exports.CodeScanningTarget.sarifPredicate) {
function getSarifFilePaths(sarifPath, isSarif) {
if (!fs.existsSync(sarifPath)) {
// This is always a configuration error, even for first-party runs.
throw new util_1.ConfigurationError(`Path does not exist: ${sarifPath}`);
@@ -435,7 +435,7 @@ exports.CodeQualityTarget = {
* Uploads a single SARIF file or a directory of SARIF files depending on what `inputSarifPath` refers
* to.
*/
async function uploadFiles(inputSarifPath, checkoutPath, category, features, logger, uploadTarget = exports.CodeScanningTarget) {
async function uploadFiles(inputSarifPath, checkoutPath, category, features, logger, uploadTarget) {
const sarifPaths = getSarifFilePaths(inputSarifPath, uploadTarget.sarifPredicate);
return uploadSpecifiedFiles(sarifPaths, checkoutPath, category, features, logger, uploadTarget);
}