Skip to content

Commit 8a527d9

Browse files
Upgrade tooling to use ruff+black over isort/black (#59)
* Add recommended extensions for tooling * update deps for ruff * run ruff * add git blame ignore revs * fix gh action to use ruff
1 parent 8d3b308 commit 8a527d9

32 files changed

+416
-375
lines changed

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# run ruff
2+
174ab9e3d7bc643805ac97acf71a225dd9523977

.github/workflows/coverage_and_lint.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,5 @@ jobs:
7171
no-comments: ${{ matrix.python-version != '3.x' }}
7272

7373
- name: Lint
74-
uses: github/super-linter/slim@v4
75-
env:
76-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77-
DEFAULT_BRANCH: main
78-
VALIDATE_ALL_CODEBASE: false
79-
VALIDATE_PYTHON_BLACK: true
80-
VALIDATE_PYTHON_ISORT: true
81-
LINTER_RULES_PATH: /
82-
PYTHON_ISORT_CONFIG_FILE: pyproject.toml
83-
PYTHON_BLACK_CONFIG_FILE: pyproject.toml
74+
if: ${{ always() && steps.install-deps.outcome == 'success' }}
75+
uses: chartboost/ruff-action@v1

.vscode/extensions.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"recommendations": [
3+
"ms-python.python",
4+
"ms-python.vscode-pylance",
5+
"charliermarsh.ruff",
6+
"ms-python.black-formatter"
7+
]
8+
}

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ which will enable all services and snekbox.
4343

4444
This also means that it will use internal docker networking to resolve the database and snekbox names. By default these will be `database` and `snekbox`, but these will be the **service names** in `docker-compose.yml` if you change them. Please keep this in mind when editing your config file.
4545

46+
We also provide a file for ignoring git blame references. You can enable this with:-
47+
```sh
48+
git config blame.ignoreRevsFile .git-blame-ignore-revs
49+
```
50+
4651
### Support
4752

4853
As this bot is not really designed for use outside of our Guild, support provided will be **very** limited.

constants/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,4 @@
2222
"""
2323
from .constants import *
2424

25-
2625
GUILD_ID: int = 490948346773635102

constants/_meta.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
import toml
2828

29-
3029
if TYPE_CHECKING:
3130
from typing_extensions import Self
3231

constants/constants.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"""
2323
from ._meta import CONSTANTS
2424

25-
2625
__all__ = (
2726
"Roles",
2827
"Colours",

core/bot.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,24 @@
3131
from collections import deque
3232
from typing import TYPE_CHECKING, Any
3333

34-
import aiohttp
35-
import asyncpg
3634
import discord
3735
from discord.ext import commands
38-
from discord.ext.commands.cog import Cog # type: ignore # stubs
3936

4037
from constants import GUILD_ID
4138

4239
from .context import Context
4340
from .core import CONFIG
44-
from .utils import LogHandler
45-
4641

4742
if TYPE_CHECKING:
4843
from asyncio import Queue
4944
from logging import LogRecord
5045

46+
import aiohttp
47+
import asyncpg
5148
import mystbin
49+
from discord.ext.commands.cog import Cog # type: ignore # stubs
50+
51+
from .utils import LogHandler
5252

5353

5454
class Bot(commands.Bot):
@@ -67,7 +67,7 @@ class Bot(commands.Bot):
6767
"_previous_websocket_events",
6868
)
6969

70-
def __init__(self):
70+
def __init__(self) -> None:
7171
super().__init__(
7272
command_prefix=commands.when_mentioned_or(CONFIG["prefix"]),
7373
intents=discord.Intents.all(),

core/checks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
from discord.ext import commands
2828

2929
import constants
30-
from core.context import GuildContext
31-
3230

3331
if TYPE_CHECKING:
3432
from discord.ext.commands._types import Check # type: ignore # why would this need stubs
3533

34+
from core.context import GuildContext
35+
3636

3737
def is_role_or_higher(role_id: int) -> Check[Any]:
3838
def predicate(ctx: GuildContext) -> bool:

core/context.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
from constants import GUILD_ID, Roles
99

10-
1110
if TYPE_CHECKING:
1211
from .bot import Bot
1312

0 commit comments

Comments
 (0)