Skip to content

Commit c0faca0

Browse files
authored
Merge pull request #3 from FoamyGuy/pylint_to_pre_commit
pylint to precommit
2 parents 25f8de0 + 28c6f5e commit c0faca0

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ jobs:
5050
- name: Pre-commit hooks
5151
run: |
5252
pre-commit run --all-files
53-
- name: PyLint
54-
run: |
55-
pylint $( find . -path './adafruit*.py' )
56-
([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,bad-whitespace $( find . -path "./examples/*.py" ))
5753
- name: Run tests
5854
run: |
5955
cd tests/ && python -m unittest discover

.pre-commit-config.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,26 @@ 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.7.1
22+
hooks:
23+
- id: pylint
24+
name: pylint (library code)
25+
types: [python]
26+
exclude: "^(docs/|tests/|examples/|setup.py$)"
27+
- repo: local
28+
hooks:
29+
- id: pylint_examples
30+
name: pylint (examples code)
31+
description: Run pylint rules on "examples/*.py" files
32+
entry: /usr/bin/env bash -c
33+
args: ['([[ ! -d "examples" ]] || for example in $(find . -path "./examples/*.py"); do pylint --disable=missing-docstring,invalid-name $example; done)']
34+
language: system
35+
- repo: local
36+
hooks:
37+
- id: pylint_tests
38+
name: pylint (tests code)
39+
description: Run pylint rules on "tests/*.py" files
40+
entry: /usr/bin/env bash -c
41+
args: ['([[ ! -d "tests" ]] || for test in $(find . -path "./tests/*.py"); do pylint --disable=missing-docstring $test; done)']
42+
language: system

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ ignore-comments=yes
250250
ignore-docstrings=yes
251251

252252
# Ignore imports when computing similarities.
253-
ignore-imports=no
253+
ignore-imports=yes
254254

255255
# Minimum lines number of a similarity.
256256
min-similarity-lines=4

0 commit comments

Comments
 (0)