diff --git a/.github/workflows/auto-update-pre-commit.yaml b/.github/workflows/auto-update-pre-commit.yaml new file mode 100644 index 0000000..332e751 --- /dev/null +++ b/.github/workflows/auto-update-pre-commit.yaml @@ -0,0 +1,55 @@ +name: Auto-update Pre-commit +run-name: Updating Pre-commit Configuration on ${{ github.repository }} + +on: + schedule: + - cron: '0 0 * * 0' # Run every Sunday at midnight UTC + workflow_dispatch: + inputs: + logLevel: + description: 'Log level' + required: true + default: 'info' + +jobs: + auto_update: + name: Perform auto-update of pre-commit configuration + runs-on: ubuntu-latest + + strategy: + matrix: + python-version: ["3.11"] + + steps: + - name: Harden Runner + uses: step-security/harden-runner@394d78e5b40cc35c170eb909b1f81551f37feb05 # v2.5.0 + with: + egress-policy: audit + + - name: Checkout repository + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.5.3 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@f97b83114c6f41cfaa57698147ad3ce20543a127 # v4.7.0 + with: + python-version: ${{ matrix.python-version }} + cache: "pip" + + - name: Install and upgrade PIP + run: python -m pip install --upgrade pip + + - name: Install Pre-commit + run: pip install pre-commit + + - name: Update pre-commit + run: pre-commit autoupdate + + - name: Create PR + uses: peter-evans/create-pull-request@6d9c0cdf5825c01278b6e63a0788434e6b3c5e27 # v5.0.2 + with: + token: ${{ secrets.SEYLUBOT_PAT }} + committer: GitHub + author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> + signoff: false + delete-branch: true + branch-suffix: 'timestamp' diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index b1444fb..ac06976 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -40,16 +40,12 @@ jobs: run: > pip install ruff - isort black mypy - name: Ruff Linter run: ruff check . --diff - - name: Isort Import Sorter - run: isort . --diff --check - - name: Black Formatter run: black . --diff --check diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8d2cb7a..91a14dd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,23 +1,18 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.3.0 + rev: v4.4.0 hooks: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.282 + rev: v0.0.287 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] - - repo: https://github.com/pycqa/isort - rev: 5.12.0 - hooks: - - id: isort - - repo: https://github.com/psf/black - rev: 23.7.0 + rev: 23.9.0 hooks: - id: black diff --git a/cli.py b/cli.py index 9e0b741..3dc7f06 100644 --- a/cli.py +++ b/cli.py @@ -10,7 +10,6 @@ __maintainer__ = "seyLu" __status__ = "Prototype" - import json import logging import os diff --git a/pyproject.toml b/pyproject.toml index bd0e1ea..4c9e43c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,8 +10,12 @@ authors = [ [tool.ruff] -# Enable flake8-bugbear (`B`) rules. -select = ["E", "F", "B"] +select = [ + "E", # Pyflakes + "F", # Pycodestyle + "B", # flake8-bugbear + "I001" # isort +] # Never enforce `E501` (line length violations). ignore = ["E501"] @@ -37,14 +41,5 @@ implicit_reexport = "True" # Exclude type checking on files/dirs exclude = [ # TOML basic string (double-quotes, backslash and other characters need escaping) - "app", - "migrations", - "routers", - # TOML literal string (single-quotes, no escaping necessary) - '/managers\.py$', - '/models\.py$', - '/serializers\.py$', - '/urls\.py$', - '/views\.py$', ]