Skip to content

Commit

Permalink
Merge pull request #84 from unapplicable/fix-paging-boundaries
Browse files Browse the repository at this point in the history
Fix paging boundaries
  • Loading branch information
thecampagnards authored Mar 2, 2022
2 parents 48158fc + b0cf022 commit f96b530
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ function logError(context, error){

{
const pageSize = 500;
const maxResults = 10000;
const maxPage = maxResults / pageSize;
let page = 1;
let nbResults;

Expand All @@ -275,11 +277,13 @@ function logError(context, error){
logError("getting rules", error);
return null;
}
} while (nbResults === pageSize);
} while (nbResults === pageSize && page <= maxPage);
}

{
const pageSize = 500;
const maxResults = 10000;
const maxPage = maxResults / pageSize;
let page = 1;
let nbResults;
/** Get all statuses except "REVIEWED".
Expand Down Expand Up @@ -322,7 +326,7 @@ function logError(context, error){
logError("getting issues", error);
return null;
}
} while (nbResults === pageSize);
} while (nbResults === pageSize && page <= maxPage);

let hSeverity = "";
if (version >= "8.2" && !data.noSecurityHotspot) {
Expand All @@ -342,7 +346,7 @@ function logError(context, error){
logError("getting hotspots list", error);
return null;
}
} while (nbResults === pageSize);
} while (nbResults === pageSize && page <= maxPage);

// 2) Getting hotspots details with hotspots/show
for (let hotspotKey of data.hotspotKeys){
Expand Down

0 comments on commit f96b530

Please sign in to comment.