refactor: Fix formatting and add comments in ArrayUtil.ts and CopilotActionProcessingException.ts

This commit is contained in:
Simon Larsen 2024-06-23 21:37:36 +01:00
parent a3f5e268b5
commit 0987634e54
No known key found for this signature in database
GPG Key ID: 96C5DCA24769DBCA
3 changed files with 13 additions and 9 deletions

View File

@ -12,15 +12,18 @@ export default class ArrayUtil {
for (let i: number = shuffledArray.length - 1; i > 0; i--) {
const j: number = Math.floor(Math.random() * (i + 1));
if(!shuffledArray[i]){
if (!shuffledArray[i]) {
continue;
}
if(!shuffledArray[j]){
if (!shuffledArray[j]) {
continue;
}
[shuffledArray[i] as any, shuffledArray[j] as any] = [shuffledArray[j], shuffledArray[i]];
[shuffledArray[i] as any, shuffledArray[j] as any] = [
shuffledArray[j],
shuffledArray[i],
];
}
return shuffledArray;
}

View File

@ -2,7 +2,7 @@ import Exception from "Common/Types/Exception/Exception";
import ExceptionCode from "Common/Types/Exception/ExceptionCode";
export default class CopilotActionProcessingException extends Exception {
public constructor(code: ExceptionCode, message: string) {
super(code, message);
}
}
public constructor(code: ExceptionCode, message: string) {
super(code, message);
}
}

View File

@ -43,7 +43,9 @@ const init: PromiseVoidFunction = async (): Promise<void> => {
}`,
);
const files: Array<CodeRepositoryFile> = ArrayUtil.shuffle(Object.values(filesInService)); // shuffle the files to avoid fixing the same file in each run.
const files: Array<CodeRepositoryFile> = ArrayUtil.shuffle(
Object.values(filesInService),
); // shuffle the files to avoid fixing the same file in each run.
for (const file of files) {
checkIfCurrentFixCountIsLessThanFixNumberOfCodeEventsInEachRun();
@ -125,7 +127,6 @@ const init: PromiseVoidFunction = async (): Promise<void> => {
});
} catch (e) {
if (e instanceof CopilotActionProcessingException) {
// This is not a serious exception, so we just move on to the next file.
logger.info(e.message);
continue;