Skip to content

Commit 7cb520b

Browse files
committed
Merge branch 'conf' of github.com:cadenmyers13/diffpy.pdfmorph into conf
2 parents 6498ebf + f2f9e7c commit 7cb520b

File tree

4 files changed

+61
-1
lines changed

4 files changed

+61
-1
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]

README.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,24 @@ rather than copied to a system directory, use ::
150150

151151
python -m pip install -e .
152152

153+
CONTRIBUTING
154+
------------------------------------------------------------------------
155+
We welcome contributors from the community. Please consider posting issues, and taking issues and posting PRs.
156+
157+
To ensure code quality and to prevent accidental commits into the default branch, please set up the use of our pre-commit
158+
hooks.
159+
160+
1. modify the permissions to executable on the bash script called ``prevent_commit_to_main.sh`` in this directory: ``chmod +x prevent_commit_to_main.sh``
161+
162+
2. install pre-commit in your working environment with ``conda install pre-commit``
163+
164+
3. initialize pre-commit (one time only) ``pre-commit install``
165+
166+
Thereafter your code will be linted by black and isort and checked against flake8 before you can commit.
167+
If it fails by black or isort, just rerun and it should pass (black and isort will modify the files so should
168+
pass after they are modified). If the flake8 test fails please see the error messages and fix them manually before
169+
trying to commit again
170+
153171

154172
CONTACTS
155173
------------------------------------------------------------------------

doc/manual/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# -- Path setup --------------------------------------------------------------
88

99
# If extensions (or modules to document with autodoc) are in another directory,
10-
# add these directories to sys.path here. If the directory is relative to the
10+
# add these directories to pathlib.Path here. If the directory is relative to the
1111
# documentation root, use os.path.abspath to make it absolute, like shown here.
1212
#
1313
import sys

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)