Skip to content

Commit

Permalink
Update to pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
icemac committed Aug 20, 2024
1 parent b434e5f commit 142e152
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 15 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/buildout-recipe
name: pre-commit

on:
pull_request:
push:
branches:
- master
# Allow to run this workflow manually from the Actions tab
workflow_dispatch:

env:
FORCE_COLOR: 1

jobs:
pre-commit:
name: linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- uses: pre-commit/[email protected]
with:
extra_args: --all-files --show-diff-on-failure
env:
PRE_COMMIT_COLOR: always
- uses: pre-commit-ci/[email protected]
if: always()
with:
msg: Apply pre-commit code formatting
1 change: 0 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:
config:
# [Python version, tox env]
- ["3.11", "release-check"]
- ["3.11", "lint"]
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["3.10", "py310"]
Expand Down
2 changes: 1 addition & 1 deletion .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# https://github.com/zopefoundation/meta/tree/master/config/buildout-recipe
[meta]
template = "buildout-recipe"
commit-id = "6e808865"
commit-id = "51f62256"

[python]
with-pypy = true
Expand Down
24 changes: 24 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/buildout-recipe
minimum_pre_commit_version: '3.6'
repos:
- repo: https://github.com/pycqa/isort
rev: "5.13.2"
hooks:
- id: isort
- repo: https://github.com/hhatto/autopep8
rev: "v2.3.1"
hooks:
- id: autopep8
args: [--in-place, --aggressive, --aggressive]
- repo: https://github.com/asottile/pyupgrade
rev: v3.17.0
hooks:
- id: pyupgrade
args: [--py38-plus]
- repo: https://github.com/PyCQA/flake8
rev: "7.1.1"
hooks:
- id: flake8
additional_dependencies:
- flake8-debugger == 4.1.2
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ include *.rst
include *.txt
include buildout.cfg
include tox.ini
include .pre-commit-config.yaml
include .coveragerc

recursive-include src *.py
Expand Down
16 changes: 3 additions & 13 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,14 @@ commands =
twine check dist/*

[testenv:lint]
description = This env runs all linters configured in .pre-commit-config.yaml
basepython = python3
skip_install = true
deps =
isort
flake8
commands =
isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py
flake8 src setup.py

[testenv:isort-apply]
basepython = python3
skip_install = true
pre-commit
commands_pre =
deps =
isort
commands =
isort {toxinidir}/src {toxinidir}/setup.py []
pre-commit run --all-files --show-diff-on-failure

[testenv:coverage]
basepython = python3
Expand All @@ -69,7 +60,6 @@ setenv =
COVERAGE_PROCESS_START={toxinidir}/.coveragerc
deps =
coverage
setuptools < 69
commands =
mkdir -p {toxinidir}/parts/htmlcov
coverage erase
Expand Down

0 comments on commit 142e152

Please sign in to comment.