Skip to content

Commit 97ba42e

Browse files
authored
Merge pull request #4 from jepler/lint-in-precommit
switch pylint to pre-commit
2 parents 5c0c42a + b8115ff commit 97ba42e

File tree

3 files changed

+36
-9
lines changed

3 files changed

+36
-9
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,11 @@ 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, Sphinx, pre-commit
45+
- name: Pip install Sphinx
4646
run: |
47-
pip install --force-reinstall pylint Sphinx sphinx-rtd-theme pre-commit sphinx-autoapi
47+
pip install --force-reinstall Sphinx sphinx-rtd-theme sphinx-autoapi
4848
- name: Library version
4949
run: git describe --dirty --always --tags
50-
- name: Pre-commit hooks
51-
run: |
52-
pre-commit run --all-files
53-
- name: PyLint
54-
run: |
55-
pylint $( find . -path './jepler*.py' )
56-
([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,bad-whitespace $( find . -path "./examples/*.py" ))
5750
- name: Clone and build circuitpython unix port
5851
run: |
5952
set -e

.github/workflows/pre-commit.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2019 Anthony Sottile
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
name: pre-commit
6+
7+
on: [pull_request, push]
8+
9+
jobs:
10+
pre-commit:
11+
runs-on: ubuntu-20.04
12+
steps:
13+
- uses: actions/checkout@v1
14+
- uses: actions/setup-python@v1
15+
- name: set PY
16+
run: echo >>$GITHUB_ENV "PY=$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')"
17+
- uses: actions/cache@v1
18+
with:
19+
path: ~/.cache/pre-commit
20+
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
21+
- uses: pre-commit/action@v1.1.0

.pre-commit-config.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,16 @@ repos:
1717
- id: check-yaml
1818
- id: end-of-file-fixer
1919
- id: trailing-whitespace
20+
- repo: https://github.com/pycqa/pylint
21+
rev: pylint-2.6.0
22+
hooks:
23+
- id: pylint
24+
name: lint (examples)
25+
types: [python]
26+
files: ^examples/
27+
args:
28+
- --disable=missing-docstring,invalid-name,bad-whitespace
29+
- id: pylint
30+
name: lint (code)
31+
types: [python]
32+
exclude: "^(docs/|examples/|setup.py$)"

0 commit comments

Comments
 (0)