Resolve violations of github/array-foreach lint

Resolves #199
This commit is contained in:
Michael Huynh
2020-09-20 17:03:01 +08:00
parent b2dfa6e690
commit 4666a0eed0
19 changed files with 52 additions and 37 deletions

9
lib/upload-lib.js generated
View File

@@ -104,10 +104,13 @@ async function upload(sarifPath, repositoryNwo, commitOid, ref, analysisKey, ana
throw new Error(`Path does not exist: ${sarifPath}`);
}
if (fs.lstatSync(sarifPath).isDirectory()) {
fs.readdirSync(sarifPath)
const paths = fs
.readdirSync(sarifPath)
.filter((f) => f.endsWith(".sarif"))
.map((f) => path.resolve(sarifPath, f))
.forEach((f) => sarifFiles.push(f));
.map((f) => path.resolve(sarifPath, f));
for (const path of paths) {
sarifFiles.push(path);
}
if (sarifFiles.length === 0) {
throw new Error(`No SARIF files found to upload in "${sarifPath}".`);
}