From 67d27841ae796f02bce3efa465d20211f5f3f084 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Mon, 5 Jul 2021 21:43:52 -0700 Subject: black: configuration This adds necessary configuration for flake8 and black to work together. This also sets the line length to 99, per the data here: * https://github.com/spack/spack/pull/24718#issuecomment-876933636 Given the data and the spirit of black's 88-character limit, we set the limit to 99 characters for all of Spack, because: * 99 is one less than 100, a nice round number, and all lines will fit in a 100-character wide terminal (even when the text editor puts a \ at EOL). * 99 is just past the knee the file size curve for packages, and it means that packages remain readable and not significantly longer than they are now. * It doesn't seem to hurt core -- files in core might change length by a few percent but seem like they'll be mostly the same as before -- just a bit more roomy. - [x] set line length to 99 - [x] remove most exceptions from `.flake8` and add the ones black cares about - [x] add `[tool.black]` to `pyproject.toml` - [x] make `black` run if available in `spack style --fix` Co-Authored-By: Tom Scogland --- pyproject.toml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'pyproject.toml') diff --git a/pyproject.toml b/pyproject.toml index ffa28cfdba..446c7891f2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,18 @@ +[tool.black] +line-length = 99 +target-version = ['py27', 'py35', 'py36', 'py37', 'py38', 'py39', 'py310'] +include = ''' + \.pyi?$ +''' +extend-exclude = ''' +/( + \.git + | \.mypy_cache + | ^lib/spack/external/ + | ^opt/ +)/ +''' + [tool.isort] profile = "black" sections = [ -- cgit v1.2.3-60-g2f50