Skip to content

Commit

Permalink
Setup pre-commit hooks configuration (#5136) (#5137)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
  • Loading branch information
aio-libs-github-bot[bot] and asvetlov authored Oct 25, 2020
1 parent 2bcfb1f commit 5b59f2c
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ jobs:
uses: py-actions/py-dependency-install@v2
with:
path: requirements/lint.txt
- name: Pre-Commit hooks
uses: pre-commit/action@v2.0.0
- name: Install itself
run: |
python setup.py install
env:
AIOHTTP_NO_EXTENSIONS: 1
- name: Run linters
run: |
make flake8
make isort-check
make mypy
- name: Install spell checker
run: |
Expand Down
29 changes: 29 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: 'v2.7.3'
hooks:
- id: pyupgrade
args: ['--py36-plus']
- repo: https://github.com/psf/black
rev: '20.8b1'
hooks:
- id: black
language_version: python3 # Should be a command that runs python3.6+
- repo: https://github.com/pre-commit/mirrors-isort
rev: 'v5.6.4'
hooks:
- id: isort
- repo: https://gitlab.com/pycqa/flake8
rev: '3.8.4'
hooks:
- id: flake8
exclude: "^docs/"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v3.3.0'
hooks:
- id: check-case-conflict
- id: check-json
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: check-added-large-files
6 changes: 6 additions & 0 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ After that please install libraries required for development:

For now, the development tooling depends on ``make`` and assumes an Unix OS If you wish to contribute to aiohttp from a Windows machine, the easiest way is probably to `configure the WSL <https://docs.microsoft.com/en-us/windows/wsl/install-win10>`_ so you can use the same instructions. If it's not possible for you or if it doesn't work, please contact us so we can find a solution together.

Install pre-commit hooks:

.. code-block:: shell
$ pre-commit install
.. warning::

If you plan to use temporary ``print()``, ``pdb`` or ``ipdb`` within the test suite, execute it with ``-s``:
Expand Down
3 changes: 2 additions & 1 deletion requirements/lint.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
mypy==0.790; implementation_name=="cpython"
flake8==3.8.4
flake8-pyi==20.10.0; python_version >= "3.6"
flake8-pyi==20.10.0
black==20.8b1; python_version >= "3.6"
isort==5.6.4
pre-commit==2.7.1

0 comments on commit 5b59f2c

Please sign in to comment.