summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2018-11-09 22:17:36 -0500
committerJason R. Coombs <jaraco@jaraco.com>2018-11-10 08:00:28 -0500
commitd0f07a4e7ad465b0935bf85da94b12b9b8cc2e77 (patch)
treeca04ea5b749dff924bbba9d8bbe74ee801d39d68
parent166b43e1429fa1b9b467da82109151222719cc20 (diff)
downloadpytest-runner-d0f07a4e7ad465b0935bf85da94b12b9b8cc2e77.tar.gz
Add black config, pre-commit including black, check code with black.
-rw-r--r--.flake85
-rw-r--r--.pre-commit-config.yaml5
-rw-r--r--README.rst4
-rw-r--r--docs/conf.py44
-rw-r--r--pyproject.toml3
-rw-r--r--pytest.ini2
-rw-r--r--setup.cfg1
-rw-r--r--setup.py2
8 files changed, 40 insertions, 26 deletions
diff --git a/.flake8 b/.flake8
index c85d34a..790c109 100644
--- a/.flake8
+++ b/.flake8
@@ -1,8 +1,9 @@
[flake8]
+max-line-length = 88
ignore =
- # Allow tabs for indentation
- W191
# W503 violates spec https://github.com/PyCQA/pycodestyle/issues/513
W503
# W504 has issues https://github.com/OCA/maintainer-quality-tools/issues/545
W504
+ # Black creates whitespace before colon
+ E203
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..922d942
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,5 @@
+repos:
+- repo: https://github.com/ambv/black
+ rev: 18.9b0
+ hooks:
+ - id: black
diff --git a/README.rst b/README.rst
index 78750be..7050da3 100644
--- a/README.rst
+++ b/README.rst
@@ -6,6 +6,10 @@
.. image:: https://img.shields.io/travis/jaraco/skeleton/master.svg
:target: https://travis-ci.org/jaraco/skeleton
+.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
+ :target: https://github.com/ambv/black
+ :alt: Code style: Black
+
.. .. image:: https://img.shields.io/appveyor/ci/jaraco/skeleton/master.svg
.. :target: https://ci.appveyor.com/project/jaraco/skeleton/branch/master
diff --git a/docs/conf.py b/docs/conf.py
index aeda56c..d9ea1a6 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -2,31 +2,31 @@
# -*- coding: utf-8 -*-
extensions = [
- 'sphinx.ext.autodoc',
- 'jaraco.packaging.sphinx',
- 'rst.linker',
+ 'sphinx.ext.autodoc',
+ 'jaraco.packaging.sphinx',
+ 'rst.linker',
]
master_doc = 'index'
link_files = {
- '../CHANGES.rst': dict(
- using=dict(
- GH='https://github.com',
- ),
- replace=[
- dict(
- pattern=r'(Issue #|\B#)(?P<issue>\d+)',
- url='{package_url}/issues/{issue}',
- ),
- dict(
- pattern=r'^(?m)((?P<scm_version>v?\d+(\.\d+){1,2}))\n[-=]+\n',
- with_scm='{text}\n{rev[timestamp]:%d %b %Y}\n',
- ),
- dict(
- pattern=r'PEP[- ](?P<pep_number>\d+)',
- url='https://www.python.org/dev/peps/pep-{pep_number:0>4}/',
- ),
- ],
- ),
+ '../CHANGES.rst': dict(
+ using=dict(
+ GH='https://github.com',
+ ),
+ replace=[
+ dict(
+ pattern=r'(Issue #|\B#)(?P<issue>\d+)',
+ url='{package_url}/issues/{issue}',
+ ),
+ dict(
+ pattern=r'^(?m)((?P<scm_version>v?\d+(\.\d+){1,2}))\n[-=]+\n',
+ with_scm='{text}\n{rev[timestamp]:%d %b %Y}\n',
+ ),
+ dict(
+ pattern=r'PEP[- ](?P<pep_number>\d+)',
+ url='https://www.python.org/dev/peps/pep-{pep_number:0>4}/',
+ ),
+ ],
+ ),
}
diff --git a/pyproject.toml b/pyproject.toml
index 65d7426..a8b44c1 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,2 +1,5 @@
[build-system]
requires = ["setuptools>=34.4", "wheel", "setuptools_scm>=1.15"]
+
+[tool.black]
+skip-string-normalization = true
diff --git a/pytest.ini b/pytest.ini
index 61dab3d..15bb8b7 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -1,6 +1,6 @@
[pytest]
norecursedirs=dist build .tox .eggs
-addopts=--doctest-modules --flake8
+addopts=--doctest-modules --flake8 --black
doctest_optionflags=ALLOW_UNICODE ELLIPSIS
filterwarnings=
ignore:Possible nested set::pycodestyle:113
diff --git a/setup.cfg b/setup.cfg
index adaed86..78a0e46 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -33,6 +33,7 @@ testing =
pytest-sugar >= 0.9.1
collective.checkdocs
pytest-flake8
+ pytest-black
# local
diff --git a/setup.py b/setup.py
index c990c52..3435b2c 100644
--- a/setup.py
+++ b/setup.py
@@ -5,4 +5,4 @@
import setuptools
if __name__ == '__main__':
- setuptools.setup(use_scm_version=True)
+ setuptools.setup(use_scm_version=True)