From 7e6233e72ec6a8117bb458d8aca13a68b6257700 Mon Sep 17 00:00:00 2001 From: RGBCube <78925721+RGBCube@users.noreply.github.com> Date: Fri, 27 Jan 2023 20:27:02 +0300 Subject: [PATCH] clean: linting --- .github/workflows/lint.yml | 50 ------------------------------- .github/workflows/scripts/lint.py | 25 ---------------- lint.sh | 20 ------------- pyproject.toml | 17 ----------- 4 files changed, 112 deletions(-) delete mode 100644 .github/workflows/lint.yml delete mode 100644 .github/workflows/scripts/lint.py delete mode 100755 lint.sh diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index ee67dfe..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Lint - -on: - - pull_request - - push - -env: - python-version: "3.10" - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout Repository - uses: actions/checkout@v3 - - - name: Set up Python ${{ env.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ env.python-version }} - - - name: Install Unimport, Isort, Black, and Flynt - run: pip install -U pip unimport isort black flynt - - - name: Run Unimport - continue-on-error: true - run: unimport ./ --ignore-init --gitignore -r - - - name: Run Isort - run: | - isort ./ - python ./.github/workflows/scripts/lint.py - - - name: Run Black - run: black ./ - - - name: Run Flynt - run: flynt ./ -tc - - - name: Setup Git - run: git config --global user.name "Automated Linter" - - - name: Push To GitHub - continue-on-error: true - run: | - git pull - git add ./ - git commit --amend - git push diff --git a/.github/workflows/scripts/lint.py b/.github/workflows/scripts/lint.py deleted file mode 100644 index db5879c..0000000 --- a/.github/workflows/scripts/lint.py +++ /dev/null @@ -1,25 +0,0 @@ -from __future__ import annotations - -from pathlib import Path - -ROOT_DIR = Path(__file__).resolve().parent.parent.parent.parent / "minearchy_bot" - -for fp in ROOT_DIR.rglob("__init__.py"): - if fp.parent.name == "minearchy_bot": - continue - - if not (content := fp.read_text()): - continue - - old_content = content[:] - - while content[0] == "\n": - content = content[1:] - - content = content.removeprefix("from __future__ import annotations") - - while content[0] == "\n": - content = content[1:] - - if old_content != content: - fp.write_text(content) diff --git a/lint.sh b/lint.sh deleted file mode 100755 index c7157dc..0000000 --- a/lint.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -# Run Unimport. -unimport ./ --ignore-init --gitignore -r - -# Run Isort. -isort ./ - -# Run our lint script. -python ./.github/workflows/scripts/lint.py - -# Run Flynt. -flynt ./ -tc - -# Run Black. -black ./ - -echo -echo -echo "Linting finished!" diff --git a/pyproject.toml b/pyproject.toml index 130b852..10c158f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,22 +11,5 @@ jishaku = "*" mcstatus = "*" uvloop = "*" -[tool.poetry.dev-dependencies] -flynt = "*" -isort = "*" -unimport = "*" - [tool.poetry.scripts] bot = "minearchy_bot.__main__:main" - -[tool.black] -line-length = 100 -preview = true - -[tool.isort] -py_version = 310 -add_imports = ["from __future__ import annotations"] -line_length = 100 -profile = "black" -combine_as_imports = true -combine_star = true