Skip to content

Commit 5915317

Browse files
committed
Add pre-commit configuration to the cookiecutter template.
This uses the same configuration from https://github.com/adafruit/Adafruit_CircuitPython_TestRepo, using pre-commit instead of black as part of the CI.
1 parent d935014 commit 5915317

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

{{ cookiecutter.library_name }}/.github/workflows/build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ jobs:
4242
# (e.g. - apt-get: gettext, etc; pip: circuitpython-build-tools, requirements.txt; etc.)
4343
run: |
4444
source actions-ci/install.sh
45-
- name: Pip install pylint, black, & Sphinx
45+
- name: Pip install pylint, Sphinx, pre-commit
4646
run: |
47-
pip install --force-reinstall pylint black==19.10b0 Sphinx sphinx-rtd-theme
47+
pip install --force-reinstall pylint Sphinx sphinx-rtd-theme pre-commit
4848
- name: Library version
4949
run: git describe --dirty --always --tags
50-
- name: Check formatting
50+
- name: Pre-commit hooks
5151
run: |
52-
black --check --target-version=py35 .
52+
pre-commit run --all-files
5353
- name: PyLint
5454
run: |
5555
pylint $( find . -path './adafruit*.py' )
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
5+
repos:
6+
- repo: https://github.com/python/black
7+
rev: 19.10b0
8+
hooks:
9+
- id: black
10+
- repo: https://github.com/fsfe/reuse-tool
11+
rev: latest
12+
hooks:
13+
- id: reuse
14+
- repo: https://github.com/pre-commit/pre-commit-hooks
15+
rev: v2.3.0
16+
hooks:
17+
- id: check-yaml
18+
- id: end-of-file-fixer
19+
- id: trailing-whitespace
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
5+
[tool.black]
6+
target-version = ['py35']

0 commit comments

Comments
 (0)