mirror of
https://github.com/LukeHagar/connexion.git
synced 2025-12-06 12:27:45 +00:00
Add pre-commit hook (#1511)
This commit is contained in:
26
.pre-commit-config.yaml
Normal file
26
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
ci:
|
||||||
|
autoupdate_branch: "main"
|
||||||
|
autoupdate_schedule: monthly
|
||||||
|
repos:
|
||||||
|
- repo: https://github.com/PyCQA/flake8
|
||||||
|
rev: 4.0.1
|
||||||
|
hooks:
|
||||||
|
- id: flake8
|
||||||
|
files: "^connexion/"
|
||||||
|
additional_dependencies:
|
||||||
|
- flake8-rst-docstrings==0.2.3
|
||||||
|
- repo: https://github.com/PyCQA/isort
|
||||||
|
rev: 5.10.1
|
||||||
|
hooks:
|
||||||
|
- id: isort
|
||||||
|
name: isort
|
||||||
|
files: "^connexion/"
|
||||||
|
args: ["--project", "connexion", "--check-only", "--diff"]
|
||||||
|
- id: isort
|
||||||
|
name: isort examples
|
||||||
|
files: "^examples/"
|
||||||
|
args: ["--thirdparty", "connexion", "--check-only", "--diff"]
|
||||||
|
- id: isort
|
||||||
|
name: isort tests
|
||||||
|
files: "^tests/"
|
||||||
|
args: ["--project", "conftest", "--thirdparty", "connexion", "--check-only", "--diff"]
|
||||||
@@ -583,6 +583,14 @@ Contributing to Connexion/TODOs
|
|||||||
We welcome your ideas, issues, and pull requests. Just follow the
|
We welcome your ideas, issues, and pull requests. Just follow the
|
||||||
usual/standard GitHub practices.
|
usual/standard GitHub practices.
|
||||||
|
|
||||||
|
For easy development, please install connexion in editable mode with the :code:`tests` extra, and
|
||||||
|
install the pre-commit hooks.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
pip install -e .[tests]
|
||||||
|
pre-commit install
|
||||||
|
|
||||||
You can find out more about how Connexion works and where to apply your changes by having a look
|
You can find out more about how Connexion works and where to apply your changes by having a look
|
||||||
at our `ARCHITECTURE.rst <ARCHITECTURE.rst>`_.
|
at our `ARCHITECTURE.rst <ARCHITECTURE.rst>`_.
|
||||||
|
|
||||||
|
|||||||
4
setup.py
4
setup.py
@@ -39,10 +39,9 @@ flask_require = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
tests_require = [
|
tests_require = [
|
||||||
'decorator>=5,<6',
|
|
||||||
'pytest>=6,<7',
|
'pytest>=6,<7',
|
||||||
|
'pre-commit>=2,<3',
|
||||||
'pytest-cov>=2,<3',
|
'pytest-cov>=2,<3',
|
||||||
'testfixtures>=6,<7',
|
|
||||||
*flask_require,
|
*flask_require,
|
||||||
swagger_ui_require
|
swagger_ui_require
|
||||||
]
|
]
|
||||||
@@ -92,7 +91,6 @@ setup(
|
|||||||
url='https://github.com/zalando/connexion',
|
url='https://github.com/zalando/connexion',
|
||||||
keywords='openapi oai swagger rest api oauth flask microservice framework',
|
keywords='openapi oai swagger rest api oauth flask microservice framework',
|
||||||
license='Apache License Version 2.0',
|
license='Apache License Version 2.0',
|
||||||
setup_requires=['flake8'],
|
|
||||||
python_requires=">=3.6",
|
python_requires=">=3.6",
|
||||||
install_requires=install_requires + flask_require,
|
install_requires=install_requires + flask_require,
|
||||||
tests_require=tests_require,
|
tests_require=tests_require,
|
||||||
|
|||||||
33
tox.ini
33
tox.ini
@@ -9,10 +9,7 @@ envlist =
|
|||||||
{py38}-{min,pypi,dev}
|
{py38}-{min,pypi,dev}
|
||||||
{py39}-{min,pypi,dev}
|
{py39}-{min,pypi,dev}
|
||||||
{py310}-{min,pypi,dev}
|
{py310}-{min,pypi,dev}
|
||||||
isort-check
|
pre-commit
|
||||||
isort-check-examples
|
|
||||||
isort-check-tests
|
|
||||||
flake8
|
|
||||||
mypy
|
mypy
|
||||||
|
|
||||||
[gh-actions]
|
[gh-actions]
|
||||||
@@ -20,7 +17,7 @@ python =
|
|||||||
3.7: py37-min,py37-pypi
|
3.7: py37-min,py37-pypi
|
||||||
3.8: py38-min,py38-pypi
|
3.8: py38-min,py38-pypi
|
||||||
3.9: py39-min,py39-pypi
|
3.9: py39-min,py39-pypi
|
||||||
3.10: py310-min,py310-pypi,flake8,isort-check,isort-check-examples,isort-check-tests,mypy
|
3.10: py310-min,py310-pypi,pre-commit,mypy
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
setenv=PYTHONPATH = {toxinidir}:{toxinidir}
|
setenv=PYTHONPATH = {toxinidir}:{toxinidir}
|
||||||
@@ -35,29 +32,9 @@ commands=
|
|||||||
dev: pip install --upgrade -r {toxworkdir}/requirements-dev.txt
|
dev: pip install --upgrade -r {toxworkdir}/requirements-dev.txt
|
||||||
python setup.py test
|
python setup.py test
|
||||||
|
|
||||||
[testenv:flake8]
|
[testenv:pre-commit]
|
||||||
deps=
|
deps=pre-commit
|
||||||
flake8==3.9.2
|
commands=pre-commit run --all-files --show-diff-on-failure
|
||||||
flake8-rst-docstrings==0.2.3
|
|
||||||
commands=python setup.py flake8
|
|
||||||
|
|
||||||
[testenv:isort-check]
|
|
||||||
basepython=python3
|
|
||||||
deps=isort==5.9.1
|
|
||||||
changedir={toxinidir}/connexion
|
|
||||||
commands=isort --project connexion --check-only --diff .
|
|
||||||
|
|
||||||
[testenv:isort-check-examples]
|
|
||||||
basepython=python3
|
|
||||||
deps=isort==5.9.1
|
|
||||||
changedir={toxinidir}/examples
|
|
||||||
commands=isort --thirdparty connexion --check-only --diff .
|
|
||||||
|
|
||||||
[testenv:isort-check-tests]
|
|
||||||
basepython=python3
|
|
||||||
deps=isort==5.9.1
|
|
||||||
changedir={toxinidir}/tests
|
|
||||||
commands=isort --thirdparty connexion --check-only --diff .
|
|
||||||
|
|
||||||
[testenv:mypy]
|
[testenv:mypy]
|
||||||
deps=
|
deps=
|
||||||
|
|||||||
Reference in New Issue
Block a user