From 652cdcdb4dc53945ea9702923822a0547aefba7d Mon Sep 17 00:00:00 2001 From: Coady LaCroix Date: Thu, 12 Nov 2020 14:13:32 -0800 Subject: [PATCH] dev workflow updates for black (#3317) * Add black to dev requirements * Add black pre-commit hook * Add black to tox * Add black to travis-ci * Added git-blame-ignore-revs file to help keep git blame accurate after reformatting Signed-off-by: Coady LaCroix --- .git-blame-ignore-revs | 2 ++ .pre-commit-config.yaml | 6 ++++++ .travis.yml | 2 ++ requirements-dev.txt | 1 + tox.ini | 7 ++++++- 5 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 .git-blame-ignore-revs diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 00000000000..53486ea085c --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,2 @@ +# Format repository using black +ee4dc48b7f9f5ce54fab47a3c3d9b3dea12c52f1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bebc1439778..3fd2941578d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,11 @@ repos: +- repo: https://github.com/psf/black + rev: 20.8b1 + hooks: + - id: black + language_version: python3.7 + - repo: https://github.com/pre-commit/pre-commit-hooks rev: v2.5.0 hooks: diff --git a/.travis.yml b/.travis.yml index 6bfb2352bdb..4354e7bc1d0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,8 @@ script: matrix: include: + - python: 3.7 + env: TOXENV=black - python: 3.6 env: TOXENV=py36 - python: 3.7 diff --git a/requirements-dev.txt b/requirements-dev.txt index 717717416c4..84ed8d9416c 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,2 +1,3 @@ pre-commit==2.5.1 +black==20.8b1 -e . diff --git a/tox.ini b/tox.ini index 3ea0c002471..a7a9f8a518c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py36,py37,flake8 +envlist = black,py36,py37,flake8 [testenv] deps = @@ -42,3 +42,8 @@ deps = changedir = docs skipsdist = true commands = /usr/bin/make -f Makefile.tox html + +[testenv:black] +deps = + black==20.8b1 +commands = black . --check