Skip to content

Commit

Permalink
Allow code_format.py to run from any directory
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathonReinhart committed Dec 31, 2023
1 parent 20ed0f1 commit 48b69ef
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions code_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
import argparse
import black
import subprocess
from pathlib import Path

PROJECT_DIR = Path(__file__).parent.resolve()
SCUBAINIT_DIR = PROJECT_DIR / "scubainit"


def _run_black(fix: bool) -> bool:
args = [
".",
str(PROJECT_DIR),
]

if not fix:
Expand Down Expand Up @@ -38,7 +42,7 @@ def _rust_fmt(fix: bool) -> bool:
"--check",
]

status = subprocess.call(args, cwd="scubainit")
status = subprocess.call(args, cwd=SCUBAINIT_DIR)
if status == 0:
print("Ok")
return True
Expand Down

0 comments on commit 48b69ef

Please sign in to comment.