Skip to content

Commit 9476062

Browse files
authored
Merge pull request #3 from adafruit/patch
Pylint and RTD update patch, and other fixes
2 parents 40c80c3 + 7eca570 commit 9476062

File tree

5 files changed

+33
-17
lines changed

5 files changed

+33
-17
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ 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, pre-commit
4646
run: |
47-
pip install --force-reinstall pylint Sphinx sphinx-rtd-theme pre-commit
47+
pip install --force-reinstall Sphinx sphinx-rtd-theme pre-commit
4848
- name: Library version
4949
run: git describe --dirty --always --tags
5050
#- name: Pre-commit hooks

.pre-commit-config.yaml

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
repos:
66
- repo: https://github.com/python/black
7-
rev: latest
7+
rev: 20.8b1
88
hooks:
99
- id: black
1010
- repo: https://github.com/fsfe/reuse-tool
11-
rev: latest
11+
rev: v0.12.1
1212
hooks:
1313
- id: reuse
1414
- repo: https://github.com/pre-commit/pre-commit-hooks
@@ -18,17 +18,25 @@ repos:
1818
- id: end-of-file-fixer
1919
- id: trailing-whitespace
2020
- repo: https://github.com/pycqa/pylint
21-
rev: pylint-2.7.1
21+
rev: v2.11.1
2222
hooks:
2323
- id: pylint
2424
name: pylint (library code)
2525
types: [python]
26-
exclude: "^(docs/|examples/|setup.py$)"
27-
- repo: local
28-
hooks:
29-
- id: pylint_examples
30-
name: pylint (examples code)
26+
args:
27+
- --disable=consider-using-f-string
28+
exclude: "^(docs/|examples/|tests/|setup.py$)"
29+
- id: pylint
30+
name: pylint (example code)
3131
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,consider-using-f-string $example; done)']
34-
language: system
32+
types: [python]
33+
files: "^examples/"
34+
args:
35+
- --disable=missing-docstring,invalid-name,consider-using-f-string,duplicate-code
36+
- id: pylint
37+
name: pylint (test code)
38+
description: Run pylint rules on "tests/*.py" files
39+
types: [python]
40+
files: "^tests/"
41+
args:
42+
- --disable=missing-docstring,consider-using-f-string,duplicate-code

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ ignore-docstrings=yes
252252
ignore-imports=yes
253253

254254
# Minimum lines number of a similarity.
255-
min-similarity-lines=12
255+
min-similarity-lines=4
256256

257257

258258
[BASIC]

adafruit_mlx90395.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
from time import sleep
4242
from struct import unpack_from
4343
from micropython import const
44-
import adafruit_bus_device.i2c_device as i2c_device
44+
from adafruit_bus_device import i2c_device
4545

4646
# from adafruit_register.i2c_struct import ROUnaryStruct, Struct
4747
from adafruit_register.i2c_bits import RWBits
@@ -166,7 +166,10 @@ class MLX90395:
166166
_resolution = RWBits(2, _REG_2, 5, 2, False)
167167
_filter = RWBits(3, _REG_2, 2, 2, False)
168168
_osr = RWBits(2, _REG_2, 0, 2, False)
169-
_reg0 = UnaryStruct(_REG_0, ">H",)
169+
_reg0 = UnaryStruct(
170+
_REG_0,
171+
">H",
172+
)
170173
_reg2 = UnaryStruct(_REG_2, ">H")
171174

172175
def __init__(self, i2c_bus, address=_DEFAULT_ADDR):
@@ -245,7 +248,7 @@ def magnetic(self):
245248
def _read_measurement(self):
246249

247250
# clear the buffer
248-
for i in range(len(self._buffer)):
251+
for i in range(len(self._buffer)): # pylint: disable=consider-using-enumerate
249252
self._buffer[i] = 0
250253
self._buffer[0] = 0x80 # read memory command
251254

docs/requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
5+
sphinx>=4.0.0

0 commit comments

Comments
 (0)