Fix getSarifFilePaths not using right filter
This commit is contained in:
parent
f1834221f2
commit
6abacdb184
3 changed files with 13 additions and 7 deletions
6
lib/upload-lib.js
generated
6
lib/upload-lib.js
generated
|
|
@ -300,14 +300,14 @@ function findSarifFilesInDir(sarifPath, isSarif = defaultIsSarif) {
|
|||
walkSarifFiles(sarifPath);
|
||||
return sarifFiles;
|
||||
}
|
||||
function getSarifFilePaths(sarifPath) {
|
||||
function getSarifFilePaths(sarifPath, isSarif = defaultIsSarif) {
|
||||
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}`);
|
||||
}
|
||||
let sarifFiles;
|
||||
if (fs.lstatSync(sarifPath).isDirectory()) {
|
||||
sarifFiles = findSarifFilesInDir(sarifPath);
|
||||
sarifFiles = findSarifFilesInDir(sarifPath, isSarif);
|
||||
if (sarifFiles.length === 0) {
|
||||
// This is always a configuration error, even for first-party runs.
|
||||
throw new util_1.ConfigurationError(`No SARIF files found to upload in "${sarifPath}".`);
|
||||
|
|
@ -434,7 +434,7 @@ exports.CodeQualityTarget = {
|
|||
* to.
|
||||
*/
|
||||
async function uploadFiles(inputSarifPath, checkoutPath, category, features, logger, uploadTarget = exports.CodeScanningTarget) {
|
||||
const sarifPaths = getSarifFilePaths(inputSarifPath);
|
||||
const sarifPaths = getSarifFilePaths(inputSarifPath, uploadTarget.sarifFilter);
|
||||
logger.startGroup(`Uploading ${uploadTarget.name} results`);
|
||||
logger.info(`Processing sarif files: ${JSON.stringify(sarifPaths)}`);
|
||||
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -405,7 +405,10 @@ export function findSarifFilesInDir(
|
|||
return sarifFiles;
|
||||
}
|
||||
|
||||
function getSarifFilePaths(sarifPath: string) {
|
||||
function getSarifFilePaths(
|
||||
sarifPath: string,
|
||||
isSarif: (name: string) => boolean = defaultIsSarif,
|
||||
) {
|
||||
if (!fs.existsSync(sarifPath)) {
|
||||
// This is always a configuration error, even for first-party runs.
|
||||
throw new ConfigurationError(`Path does not exist: ${sarifPath}`);
|
||||
|
|
@ -413,7 +416,7 @@ function getSarifFilePaths(sarifPath: string) {
|
|||
|
||||
let sarifFiles: string[];
|
||||
if (fs.lstatSync(sarifPath).isDirectory()) {
|
||||
sarifFiles = findSarifFilesInDir(sarifPath);
|
||||
sarifFiles = findSarifFilesInDir(sarifPath, isSarif);
|
||||
if (sarifFiles.length === 0) {
|
||||
// This is always a configuration error, even for first-party runs.
|
||||
throw new ConfigurationError(
|
||||
|
|
@ -611,7 +614,10 @@ export async function uploadFiles(
|
|||
logger: Logger,
|
||||
uploadTarget: UploadTarget = CodeScanningTarget,
|
||||
): Promise<UploadResult> {
|
||||
const sarifPaths = getSarifFilePaths(inputSarifPath);
|
||||
const sarifPaths = getSarifFilePaths(
|
||||
inputSarifPath,
|
||||
uploadTarget.sarifFilter,
|
||||
);
|
||||
|
||||
logger.startGroup(`Uploading ${uploadTarget.name} results`);
|
||||
logger.info(`Processing sarif files: ${JSON.stringify(sarifPaths)}`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue