Skip to content

Commit e975ba3

Browse files
Merge pull request #251 from MaddyGuthridge/maddy-update-linting
Linting: switch from Flake8 to Ruff
2 parents 42a1a5c + da9d664 commit e975ba3

241 files changed

Lines changed: 1285 additions & 1223 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/python-app.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ jobs:
4747
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
4848
- run: poetry --version
4949
- run: poetry install
50-
- name: Lint with flake8
50+
- name: Lint with ruff
5151
run: |
52-
poetry run flake8
52+
poetry run ruff check
5353
5454
Mypy:
5555
runs-on: ubuntu-latest
@@ -70,7 +70,7 @@ jobs:
7070
- run: poetry install
7171
- name: Lint with mypy
7272
run: |
73-
poetry run mypy .
73+
poetry run mypy
7474
7575
Load:
7676
runs-on: ubuntu-latest

poetry.lock

Lines changed: 29 additions & 104 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,24 @@ exclude_also = [
2626
'raise NotImplementedError',
2727
]
2828

29-
[tool.flake8]
30-
exclude = ['.git', '__pycache__', 'dist', 'site']
29+
[tool.ruff]
30+
line-length = 79
31+
32+
[tool.ruff.lint]
33+
select = [
34+
# pycodestyle
35+
"E",
36+
# Pyflakes
37+
"F",
38+
# pyupgrade
39+
"UP",
40+
# flake8-bugbear
41+
"B",
42+
# flake8-simplify
43+
"SIM",
44+
# isort
45+
"I",
46+
]
3147

3248
[tool.poetry.dependencies]
3349
python = "^3.9.1"
@@ -37,13 +53,10 @@ jestspectation = "^1.4.5"
3753

3854
[tool.poetry.group.dev.dependencies]
3955
coverage = "^7.8.0"
40-
flake8 = "^7.1.1"
41-
isort = "^6.0.1"
4256
mypy = "^1.15.0"
4357
pytest = "^8.3.5"
44-
autopep8 = "^2.3.2"
4558
jestspectation = "^1.4.5"
46-
flake8-pyproject = "^1.2.3"
59+
ruff = "^0.11.7"
4760

4861
[build-system]
4962
requires = ["poetry-core"]

src/common/__init__.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,20 @@
2626
]
2727

2828

29-
from . import exceptions
30-
from .logger import log, verbosity
31-
from .profiler import ProfilerContext, profilerDecoration
29+
# Import devices and plugins
30+
import devices
31+
import integrations
3232

33+
from . import exceptions
3334
from .context_manager import (
35+
catchContextResetException,
3436
getContext,
3537
resetContext,
3638
unsafeResetContext,
37-
catchContextResetException
3839
)
39-
4040
from .extension_manager import ExtensionManager
41-
42-
# Import devices and plugins
43-
import devices
44-
import integrations
41+
from .logger import log, verbosity
42+
from .profiler import ProfilerContext, profilerDecoration
4543

4644
del devices
4745
del integrations

src/common/activity_state.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,23 @@
1212
"""
1313

1414
from typing import Optional
15+
16+
import plugins
1517
import ui
16-
from common.profiler import profilerDecoration
18+
1719
from common.plug_indexes import (
18-
PluginIndex,
19-
GeneratorIndex,
2020
EffectIndex,
21-
WindowIndex,
2221
FlIndex,
22+
GeneratorIndex,
23+
PluginIndex,
24+
WindowIndex,
2325
)
26+
from common.profiler import profilerDecoration
27+
from common.types.bool_s import BoolS
2428
from common.util.api_fixes import (
2529
getFocusedPluginIndex,
2630
getFocusedWindowIndex,
2731
)
28-
from common.types.bool_s import BoolS
29-
import plugins
3032

3133

3234
class ActivityState:
@@ -45,7 +47,7 @@ def __init__(self) -> None:
4547
self._effect: EffectIndex = EffectIndex(0, 0)
4648
self._plugin: PluginIndex = self._generator
4749
self._plugin_name = ""
48-
self._plug_active = True if self._plugin is not None else False
50+
self._plug_active = self._plugin is not None
4951
self._changed = False
5052
self._plug_unsafe = False
5153
self._history: list[FlIndex] = []

0 commit comments

Comments
 (0)