generated from mumblepins/template-python-library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
173 lines (172 loc) · 4.82 KB
/
.pre-commit-config.yaml
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
fail_fast: true
default_install_hook_types: [pre-commit, post-commit]
repos:
- repo: https://github.com/andreoliwa/nitpick
rev: "v0.32.0"
hooks:
- id: nitpick
additional_dependencies:
- requests-cache<1.0
- repo: https://github.com/python-poetry/poetry
rev: 1.3.0
hooks:
- id: poetry-lock
args: ["--check"]
files: "(pyproject.toml|poetry.lock)"
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v2.7.1"
hooks:
- id: prettier
stages:
- commit
additional_dependencies:
- prettier
- prettier-plugin-toml
- "@prettier/plugin-xml"
- prettier-plugin-sh
exclude: ^(.idea/.*|CHANGELOG.md|template.yaml)
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/ambv/black
rev: 22.10.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/asottile/pyupgrade
rev: v3.4.0
hooks:
- id: pyupgrade
args:
- --py38-plus
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-toml
- id: check-yaml
- id: detect-private-key
- id: end-of-file-fixer
exclude: "[CHANGELOG.md]"
- id: mixed-line-ending
args:
- --fix=auto
- id: pretty-format-json
args:
- --autofix
- --indent=4
- --no-sort-keys
exclude: "[inputs.json|syntax_error.json]"
- id: trailing-whitespace
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
hooks:
- id: flake8
args:
- --config=.config/.flake8
additional_dependencies:
- flake8-bugbear>=19.3.0
- flake8-builtins>=1.4.1
- flake8-commas>=2.0.0
- flake8-comprehensions>=2.1.0
- flake8-debugger>=3.1.0
- flake8-pep3101>=1.2.1
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
hooks:
- id: python-check-blanket-noqa
- id: python-check-mock-methods
- id: python-no-log-warn
- repo: https://github.com/PyCQA/bandit
rev: 1.7.4
hooks:
- id: bandit
files: "^src/"
additional_dependencies:
- bandit[toml]
args:
- -c
- pyproject.toml
- -f
- custom
- -q
- --msg-template
- "{abspath}:{line}: {test_id}: Severe-{severity}/Conf-{confidence}: {msg}"
- repo: https://github.com/domdfcoding/flake2lint
rev: v0.4.2
hooks:
- id: flake2lint
- repo: https://github.com/mumblepins/dep_checker
rev: v0.7.0
hooks:
- id: dep_checker
args:
- --req-file
- pyproject.toml
- src/aws_lambda_python_packager
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v0.982" # Use the sha / tag you want to point at
hooks:
- id: mypy
args: ["--config-file", "pyproject.toml"]
files: '^(src/.*|[^/]*)\.py$'
additional_dependencies:
- types-requests
- types-toml
- types-colorama
- types-setuptools
- click
- click_option_group
- repo: local
hooks:
# - id: mypy
# name: mypy
# entry: mypy
# language: system
# stages: [ manual ]
# pass_filenames: false
# args: [ "--config-file", "pyproject.toml","--no-incremental" ]
- id: pylint
name: pylint
entry: >
poetry run
pylint
language: system
types: [python]
args: ["-rn", "-sn", "--extension-pkg-whitelist=pydantic", "--rcfile=.config/.pylintrc"]
- id: pytest-local
name: pytest-local
stages: [manual]
description: Run pytest in the local virtualenv
entry: >
poetry run
pytest
"tests/"
-n auto
--cov=aws_lambda_python_packager
--pyargs "aws_lambda_python_packager"
--cov-report=html
--cov-report=term
--cov-report=xml
language: system
# ignore all files, run on hard-coded modules instead
pass_filenames: false
always_run: true
types: [python]
verbose: true
- repo: local
hooks:
- id: gitchangelog
language: system
always_run: true
pass_filenames: false
name: Generate changelog
entry: poetry run bash -c "GITCHANGELOG_CONFIG_FILENAME='.config/.gitchangelog.rc'
gitchangelog > CHANGELOG.md"
stages: [post-commit]