diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000..4b73daf --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,2 @@ +# trivial: apply pyupgrade (#58937) +caa40e7e771b41bd1d164341a2e7f40689cbe4ba diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..dcca49f --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,8 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: +- repo: https://github.com/asottile/pyupgrade + rev: v2.20.0 + hooks: + - id: pyupgrade + args: ['--keep-percent-format', '--py37-plus'] \ No newline at end of file diff --git a/README.txt b/README.txt index 4a4f34b..31eacce 100644 --- a/README.txt +++ b/README.txt @@ -179,3 +179,13 @@ You can put some configuration in ~/.config/eopayment.init :: order_id : 20201029093825_Vlco55 test : True transaction_date : 2020-10-29 09:38:26+00:00 + +Code Style +========== + +pyupgrade is used to automatically upgrade syntax, using those parameters: + + pyupgrade --keep-percent-format --py37-plus + +There is .pre-commit-config.yaml to use pre-commit to automatically pyupgrade +before commits. (execute `pre-commit install` to install the git hook.) diff --git a/tox.ini b/tox.ini index ae874bb..ab7207f 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ # and then run "tox" from this directory. [tox] -envlist = py3 +envlist = py3,codestyle toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/eopayment/{env:BRANCH_NAME:} [testenv] @@ -13,6 +13,7 @@ setenv = SETUPTOOLS_USE_DISTUTILS=stdlib commands = py3: py.test {posargs: --junitxml=junit-{envname}.xml --cov-report xml --cov-report html --cov=eopayment/ tests} + codestyle: pre-commit run --all-files --show-diff-on-failure usedevelop = True deps = coverage pytest @@ -21,6 +22,7 @@ deps = coverage mock<4 httmock lxml + pre-commit [pytest] filterwarnings =