Skip to content

Commit

Permalink
Configure pyupgrade in pre-commit and Tox
Browse files Browse the repository at this point in the history
The 'types: [python]' option in pre-commit configuration is needed in
order to avoid pyupgrade to operate on non-Python files, e.g.
'rpm/build' (not sure why it does so).
  • Loading branch information
dlax committed Nov 26, 2024
1 parent eb2e57d commit 83fc396
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
repos:
- repo: local
hooks:
- id: pyupgrade
name: pyupgrade
entry: pyupgrade --py39-plus --exit-zero-even-if-changed
language: system
types: [python]
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
include .coveragerc
include .flake8
include .pre-commit-config.yaml
include pyproject.toml
include *.md
include *.txt
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ lint = [
"check-manifest",
"flake8",
"isort",
"pyupgrade",
]
typing = [
"mypy",
Expand Down
3 changes: 3 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ commands=
flake8
black --check --diff .
isort --check --diff .
pre-commit run --all-files --show-diff-on-failure pyupgrade
check-manifest
deps =
flake8
black
check-manifest
isort
pre-commit
pyupgrade
skip_install = true

[testenv:tests{,-ci}]
Expand Down

0 comments on commit 83fc396

Please sign in to comment.