Add ruff formatter

This commit is contained in:
Justin Myers 2024-03-23 07:52:54 -07:00
parent 1b0c94a386
commit be5546c661
6 changed files with 22 additions and 36 deletions

5
.gitattributes vendored Normal file
View file

@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: 2024 Justin Myers for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
* text eol=lf

View file

@ -1,42 +1,19 @@
# SPDX-FileCopyrightText: 2020 Diego Elio Pettenò
# SPDX-FileCopyrightText: 2024 Justin Myers for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
repos:
- repo: https://github.com/python/black
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/fsfe/reuse-tool
rev: v1.1.2
hooks:
- id: reuse
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pycqa/pylint
rev: v2.17.4
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.4
hooks:
- id: pylint
name: pylint (library code)
types: [python]
args:
- --disable=consider-using-f-string
exclude: "^(docs/|examples/|tests/|setup.py$)"
- id: pylint
name: pylint (example code)
description: Run pylint rules on "examples/*.py" files
types: [python]
files: "^examples/"
args:
- --disable=missing-docstring,invalid-name,consider-using-f-string,duplicate-code
- id: pylint
name: pylint (test code)
description: Run pylint rules on "tests/*.py" files
types: [python]
files: "^tests/"
args:
- --disable=missing-docstring,consider-using-f-string,duplicate-code
- id: ruff-format
- repo: https://github.com/fsfe/reuse-tool
rev: v3.0.1
hooks:
- id: reuse

View file

@ -20,6 +20,7 @@ Implementation Notes
https://github.com/adafruit/circuitpython/releases
"""
import gc
import time
import terminalio

View file

@ -100,9 +100,7 @@ class GraphicsBase:
self._bg_group.append(self._bg_sprite)
gc.collect()
def qrcode(
self, qr_data, *, qr_size=1, x=0, y=0, qr_color=0x000000
): # pylint: disable=invalid-name
def qrcode(self, qr_data, *, qr_size=1, x=0, y=0, qr_color=0x000000): # pylint: disable=invalid-name
"""Display a QR code
:param qr_data: The data for the QR code, None to remove.

View file

@ -9,7 +9,6 @@ See MatrixPortal, MagTag, and PyPortal libraries for more examples.
# NOTE: Make sure you've created your secrets.py file before running this example
# https://learn.adafruit.com/adafruit-pyportal/internet-connect#whats-a-secrets-file-17-2
import board
import displayio
from adafruit_pyportal import PyPortal

View file

@ -41,6 +41,12 @@ classifiers = [
]
dynamic = ["dependencies", "optional-dependencies"]
[tool.ruff]
target-version = "py38"
[tool.ruff.format]
line-ending = "lf"
[tool.setuptools]
packages = ["adafruit_portalbase"]