Skip to content

Commit

Permalink
Create an installer for the pre-commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
Parris, Stephen authored and Parris, Stephen committed Nov 22, 2023
1 parent ddfbd89 commit 015c86e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
7 changes: 7 additions & 0 deletions xgitguard/executables/create_install_files_zip
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pyinstaller ../git-precommit-hook/xgitguard_precommit_cred_detections.py --hidden-import=sklearn.feature_extraction.text --hidden-import=urlextract --hidden-import=sklearn.model_selection --hidden-import=sklearn.ensemble

zip -r xgitguard-precommit-hook.zip pre-commit
cd dist/xgitguard_precommit_cred_detections
zip -r ../../xgitguard-precommit-hook.zip xgitguard_precommit_cred_detections
zip -r ../../xgitguard-precommit-hook.zip _internal
chmod 777 ../../xgitguard-precommit-hook.zip
4 changes: 2 additions & 2 deletions xgitguard/executables/pre-commit
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
results=$(python3 /Users/sparri919/Documents/GitHub/xGitGuard/xgitguard/git-precommit-hook/precommit_cred_detections.py -l 40)
results=$(~/gitconfig/hooks/xgitguard_precommit_cred_detections)
echo "$results"
if grep -q "no-verify" <<< "$results"; then
exit 1;
else
exit 0;
fi
fi
4 changes: 4 additions & 0 deletions xgitguard/executables/xgitguard-pre-commit-installer
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
git config --global ~/gitconfig
mkdir -p ~/gitconfig
mkdir -p ~/gitconfig/hooks
unzip xgitguard-precommit-hook.zip -d ~/gitconfig/hooks
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ def arg_parser():
metavar="Logger Level",
action="store",
type=int,
default=20,
default=40,
choices=log_level_choices,
help="Pass the Logging level as for CRITICAL - 50, ERROR - 40 WARNING - 30 INFO - 20 DEBUG - 10. Default is 20",
)
Expand Down Expand Up @@ -625,7 +625,7 @@ def arg_parser():
if args.log_level in log_level_choices:
log_level = args.log_level
else:
log_level = 20
log_level = 40
if args.console_logging.lower() in flag_choices[:5]:
console_logging = True
else:
Expand All @@ -641,6 +641,7 @@ def arg_parser():
)

if __name__ == "__main__":
multiprocessing.freeze_support()
(
secondary_keywords,
extensions,
Expand Down

0 comments on commit 015c86e

Please sign in to comment.