From 83644d581041bcd15ebf2cbc601b744b008d1f18 Mon Sep 17 00:00:00 2001 From: martin veillette Date: Wed, 12 Aug 2026 14:05:35 -0400 Subject: [PATCH] Clear CodeQL useless-assignment in volcano pagination. Restructure the page loop so totalPages is not seeded with a dummy value. Co-authored-by: Cursor --- scripts/build-data.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/build-data.ts b/scripts/build-data.ts index 21986b4..ca367c9 100644 --- a/scripts/build-data.ts +++ b/scripts/build-data.ts @@ -1019,13 +1019,12 @@ interface VolcanoBuild { async function buildVolcanoes(plates: readonly PlateBuild[]): Promise { const volcanoes: VolcanoBuild[] = []; let page = 1; - let totalPages = 1; - do { + for (;;) { const response = await fetchJson<{ items: readonly VolcanoLocation[]; totalPages: number }>( `${VOLCANO_QUERY}?itemsPerPage=100&page=${page}`, `volcanoes_${page}.json`, ); - totalPages = response.totalPages; + const totalPages = response.totalPages; for (const item of response.items) { if (typeof item.latitude !== "number" || typeof item.longitude !== "number") { continue; @@ -1039,7 +1038,10 @@ async function buildVolcanoes(plates: readonly PlateBuild[]): Promise totalPages) { + break; + } + } const entries = volcanoes.map( (volcano) =>