From dd03b0c229f3970d0e6d2d1e6b43c6bb4b37c7f2 Mon Sep 17 00:00:00 2001 From: Nate Kean <14845347+garlic-os@users.noreply.github.com> Date: Tue, 9 Jul 2024 17:30:44 -0500 Subject: [PATCH] Replace autopep8 runner with reusable-ruff Changes made per instructions at https://github.com/ASFHyP3/actions/#reusable-ruffyml --- .github/workflows/autopep8.yml | 34 ----------------------------- .github/workflows/reusable-ruff.yml | 7 ++++++ pyproject.toml | 24 ++++++++++++++++++++ 3 files changed, 31 insertions(+), 34 deletions(-) delete mode 100644 .github/workflows/autopep8.yml create mode 100644 .github/workflows/reusable-ruff.yml diff --git a/.github/workflows/autopep8.yml b/.github/workflows/autopep8.yml deleted file mode 100644 index c9cfd1b53..000000000 --- a/.github/workflows/autopep8.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Auto-format with autopep8 - -on: - pull_request: - branches: - - main - - dev - -jobs: - format: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.12' - - - name: Install autopep8 - run: pip install autopep8 - - - name: Run autopep8 - run: autopep8 --in-place --recursive --ignore=E5 . - - - name: Check for uncommitted changes - run: | - if [[ $(git status --porcelain) ]]; then - echo "Uncommitted changes found. Please format your code with autopep8." - git --no-pager diff - exit 1 - fi diff --git a/.github/workflows/reusable-ruff.yml b/.github/workflows/reusable-ruff.yml new file mode 100644 index 000000000..9c912ff46 --- /dev/null +++ b/.github/workflows/reusable-ruff.yml @@ -0,0 +1,7 @@ +name: Static analysis + +on: push + +jobs: + call-ruff-workflow: + uses: ASFHyP3/actions/.github/workflows/reusable-ruff.yml@v0.11.2 diff --git a/pyproject.toml b/pyproject.toml index d5815cdb2..8939e8bc3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,3 +66,27 @@ multi_line_output = 5 default_section = "THIRDPARTY" [tool.setuptools_scm] + +[tool.ruff] +line-length = 120 +src = ["tools", "test"] + +[tool.ruff.format] +indent-style = "space" +quote-style = "single" + +[tool.ruff.lint] +extend-select = [ + "I", # isort: https://docs.astral.sh/ruff/rules/#isort-i + "UP", # pyupgrade: https://docs.astral.sh/ruff/rules/#pyupgrade-up + "D", # pydocstyle: https://docs.astral.sh/ruff/rules/#pydocstyle-d + "ANN", # annotations: https://docs.astral.sh/ruff/rules/#flake8-annotations-ann + "PTH", # use-pathlib-pth: https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth +] + +[tool.ruff.lint.pydocstyle] +convention = "google" + +[tool.ruff.lint.isort] +case-sensitive = true +lines-after-imports = 2