Skip to content

Commit f31ab3d

Browse files
committed
chore: bring pyupgrade
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent 1e7b373 commit f31ab3d

File tree

4 files changed

+43
-3
lines changed

4 files changed

+43
-3
lines changed

.github/workflows/python.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,30 @@ env:
4444
permissions: {}
4545

4646
jobs:
47+
pyupgrade:
48+
name: Find Upgradable CodingStandards
49+
runs-on: ubuntu-latest
50+
timeout-minutes: 10
51+
steps:
52+
- name: Checkout
53+
# see https://github.com/actions/checkout
54+
uses: actions/checkout@v4
55+
- name: Setup Python Environment
56+
# see https://github.com/actions/setup-python
57+
uses: actions/setup-python@v5
58+
with:
59+
python-version: ${{ env.PYTHON_VERSION_DEFAULT }}
60+
architecture: 'x64'
61+
- name: Install poetry
62+
# see https://github.com/marketplace/actions/setup-poetry
63+
uses: Gr1N/setup-poetry@v9
64+
with:
65+
poetry-version: ${{ env.POETRY_VERSION }}
66+
- name: Install dependencies
67+
run: poetry install --no-root
68+
- name: Run tox
69+
run: poetry run tox run -e pyupgrade -s false
70+
4771
coding-standards:
4872
name: Linting & Coding Standards
4973
runs-on: ubuntu-latest

CONTRIBUTING.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,16 @@ poetry install
1717

1818
## Code style
1919

20+
THis project loves latest python features.
2021
This project uses [PEP8] Style Guide for Python Code.
21-
This project loves sorted imports.
22+
This project loves sorted imports.
23+
2224
Get it all applied via:
2325

2426
```shell
25-
poetry run isort .
26-
poetry run autopep8 -ir cyclonedx_py/ tests/
27+
poetry run -- tox r -e pyupgrade -- --exit-zero-even-if-changed
28+
poetry run -- tox r -e isort
29+
poetry run -- tox r -e autopep8
2730
```
2831

2932
This project prefers `f'strings'` over `'string'.format()`.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ mypy = "1.16.0"
9494
bandit = "1.8.3"
9595
tomli = { version = "^2.0.1", python = "<3.11" }
9696
tox = "4.26.0"
97+
pyupgrade = "3.20.0"
9798

9899
# min version required to be able to install some dependencies
99100
# see https://github.com/MichaelKim0407/flake8-use-fstring/issues/33

tox.ini

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,15 @@ commands =
4646
skip_install = True
4747
commands =
4848
poetry run bandit -c bandit.yml -v -r cyclonedx_py tests
49+
50+
[testenv:pyupgrade]
51+
allowlist_externals = poetry, sh
52+
commands = sh -c "\
53+
find cyclonedx_py tests -not -path '*/.venv/*' -type f -name '*.py' -print0 \
54+
| xargs -0 poetry run pyupgrade --py39-plus {posargs} "
55+
56+
[testenv:isort]
57+
commands = poetry run isort .
58+
59+
[testenv:autopep8]
60+
commands = poetry run autopep8 --in-place -r cyclonedx typings tests tools examples

0 commit comments

Comments
 (0)