Skip to content

Commit f96b530

Browse files
Merge pull request #84 from unapplicable/fix-paging-boundaries
Fix paging boundaries
2 parents 48158fc + b0cf022 commit f96b530

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ function logError(context, error){
253253

254254
{
255255
const pageSize = 500;
256+
const maxResults = 10000;
257+
const maxPage = maxResults / pageSize;
256258
let page = 1;
257259
let nbResults;
258260

@@ -275,11 +277,13 @@ function logError(context, error){
275277
logError("getting rules", error);
276278
return null;
277279
}
278-
} while (nbResults === pageSize);
280+
} while (nbResults === pageSize && page <= maxPage);
279281
}
280282

281283
{
282284
const pageSize = 500;
285+
const maxResults = 10000;
286+
const maxPage = maxResults / pageSize;
283287
let page = 1;
284288
let nbResults;
285289
/** Get all statuses except "REVIEWED".
@@ -322,7 +326,7 @@ function logError(context, error){
322326
logError("getting issues", error);
323327
return null;
324328
}
325-
} while (nbResults === pageSize);
329+
} while (nbResults === pageSize && page <= maxPage);
326330

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

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

0 commit comments

Comments
 (0)