mirror of
https://github.com/RGBCube/minearchy-bot
synced 2025-07-27 08:57:46 +00:00
clean: linting
This commit is contained in:
parent
34b4330450
commit
7e6233e72e
4 changed files with 0 additions and 112 deletions
50
.github/workflows/lint.yml
vendored
50
.github/workflows/lint.yml
vendored
|
@ -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
|
25
.github/workflows/scripts/lint.py
vendored
25
.github/workflows/scripts/lint.py
vendored
|
@ -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)
|
20
lint.sh
20
lint.sh
|
@ -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!"
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue