From 6e998ab422e635bf28589ab852496cbebb2d179f Mon Sep 17 00:00:00 2001 From: Ev-1 <33662061+Ev-1@users.noreply.github.com> Date: Wed, 26 Apr 2023 22:16:35 +0200 Subject: [PATCH] Add ruff in place of isort and flake8 --- justfile | 16 +++------------- pyproject.toml | 10 ++++++++++ requirements.txt | 3 +++ setup.cfg | 12 ------------ 4 files changed, 16 insertions(+), 25 deletions(-) create mode 100644 pyproject.toml diff --git a/justfile b/justfile index a9baf00..16e1786 100644 --- a/justfile +++ b/justfile @@ -10,9 +10,6 @@ make_venv: python3.10 -m venv {{env_name}} {{python}} -m pip install --upgrade pip {{python}} -m pip install -r requirements.txt - {{python}} -m pip install flake8 - {{python}} -m pip install isort - {{python}} -m pip install pytest # Make the environment if it does not exit [private] @@ -30,17 +27,10 @@ debug: run clean: rm -rf {{env_name}} # Lint with flake8 -flake: venv - {{python}} -m flake8 bot.py musicbot -# Fix import order with isort -isort: venv - {{python}} -m isort --sp setup.cfg bot.py musicbot - -# Run both isort and flake8 -lint: venv - just isort - just flake +# Run ruff +lint: venv + ruff . --fix # Run tests test: venv diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..65b708c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,10 @@ +[tool.ruff] +# Allow lines to be as long as 120 characters. +select = ["F", "E", "B", "W", "I001"] +line-length = 120 + +[tool.ruff.isort] +section-order = ["future", "standard-library", "discord", "third-party", "first-party", "local-folder"] +[tool.ruff.isort.sections] +"discord" = ["discord", "lavalink"] + diff --git a/requirements.txt b/requirements.txt index 43aced9..ec0742f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,3 +3,6 @@ lavalink == 4.0.* asyncio pyyaml BeautifulSoup4 +pytest +ruff==0.0.263 +pre-commit diff --git a/setup.cfg b/setup.cfg index e5640bc..dfe3c01 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,18 +3,6 @@ max-line-length = 120 count = True statistics = True -[isort] -known_discord = discord,lavalink -known_utils = cogs.utils,cogs.helpformatter,musicbot.utils -import_heading_discord = Discord Packages -import_heading_utils = Bot Utilities -sections = FUTURE,DISCORD,STDLIB,THIRDPARTY,FIRSTPARTY,UTILS,LOCALFOLDER -no_lines_before = LOCALFOLDER -indent = " " -line_length = 120 -balanced_wrapping = True -multi_line_output = 4 - [pycodestyle] max_line_length = 120