diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 37b0991f..ee1f6771 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -30,7 +30,7 @@ jobs: continue-on-error: true - name: Lint with ruff run: | - ruff src + ruff check src - name: Format with ruff run: | ruff format src --diff diff --git a/pyproject.toml b/pyproject.toml index 43fa5e2c..f14af123 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,10 @@ [tool.ruff] -line-length = 88 +line-length = 100 +src = ["src"] +target-version = "py311" -# Enable Pyflakes `E` and `F` codes by default. +# Enable only style-related checks by default. select = [ - # Pyflakes - "F", # Pycodestyle "E", "W", @@ -35,16 +35,30 @@ exclude = [ "node_modules", "venv", ] -per-file-ignores = {} # Allow unused variables when underscore-prefixed. dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" -# Assume Python 3.11. -target-version = "py311" - [tool.ruff.mccabe] # Unlike Flake8, default to a complexity level of 10. max-complexity = 10 -[tool.poetry.dependencies] \ No newline at end of file +[tool.ruff.isort] +known-first-party = ["src"] + +[tool.ruff.lint] +select = [ + "E", + "W", + "I001", +] +ignore = [] +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" + +[tool.ruff.lint.mccabe] +max-complexity = 10 + +[tool.ruff.lint.isort] +known-first-party = ["src"] + +[tool.poetry.dependencies] diff --git a/src/redis.py b/src/redis.py index cc358f7f..071cc793 100644 --- a/src/redis.py +++ b/src/redis.py @@ -3,7 +3,7 @@ import orjson -import redis.asyncio as aioredis +from redis import asyncio as aioredis from src.config import settings from src.models import CustomModel diff --git a/src/tgbot/handlers/reaction.py b/src/tgbot/handlers/reaction.py index ff917995..302696c7 100644 --- a/src/tgbot/handlers/reaction.py +++ b/src/tgbot/handlers/reaction.py @@ -1,14 +1,10 @@ -""" - Handle reactions on sent memes -""" +"""Handle reactions on sent memes.""" import asyncio import logging from telegram import Update -from telegram.ext import ( - ContextTypes, -) +from telegram.ext import ContextTypes from src.flows.rewards.daily import reward_user_for_daily_activity from src.recommendations.service import (