Skip to content

Commit d5c0f5b

Browse files
committed
feat: setup hooks in aaz-dev run
1 parent 97bf635 commit d5c0f5b

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/aaz_dev/app/run.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import subprocess
23
import webbrowser
34

45
import click
@@ -129,7 +130,7 @@ def is_port_in_use(host, port):
129130
)
130131
@pass_script_info
131132
def run_command(
132-
info, host, port, reload, debugger, with_threads, extra_files, quiet
133+
info, host, port, aaz_path, reload, debugger, with_threads, extra_files, quiet
133134
):
134135
"""Run a local development server.
135136
@@ -139,6 +140,8 @@ def run_command(
139140
The reloader and debugger are enabled by default if
140141
FLASK_ENV=development or FLASK_DEBUG=1.
141142
"""
143+
_change_git_hooks_path(aaz_path)
144+
142145
debug = get_debug_flag()
143146

144147
if reload is None:
@@ -169,3 +172,11 @@ def run_command(
169172
threaded=with_threads,
170173
extra_files=extra_files,
171174
)
175+
176+
177+
def _change_git_hooks_path(repo_path):
178+
# if .githooks folder exists in the repo folder, change the git config to use the .githooks folder in the repo
179+
githooks_path = os.path.join(repo_path, '.githooks')
180+
if os.path.exists(githooks_path):
181+
subprocess.check_call(['git', 'config', 'core.hooksPath', githooks_path])
182+
display(f"Changed git hooks path to {githooks_path}")

src/aaz_dev/command/api/_cmds.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,6 @@ def verify_command(file_path):
200200
json_path = os.path.join(Config.AAZ_PATH, os.path.splitext(path)[0][1:] + ".json")
201201
json_path = os.path.normpath(json_path)
202202

203-
if json_path in model_set:
204-
continue
205-
206203
if not os.path.exists(json_path):
207204
raise Exception(f"{json_path} defined in {file_path} is missing.")
208205

0 commit comments

Comments
 (0)