Add ability to use different filters in findSarifFilesInDir
This commit is contained in:
parent
320f7b0fd6
commit
22444a650f
3 changed files with 14 additions and 5 deletions
6
lib/upload-lib.js
generated
6
lib/upload-lib.js
generated
|
|
@ -274,14 +274,16 @@ async function uploadPayload(payload, repositoryNwo, logger) {
|
|||
throw (0, api_client_1.wrapApiConfigurationError)(e);
|
||||
}
|
||||
}
|
||||
const qualityIsSarif = (name) => name.endsWith(".quality.sarif");
|
||||
const defaultIsSarif = (name) => name.endsWith(".sarif") && !qualityIsSarif(name);
|
||||
// Recursively walks a directory and returns all SARIF files it finds.
|
||||
// Does not follow symlinks.
|
||||
function findSarifFilesInDir(sarifPath) {
|
||||
function findSarifFilesInDir(sarifPath, isSarif = defaultIsSarif) {
|
||||
const sarifFiles = [];
|
||||
const walkSarifFiles = (dir) => {
|
||||
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
||||
for (const entry of entries) {
|
||||
if (entry.isFile() && entry.name.endsWith(".sarif")) {
|
||||
if (entry.isFile() && isSarif(entry.name)) {
|
||||
sarifFiles.push(path.resolve(dir, entry.name));
|
||||
}
|
||||
else if (entry.isDirectory()) {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue