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 Jan 7, 2024
1 parent 31257e6 commit e82f46e
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 e82f46e

Please sign in to comment.