Skip to content

Commit 1c3bb9b

Browse files
authored
Add pre-commit hooks (#36)
Add pre-commit hooks
1 parent 5df2b06 commit 1c3bb9b

27 files changed

+92
-48
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# https://github.com/PyCQA/flake8/issues/234
33
[flake8]
44
exclude = docs,venv
5-
max-line-length = 100
5+
max-line-length = 100

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ body:
2525
cachedir: .pytest_cache
2626
rootdir: /root/shared
2727
plugins: anyio-3.6.1, cov-3.0.0
28-
collected 1 item
28+
collected 1 item
2929
3030
test/test_code.py::test_addition PASSED
3131
============================================== 1 passed in 0.01s ===============================================
@@ -49,7 +49,7 @@ body:
4949
placeholder: i.e. "I'm Ubuntu 20.04" or "Im using Windows 11"
5050
- type: textarea
5151
id: extra
52-
attributes:
52+
attributes:
5353
label: Additional information
5454
description: If you have any additional information, please add it here.
5555
placeholder: You can drag and drop files here to attach them

.github/workflows/build_docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121

2222
- name: Install dependencies
2323
run: python -m pip install ".[test,docs]"
24-
24+
2525
- name: Build docs
2626
run: make doc
2727

@@ -32,4 +32,4 @@ jobs:
3232
uses: peaceiris/actions-gh-pages@v3
3333
with:
3434
github_token: ${{ secrets.GITHUB_TOKEN }}
35-
publish_dir: ${{ env.PUBLISH_DIR }}
35+
publish_dir: ${{ env.PUBLISH_DIR }}

.pre-commit-config.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.3.0
4+
hooks:
5+
- id: check-yaml
6+
- id: end-of-file-fixer
7+
- id: trailing-whitespace
8+
- id: check-docstring-first
9+
- id: debug-statements
10+
- id: requirements-txt-fixer
11+
12+
- repo: https://github.com/asottile/reorder_python_imports
13+
rev: v3.8.3
14+
hooks:
15+
- id: reorder-python-imports
16+
17+
- repo: https://github.com/psf/black
18+
rev: 22.8.0
19+
hooks:
20+
- id: black
21+
22+
- repo: https://github.com/pre-commit/pre-commit-hooks
23+
rev: v2.0.0
24+
hooks:
25+
- id: flake8
26+
27+
- repo: https://github.com/asottile/add-trailing-comma
28+
rev: v2.3.0
29+
hooks:
30+
- id: add-trailing-comma
31+
32+
- repo: https://github.com/asottile/setup-cfg-fmt
33+
rev: v2.0.0
34+
hooks:
35+
- id: setup-cfg-fmt
36+
37+
- repo: https://github.com/pre-commit/mirrors-mypy
38+
rev: v0.981
39+
hooks:
40+
- id: mypy

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ authors:
66
orcid: "https://orcid.org/0000-0001-6489-8858"
77
title: "Template for reproducible research"
88
version: 0.1.0
9-
date-released: 2022-09-13
9+
date-released: 2022-09-13

CONTRIBUTING.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# Contributing
22

3-
To contribute to this repository:
3+
To contribute to this repository:
44
1. Create a [fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) of the repository.
55
2. [Clone](https://docs.github.com/en/get-started/quickstart/fork-a-repo#cloning-your-forked-repository) the forked repository.
66
3. Checkout a new branch (using `git checkout -b name_of_branch`), where name of branch should be replaced by `your_github_username/description_of_feature`. For instance, `jorgensd/add_guidelines`.
77
4. Add your contribution and push it to your fork.
88
5. Make a [pull request from your fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork).
9-

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ USER root
3636
RUN chown -R ${NB_UID} ${HOME}
3737

3838
USER ${NB_USER}
39-
ENTRYPOINT []
39+
ENTRYPOINT []

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# List of Python demos (without file extenion) from the repo `demo` to include in the jupyterbook.
1+
# List of Python demos (without file extenion) from the repo `demo` to include in the jupyterbook.
22
# These files should be listed in `docs/_toc.yml`
33
DEMOS = demo
44

5-
doc: # Generate Sphinx HTML documentation, including API docs
5+
doc: # Generate Sphinx HTML documentation, including API docs
66
# We use --set-kernel with jupytext to make it possible for binder to pick it up
77
@for demo in ${DEMOS}; do \
88
jupytext --to=ipynb --set-kernel=python3 demo/$$demo.py --output=docs/$$demo.ipynb ;\

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@ The documentation for this repository can be found [here](https://jorgensd.githu
77
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/jorgensd/reproducibility/gh-pages?labpath=_sources)
88
[![Jupyter Book Badge](https://jupyterbook.org/badge.svg)](https://jorgensd.github.io/reproducibility)
99
[![MIT License](https://img.shields.io/github/license/jorgensd/reproducibility)](LICENSE)
10-

demo/demo.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,13 @@
44
#
55
# SPDX-License-Identifier: MIT
66
# -
7-
87
# + [markdown]
98
# We start a new cell explicitly by using the "+" sign and can explicitly end
109
# it by using the "-" sign.
1110
# -
12-
1311
# If we do not use explicit indicators for starting or ending a cell, it creates a
1412
# new cell whenever there is a blank line
15-
1613
# This is a new cell
17-
1814
# Comments can be added to code by not adding a new line before the code
1915
import mypackage
2016

0 commit comments

Comments
 (0)