mirror of
https://github.com/github/codeql-action.git
synced 2026-04-26 00:38:48 +00:00
Improve type of trapCaches now Language is non-exhaustive
This commit is contained in:
@@ -99,10 +99,7 @@ async function sendStatusReport(
|
||||
...report,
|
||||
trap_cache_upload_duration_ms: Math.round(trapCacheUploadTime || 0),
|
||||
trap_cache_upload_size_bytes: Math.round(
|
||||
await getTotalCacheSize(
|
||||
Object.values(config.trapCaches).filter((x) => x !== undefined),
|
||||
logger,
|
||||
),
|
||||
await getTotalCacheSize(Object.values(config.trapCaches), logger),
|
||||
),
|
||||
};
|
||||
await statusReport.sendStatusReport(trapCacheUploadStatusReport);
|
||||
|
||||
+3
-3
@@ -146,7 +146,7 @@ export interface Config {
|
||||
* Partial map from languages to locations of TRAP caches for that language.
|
||||
* If a key is omitted, then TRAP caching should not be used for that language.
|
||||
*/
|
||||
trapCaches: Partial<Record<Language, string>>;
|
||||
trapCaches: { [language: Language]: string };
|
||||
|
||||
/**
|
||||
* Time taken to download TRAP caches. Used for status reporting.
|
||||
@@ -537,10 +537,10 @@ async function downloadCacheWithTime(
|
||||
languages: Language[],
|
||||
logger: Logger,
|
||||
): Promise<{
|
||||
trapCaches: Partial<Record<Language, string>>;
|
||||
trapCaches: { [language: string]: string };
|
||||
trapCacheDownloadTime: number;
|
||||
}> {
|
||||
let trapCaches = {};
|
||||
let trapCaches: { [language: string]: string } = {};
|
||||
let trapCacheDownloadTime = 0;
|
||||
if (trapCachingEnabled) {
|
||||
const start = performance.now();
|
||||
|
||||
+1
-4
@@ -240,10 +240,7 @@ async function sendCompletedStatusReport(
|
||||
packs: JSON.stringify(packs),
|
||||
trap_cache_languages: Object.keys(config.trapCaches).join(","),
|
||||
trap_cache_download_size_bytes: Math.round(
|
||||
await getTotalCacheSize(
|
||||
Object.values(config.trapCaches).filter((x) => x !== undefined),
|
||||
logger,
|
||||
),
|
||||
await getTotalCacheSize(Object.values(config.trapCaches), logger),
|
||||
),
|
||||
trap_cache_download_duration_ms: Math.round(config.trapCacheDownloadTime),
|
||||
overlay_base_database_download_size_bytes:
|
||||
|
||||
+2
-2
@@ -50,8 +50,8 @@ export async function downloadTrapCaches(
|
||||
codeql: CodeQL,
|
||||
languages: Language[],
|
||||
logger: Logger,
|
||||
): Promise<Partial<Record<Language, string>>> {
|
||||
const result: Partial<Record<Language, string>> = {};
|
||||
): Promise<{ [language: string]: string }> {
|
||||
const result: { [language: string]: string } = {};
|
||||
const languagesSupportingCaching = await getLanguagesSupportingCaching(
|
||||
codeql,
|
||||
languages,
|
||||
|
||||
Reference in New Issue
Block a user