From 5eed02dfe80cedeccf3597c446d5ea136509194b Mon Sep 17 00:00:00 2001 From: Guillaume Date: Tue, 16 Apr 2024 14:09:32 -0400 Subject: [PATCH] chore: formatting --- captain/routes/test_profile.py | 10 +++++----- src/renderer/hooks/useTestSequencerProject.ts | 1 - src/renderer/hooks/useTestSequencerState.ts | 14 ++++++++------ src/renderer/lib/api.ts | 5 +---- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/captain/routes/test_profile.py b/captain/routes/test_profile.py index 790bbdb72..20aadeaf0 100644 --- a/captain/routes/test_profile.py +++ b/captain/routes/test_profile.py @@ -97,7 +97,7 @@ async def checkout(url: Annotated[str, Header()], commit_hash: str): def get_profile_path_from_url(profiles_path: str, url: str): - """ Get the profile directory name from the url """ + """Get the profile directory name from the url""" profile_name = url.split("/")[-1].strip(".git") logging.info(f"Profile name: {profile_name}") profile_root = os.path.join(profiles_path, profile_name) @@ -105,7 +105,7 @@ def get_profile_path_from_url(profiles_path: str, url: str): def verify_git_install(): - """ Verify if git is installed on the system """ + """Verify if git is installed on the system""" cmd = ["git", "--version"] res = subprocess.run(cmd, capture_output=True) if res.returncode != 0: @@ -120,7 +120,7 @@ def get_profiles_dir(): def get_commit_hash(profile_path: str): - """ Get the commit hash of the current env. """ + """Get the commit hash of the current env.""" cmd = ["git", "-C", profile_path, "rev-parse", "HEAD"] res = subprocess.run(cmd, capture_output=True) if res.returncode != 0: @@ -131,9 +131,9 @@ def get_commit_hash(profile_path: str): def update_to_origin_main(profile_path: str): - """ Update the local repo to the lastest version """ + """Update the local repo to the lastest version""" logging.info("Updating the repo to the origin main") - + # Verify the repo is clean (no changes so the user doesn't lose any work) cmd = ["git", "-C", profile_path, "status", "--porcelain"] res = subprocess.run(cmd, capture_output=True) diff --git a/src/renderer/hooks/useTestSequencerProject.ts b/src/renderer/hooks/useTestSequencerProject.ts index 67b20c305..5e5938aa6 100644 --- a/src/renderer/hooks/useTestSequencerProject.ts +++ b/src/renderer/hooks/useTestSequencerProject.ts @@ -187,7 +187,6 @@ export const useLoadTestProfile = () => { success: () => `Test Profile imported`, error: (e) => `${e}`, }); - }; return handleImport; diff --git a/src/renderer/hooks/useTestSequencerState.ts b/src/renderer/hooks/useTestSequencerState.ts index 91fce4e39..4e461f697 100644 --- a/src/renderer/hooks/useTestSequencerState.ts +++ b/src/renderer/hooks/useTestSequencerState.ts @@ -426,13 +426,15 @@ export function useSequencerState() { toast.warning("Stopping sequencer after this test."); sender(testSequenceStopRequest(tree)); // Paused test and never not yet run - setElements(produce(elements, (draft) => { - for (const el of draft) { - if (el.type === "test" && el.status === "paused") { - el.status = "pending"; + setElements( + produce(elements, (draft) => { + for (const el of draft) { + if (el.type === "test" && el.status === "paused") { + el.status = "pending"; + } } - } - })); + }), + ); setIsLocked(false); } diff --git a/src/renderer/lib/api.ts b/src/renderer/lib/api.ts index 5b543355b..964886a8f 100644 --- a/src/renderer/lib/api.ts +++ b/src/renderer/lib/api.ts @@ -179,10 +179,7 @@ export type Part = z.infer; const Project = z.object({ label: z.string(), value: z.string(), - repoUrl: z - .string() - .nullable() - .transform((value) => value ?? ""), + repoUrl: z.string().default(""), part: Part, productName: z.string(), });