mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-21 22:59:07 +00:00
refactor: Fix formatting and add comments in ArrayUtil.ts and CopilotActionProcessingException.ts
This commit is contained in:
parent
a3f5e268b5
commit
0987634e54
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user