Skip to content

Commit 84665df

Browse files
committed
adding pre-commit .sh and .yaml files
1 parent 6306610 commit 84665df

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

.pre-commit-config.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
default_language_version:
2+
python: python3
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.4.0
6+
hooks:
7+
- id: check-yaml
8+
- id: end-of-file-fixer
9+
- id: trailing-whitespace
10+
- repo: https://github.com/ambv/black
11+
rev: 23.3.0
12+
hooks:
13+
- id: black
14+
- repo: https://github.com/pycqa/flake8
15+
rev: 6.0.0
16+
hooks:
17+
- id: flake8
18+
- repo: https://github.com/pycqa/isort
19+
rev: 5.12.0
20+
hooks:
21+
- id: isort
22+
args: ["--profile", "black"]
23+
- repo: https://github.com/kynan/nbstripout
24+
rev: 0.6.1
25+
hooks:
26+
- id: nbstripout
27+
- repo: local
28+
hooks:
29+
- id: prevent-commit-to-main
30+
name: Prevent Commit to Main Branch
31+
entry: ./prevent_commit_to_main.sh
32+
language: script
33+
stages: [commit]

prevent_commit_to_main.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
##!"C:\\Program Files\\Git\\usr\\bin\\bash.exe"
3+
4+
branch="$(git rev-parse --abbrev-ref HEAD)"
5+
6+
if [ "$branch" = "main" ]; then
7+
echo "You are on the main branch. Committing to the main branch is not allowed."
8+
exit 1
9+
fi

0 commit comments

Comments
 (0)