Skip to content

Commit

Permalink
Move black testing definition as part of pre-commit.
Browse files Browse the repository at this point in the history
For this to work, the black command line options need to be replaced with a
pyproject.toml file defining the settings, that can be reused.
  • Loading branch information
Flameeyes committed May 15, 2020
1 parent dacd34a commit c3d9450
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,19 @@ jobs:
# (e.g. - apt-get: gettext, etc; pip: circuitpython-build-tools, requirements.txt; etc.)
run: |
source actions-ci/install.sh
- name: Pip install pylint, black, Sphinx, pre-commit
- name: Pip install pylint, Sphinx, pre-commit
run: |
pip install --force-reinstall pylint black==19.10b0 Sphinx sphinx-rtd-theme pre-commit
pip install --force-reinstall pylint Sphinx sphinx-rtd-theme pre-commit
- name: Library version
run: git describe --dirty --always --tags
- name: Pre-commit hooks
run: |
pre-commit install
pre-commit run --all-files
- name: Check formatting
run: |
black --check --target-version=py35 .
- name: PyLint
run: |
pylint $( find . -path './adafruit*.py' )
([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,bad-whitespace $( find . -path "./examples/*.py" ))
- name: Check formatting
run: |
black --check --target-version=py35 .
- name: Build assets
run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location .
- name: Build docs
Expand Down
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
# SPDX-License-Identifier: Unlicense

repos:
- repo: https://github.com/python/black
rev: 19.10b0
hooks:
- id: black
- repo: https://github.com/fsfe/reuse-tool
rev: latest
hooks:
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
#
# SPDX-License-Identifier: Unlicense

[tool.black]
target-version = ['py35']

0 comments on commit c3d9450

Please sign in to comment.