Skip to content

Commit 5efefaa

Browse files
authored
Use pre-commit to manage linters (#675)
1 parent 6a7f036 commit 5efefaa

File tree

14 files changed

+87
-31
lines changed

14 files changed

+87
-31
lines changed

.flake8

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
[flake8]
2-
extend-ignore = E203, E266, E501, H301, H306
2+
extend-ignore =
3+
E203,
4+
E266,
5+
E501,
6+
H301,
7+
H306
38
# line length is intentionally set to 80 here because black uses Bugbear
49
# See https://github.com/psf/black/blob/master/docs/the_black_code_style.md#line-length for more details
510
max-line-length = 80

.github/workflows/tox.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- "**"
77
push: # only publishes pushes to the main branch to TestPyPI
88
branches: # any integration branch but not tag
9-
- "master"
9+
- "main"
1010
pull_request:
1111
release:
1212
types:

.pre-commit-config.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
ci:
3+
# format compatible with commitlint
4+
autoupdate_commit_msg: "chore: pre-commit autoupdate"
5+
autoupdate_schedule: monthly
6+
autofix_commit_msg: |
7+
chore: auto fixes from pre-commit.com hooks
8+
9+
for more information, see https://pre-commit.ci
10+
# exclude: >
11+
# (?x)^(
12+
# )$
13+
repos:
14+
- repo: meta
15+
hooks:
16+
- id: check-useless-excludes
17+
- repo: https://github.com/pre-commit/pre-commit-hooks.git
18+
rev: v4.4.0
19+
hooks:
20+
- id: end-of-file-fixer
21+
- id: trailing-whitespace
22+
- id: mixed-line-ending
23+
- id: fix-byte-order-marker
24+
- id: check-executables-have-shebangs
25+
- id: check-merge-conflict
26+
- id: debug-statements
27+
language_version: python3
28+
- repo: https://github.com/PyCQA/isort
29+
rev: 5.10.1
30+
hooks:
31+
- id: isort
32+
args:
33+
# https://github.com/pre-commit/mirrors-isort/issues/9#issuecomment-624404082
34+
- --filter-files
35+
- repo: https://github.com/psf/black
36+
rev: 22.10.0
37+
hooks:
38+
- id: black
39+
language_version: python3
40+
- repo: https://github.com/pycqa/flake8.git
41+
rev: 6.0.0
42+
hooks:
43+
- id: flake8
44+
language_version: python3
45+
additional_dependencies:
46+
- flake8-bugbear
47+
- flake8-comprehensions
48+
- flake8-debugger
49+
- flake8-logging-format
50+
- flake8-pep3101
51+
- flake8-print
52+
- repo: https://github.com/pre-commit/mirrors-mypy
53+
rev: v0.991
54+
hooks:
55+
- id: mypy
56+
# empty args needed in order to match mypy cli behavior
57+
args: [] # [--strict]
58+
additional_dependencies:
59+
- types-paramiko
60+
- types-setuptools
61+
- setuptools-scm
62+
- alabaster

LICENSE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,4 +173,3 @@
173173
defend, and hold each Contributor harmless for any liability
174174
incurred by, or claims asserted against, such Contributor by reason
175175
of your accepting any such warranty or additional liability.
176-

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ include tox.ini
88
include .flake8
99
include mypy.ini
1010
include Makefile
11+
include *.yaml
1112
include README.rst CONTRIBUTING.rst CHANGELOG.rst
1213
include MANIFEST.in
1314
include ansible.cfg

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ a plugin to the powerful Pytest_ test engine
1717
License
1818
=======
1919

20-
`Apache License 2.0 <https://github.com/pytest-dev/pytest-testinfra/blob/master/LICENSE>`_
20+
`Apache License 2.0 <https://github.com/pytest-dev/pytest-testinfra/blob/main/LICENSE>`_
2121

2222
The logo is licensed under the `Creative Commons NoDerivatives 4.0 License <https://creativecommons.org/licenses/by-nd/4.0/>`_
2323
If you have some other use in mind, contact us.
@@ -30,7 +30,7 @@ Install testinfra using pip::
3030
$ pip install pytest-testinfra
3131

3232
# or install the devel version
33-
$ pip install 'git+https://github.com/pytest-dev/pytest-testinfra@master#egg=pytest-testinfra'
33+
$ pip install 'git+https://github.com/pytest-dev/pytest-testinfra@main#egg=pytest-testinfra'
3434

3535

3636
Write your first tests file to `test_myinfra.py`:

dev-requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
sphinx>=1.3
22
alabaster>=0.7.2
3-
hacking>=4.0
43
.

doc/source/conf.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
# All configuration values have a default; values that are commented out
2222
# serve to show the default.
2323

24-
import os
25-
import sys
26-
2724
import datetime
25+
import os
2826
import subprocess
27+
import sys
28+
from typing import Dict, List
2929

3030
import alabaster
3131

@@ -92,7 +92,7 @@
9292

9393
# List of patterns, relative to source directory, that match files and
9494
# directories to ignore when looking for source files.
95-
exclude_patterns = []
95+
exclude_patterns: List[str] = []
9696

9797
# The reST default role (used for this markup: `text`) to use for all
9898
# documents.
@@ -222,7 +222,7 @@
222222

223223
# -- Options for LaTeX output ---------------------------------------------
224224

225-
latex_elements = {
225+
latex_elements: Dict[str, tuple] = {
226226
# The paper size ('letterpaper' or 'a4paper')
227227
# 'papersize': 'letterpaper',
228228
# The font size ('10pt', '11pt' or '12pt').

doc/source/examples.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ Integration with KitchenCI
137137
~~~~~~~~~~~~~~~~~~~~~~~~~~
138138

139139
KitchenCI (aka Test Kitchen) can use testinfra via its :code:`shell` verifier.
140-
Add the following to your :code:`.kitchen.yml`, this requires installing `paramiko`
140+
Add the following to your :code:`.kitchen.yml`, this requires installing `paramiko`
141141
additionally (on your host machine, not in the VM handled by kitchen) ::
142142

143143
verifier:

images/alpine/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,3 @@ RUN apk add --update --no-cache python3 openrc openssh && \
1212

1313
EXPOSE 22
1414
CMD ["/sbin/init"]
15-
16-

0 commit comments

Comments
 (0)