1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: local
hooks:
- id: pipenv
name: Install pipenv
entry: bash -c 'pipenv install --skip-lock --dev'
language: system
pass_filenames: false
always_run: true
fail_fast: true
- id: unittest
name: Run unit tests (unittest)
# Imports in unit tests failing as packaging-tools is not a valid Python package name
# Change dir to packaging-tools and append to PYTHONPATH environment variable as a workaround
entry: bash -c 'cd packaging-tools && export PYTHONPATH=$(pwd) && pipenv run python3 -m unittest'
language: system
pass_filenames: false
always_run: true
fail_fast: true
- id: flake8
name: Check PEP8 compliance (flake8)
# Disable E203 for compatibility with blackformatter, and W503 as it goes against PEP8
# Disable checks that are not relevant to this patch, they will be introduced later
entry: bash -c 'pipenv run python3 -m flake8 --max-line-length=99 --ignore=E203,E501,W503 "$@"'
language: system
types: [python]
fail_fast: true
- id: isort
name: Sort imports (isort)
entry: bash -c 'for x in "$@"; do pipenv run python3 -m isort --line-length 99 --profile black --src packaging-tools "$x"; done'
language: system
types: [python]
fail_fast: true
- id: mypy
name: Check types (mypy)
entry: bash -c 'for x in "$@"; do pipenv run python3 -m mypy "$x"; done'
language: system
types: [python]
fail_fast: true
- id: pylint
name: Analyze code (pylint)
entry: bash -c 'for x in "$@"; do pipenv run python3 -m pylint --errors-only --enable=C0209,W1202,W1203,C0325,R1705,R1720,R1721,R1723,R1724,W0104,W0105,W0107,W0612,W0613,R0205,R1711,R1727,R1719,W1503,W0402,W1514,R1732,W0621,W0622,C0103 "$x"; done'
language: system
types: [python]
fail_fast: true
|