Skip to content

Commit 3ba019c

Browse files
committed
refactor: minor fixup
1 parent a28c669 commit 3ba019c

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

packages/core/src/codewhisperer/service/securityScanHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ export async function uploadArtifactToS3(
422422
}
423423
}
424424

425-
// // TODO: Refactor this
425+
// TODO: Refactor this
426426
export function getLoggerForScope(scope?: CodeWhispererConstants.CodeAnalysisScope) {
427427
return scope === CodeWhispererConstants.CodeAnalysisScope.FILE_AUTO ? getNullLogger() : getLogger()
428428
}

packages/core/src/codewhisperer/util/zipUtil.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const ZipConstants = {
5252
}
5353

5454
type ZipType = 'file' | 'project'
55-
type PayloadLimits = Record<ZipType, number>
55+
type PayloadLimits = Record<ZipType, number> & { [K in ZipType]: number }
5656

5757
export class ZipUtil {
5858
protected _pickedSourceFiles: Set<string> = new Set<string>()
@@ -199,7 +199,7 @@ export class ZipUtil {
199199

200200
await this.processSourceFiles(zip, languageCount, projectPaths, workspaceFolders, excludePatterns)
201201
if (options?.metadataDir) {
202-
await this.processMetadataDir(zip, options?.metadataDir)
202+
await this.processMetadataDir(zip, options.metadataDir)
203203
}
204204
if (options?.includeNonWorkspaceFiles) {
205205
this.processOtherFiles(zip, languageCount)
@@ -274,10 +274,7 @@ export class ZipUtil {
274274
) {
275275
const fileSize = Buffer.from(fileContent).length
276276

277-
if (
278-
this.aboveByteLimit(this._totalSize, 'project') ||
279-
this.willReachProjectByteLimit(this._totalSize, fileSize)
280-
) {
277+
if (this.willReachProjectByteLimit(this._totalSize, fileSize)) {
281278
throw new ProjectSizeExceededError()
282279
}
283280
this._pickedSourceFiles.add(uri.fsPath)
@@ -291,10 +288,7 @@ export class ZipUtil {
291288
protected async processBinaryFile(zip: ZipStream, uri: vscode.Uri, zipEntryPath: string) {
292289
const fileSize = (await fs.stat(uri.fsPath)).size
293290

294-
if (
295-
this.aboveByteLimit(this._totalSize, 'project') ||
296-
this.willReachProjectByteLimit(this._totalSize, fileSize)
297-
) {
291+
if (this.willReachProjectByteLimit(this._totalSize, fileSize)) {
298292
throw new ProjectSizeExceededError()
299293
}
300294
this._pickedSourceFiles.add(uri.fsPath)

0 commit comments

Comments
 (0)