summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2021-02-09 15:53:44 -0500
committerGitHub <noreply@github.com>2021-02-09 15:53:44 -0500
commit77d5ad3d86241eb312e2a9dae4deb20883b2fe50 (patch)
treef56aafe4c2bf6943d40e891ed1d619218ee6e113
parent918200c02d392c17862fff81bbf58820ed15c725 (diff)
parentf6911706416514adfc7d591587a868cd714c9a25 (diff)
downloadcmd2-git-77d5ad3d86241eb312e2a9dae4deb20883b2fe50.tar.gz
Merge pull request #1053 from python-cmd2/black_config
Added black to Pipfile and black configuration to pyrpoject.toml
-rw-r--r--.github/workflows/lint.yml2
-rw-r--r--Pipfile4
-rw-r--r--pyproject.toml24
-rw-r--r--setup.cfg26
-rw-r--r--tasks.py3
5 files changed, 52 insertions, 7 deletions
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 38ce75a8..b23c6ab9 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -25,4 +25,4 @@ jobs:
- name: Install python prerequisites
run: pip install -U --user pip setuptools setuptools-scm flake8
- name: Lint
- run: python -m flake8 . --count --ignore=E252,W503 --max-complexity=26 --max-line-length=127 --show-source --statistics ;
+ run: python -m flake8 .
diff --git a/Pipfile b/Pipfile
index bfa222b6..2bf8c8e5 100644
--- a/Pipfile
+++ b/Pipfile
@@ -11,6 +11,7 @@ setuptools = ">=34.4"
wcwidth = ">=0.1.7"
[dev-packages]
+black = "*"
cmd2 = {editable = true,path = "."}
cmd2_ext_test = {editable = true,path = "plugins/ext_test"}
codecov = "*"
@@ -32,3 +33,6 @@ sphinx-autobuild = "*"
sphinx-rtd-theme = "*"
tableformatter="*"
twine = ">=1.11"
+
+[pipenv]
+allow_prereleases = true
diff --git a/pyproject.toml b/pyproject.toml
index 51000e45..2dc65758 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,2 +1,26 @@
[build-system]
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"]
+
+[tool.black]
+skip-string-normalization = true
+line-length = 127
+include = '\.pyi?$'
+exclude = '''
+/(
+ \.eggs
+ | \.git
+ | \.github
+ | \.idea
+ | \.mypy_cache
+ | \.pytest_cache
+ | \.tox
+ | \.venv
+ | \.vscode
+ | _build
+ | build
+ | cmd2.egg-info
+ | cmd2_history.dat
+ | dist
+ | htmlcov
+)/
+'''
diff --git a/setup.cfg b/setup.cfg
index 39e6ab81..a01d2f86 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -3,13 +3,31 @@ testpaths =
tests
[flake8]
-exclude = .git,.idea,.pytest_cache,.tox,.nox,.venv,.vscode,build,cmd2.egg-info,dist,htmlcov,__pycache__,*.egg
-max-line-length = 127
+count = True
+ignore = E203,E231,W503 # E231 can be removed once black is fixed.
max-complexity = 26
+max-line-length = 127
+show-source = True
+statistics = True
+exclude =
+ .git
+ __pycache__
+ .tox
+ .nox
+ .eggs
+ *.eggs,
+ .venv,
+ .idea,
+ .pytest_cache,
+ .vscode,
+ build,
+ dist,
+ htmlcov
[isort]
-line_length=1
-skip=cmd2/__init__.py
+line_length = 1
+skip = cmd2/__init__.py,.git,__pycache,.tox,.nox,.venv,.eggs,.idea,.vscode,build,dist.htmlcov
+profile = black
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
diff --git a/tasks.py b/tasks.py
index 4bc4540e..3ffd5259 100644
--- a/tasks.py
+++ b/tasks.py
@@ -349,8 +349,7 @@ namespace.add_task(pypi_test)
def flake8(context):
"""Run flake8 linter and tool for style guide enforcement"""
with context.cd(TASK_ROOT_STR):
- context.run("flake8 --ignore=E252,W503 --max-complexity=26 --max-line-length=127 --show-source --statistics "
- "--exclude=.git,__pycache__,.tox,.nox,.eggs,*.egg,.venv,.idea,.pytest_cache,.vscode,build,dist,htmlcov")
+ context.run("flake8")
namespace.add_task(flake8)