lint fixes

ruff added to dev dependencies

ruff badge added to readme
This commit is contained in:
onyx-and-iris 2023-10-29 09:40:10 +00:00
parent 2e1916eeaa
commit ce5936b740
8 changed files with 132 additions and 10 deletions

View File

@ -3,6 +3,7 @@
[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
![Tests Status](./tests/basic.svg?dummy=8484744)
![Tests Status](./tests/banana.svg?dummy=8484744)
![Tests Status](./tests/potato.svg?dummy=8484744)

28
poetry.lock generated
View File

@ -281,6 +281,32 @@ files = [
[package.dependencies]
pytest = ">=3.6"
[[package]]
name = "ruff"
version = "0.1.3"
description = "An extremely fast Python linter, written in Rust."
optional = false
python-versions = ">=3.7"
files = [
{file = "ruff-0.1.3-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:b46d43d51f7061652eeadb426a9e3caa1e0002470229ab2fc19de8a7b0766901"},
{file = "ruff-0.1.3-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:b8afeb9abd26b4029c72adc9921b8363374f4e7edb78385ffaa80278313a15f9"},
{file = "ruff-0.1.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ca3cf365bf32e9ba7e6db3f48a4d3e2c446cd19ebee04f05338bc3910114528b"},
{file = "ruff-0.1.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4874c165f96c14a00590dcc727a04dca0cfd110334c24b039458c06cf78a672e"},
{file = "ruff-0.1.3-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:eec2dd31eed114e48ea42dbffc443e9b7221976554a504767ceaee3dd38edeb8"},
{file = "ruff-0.1.3-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:dc3ec4edb3b73f21b4aa51337e16674c752f1d76a4a543af56d7d04e97769613"},
{file = "ruff-0.1.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2e3de9ed2e39160800281848ff4670e1698037ca039bda7b9274f849258d26ce"},
{file = "ruff-0.1.3-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1c595193881922cc0556a90f3af99b1c5681f0c552e7a2a189956141d8666fe8"},
{file = "ruff-0.1.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0f75e670d529aa2288cd00fc0e9b9287603d95e1536d7a7e0cafe00f75e0dd9d"},
{file = "ruff-0.1.3-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:76dd49f6cd945d82d9d4a9a6622c54a994689d8d7b22fa1322983389b4892e20"},
{file = "ruff-0.1.3-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:918b454bc4f8874a616f0d725590277c42949431ceb303950e87fef7a7d94cb3"},
{file = "ruff-0.1.3-py3-none-musllinux_1_2_i686.whl", hash = "sha256:d8859605e729cd5e53aa38275568dbbdb4fe882d2ea2714c5453b678dca83784"},
{file = "ruff-0.1.3-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:0b6c55f5ef8d9dd05b230bb6ab80bc4381ecb60ae56db0330f660ea240cb0d4a"},
{file = "ruff-0.1.3-py3-none-win32.whl", hash = "sha256:3e7afcbdcfbe3399c34e0f6370c30f6e529193c731b885316c5a09c9e4317eef"},
{file = "ruff-0.1.3-py3-none-win_amd64.whl", hash = "sha256:7a18df6638cec4a5bd75350639b2bb2a2366e01222825562c7346674bdceb7ea"},
{file = "ruff-0.1.3-py3-none-win_arm64.whl", hash = "sha256:12fd53696c83a194a2db7f9a46337ce06445fb9aa7d25ea6f293cf75b21aca9f"},
{file = "ruff-0.1.3.tar.gz", hash = "sha256:3ba6145369a151401d5db79f0a47d50e470384d0d89d0d6f7fab0b589ad07c34"},
]
[[package]]
name = "tomli"
version = "2.0.1"
@ -342,4 +368,4 @@ test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess
[metadata]
lock-version = "2.0"
python-versions = "^3.10"
content-hash = "4989717c148629166e597e8eea82d3f036f3dfd2e0ed15882260a621eff331aa"
content-hash = "bbd3efdc7021e984366e10de75444d9ae83c1af56840421250e83f93e4e7dfb0"

View File

@ -20,6 +20,7 @@ pytest-repeat = "^0.9.1"
black = "^22.3.0"
isort = "^5.10.1"
tox = "^4.6.3"
ruff = "^0.1.3"
[build-system]
requires = ["poetry-core>=1.0.0"]
@ -49,3 +50,97 @@ commands =
poetry install -v
poetry run pytest tests/
"""
[tool.black]
line-length = 88
[tool.ruff]
select = [
"E",
"F",
]
ignore = [
"E501",
]
fixable = [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"I",
"N",
"Q",
"S",
"T",
"W",
"ANN",
"ARG",
"BLE",
"COM",
"DJ",
"DTZ",
"EM",
"ERA",
"EXE",
"FBT",
"ICN",
"INP",
"ISC",
"NPY",
"PD",
"PGH",
"PIE",
"PL",
"PT",
"PTH",
"PYI",
"RET",
"RSE",
"RUF",
"SIM",
"SLF",
"TCH",
"TID",
"TRY",
"UP",
"YTT",
]
unfixable = []
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
]
line-length = 88
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
target-version = "py310"
[tool.ruff.mccabe]
max-complexity = 10
[tool.ruff.per-file-ignores]
"__init__.py" = [
"E402",
"F401",
]

View File

@ -16,7 +16,7 @@ class Event:
if self.any():
info += (f"now listening for {', '.join(self.get())} events",)
else:
info += (f"not listening for any events",)
info += ("not listening for any events",)
self.logger.info(", ".join(info))
@property

View File

@ -37,7 +37,7 @@ def get_vmpath():
try:
vm_parent = Path(get_vmpath()).parent
except FileNotFoundError as e:
raise InstallError(f"Unable to fetch DLL path from the registry") from e
raise InstallError("Unable to fetch DLL path from the registry") from e
DLL_NAME = f'VoicemeeterRemote{"64" if bits == 64 else ""}.dll'

View File

@ -70,7 +70,7 @@ class Patch(IRemote):
@property
def identifier(self) -> str:
return f"patch"
return "patch"
@property
def postfadercomp(self) -> bool:
@ -92,7 +92,7 @@ class Patch(IRemote):
class Asio(IRemote):
@property
def identifier(self) -> str:
return f"patch"
return "patch"
class AsioIn(Asio):

View File

@ -126,7 +126,7 @@ class Recorder(IRemote):
time_str = str(time_str) # coerce the type
if (
match := re.match(
re.match(
r"^(?:[01]\d|2[0123]):(?:[012345]\d):(?:[012345]\d)$",
time_str,
)
@ -135,7 +135,7 @@ class Recorder(IRemote):
self.setter("goto", get_sec())
else:
self.logger.warning(
f"goto expects a string that matches the format 'hh:mm:ss'"
"goto expects a string that matches the format 'hh:mm:ss'"
)
def filetype(self, val: str):

View File

@ -90,7 +90,7 @@ class PhysicalStrip(Strip):
"""
EFFECTS_cls = _make_effects_mixins(is_phys)[remote.kind.name]
return type(
f"PhysicalStrip",
"PhysicalStrip",
(cls, EFFECTS_cls),
{
"comp": StripComp(remote, i),
@ -337,7 +337,7 @@ class VirtualStrip(Strip):
"""
EFFECTS_cls = _make_effects_mixins(is_phys)[remote.kind.name]
return type(
f"VirtualStrip",
"VirtualStrip",
(cls, EFFECTS_cls),
{},
)
@ -491,7 +491,7 @@ class GainLayer(IRemote):
def _make_gainlayer_mixin(remote, index):
"""Creates a GainLayer mixin"""
return type(
f"GainlayerMixin",
"GainlayerMixin",
(),
{
"gainlayer": tuple(