aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2019-05-30 03:29:55 -0700
committerGravatar MarkKoz <[email protected]>2019-05-30 03:29:55 -0700
commitc2416eb672afc80476fe2da1b364af5d018a16b0 (patch)
tree13dea0eeda4e5da3a67af18810dd64b24532fcc5
parentLint tests (diff)
Run flake8 via pre-commit for the pipenv lint script
Pre-commit is a nice wrapper for this particularily because it allows both the snekbox and tests to be linted with a single command while clearly distinguishing their results. The Python script is a cross-platform implementation of the following: git ls-files -- '*.py' | xargs pre-commit run flake8 --files
-rw-r--r--Pipfile8
1 files changed, 7 insertions, 1 deletions
diff --git a/Pipfile b/Pipfile
index 69bb0df..ea6299b 100644
--- a/Pipfile
+++ b/Pipfile
@@ -26,7 +26,13 @@ flake8-quotes = "*"
python_version = "3.7"
[scripts]
-lint = "flake8"
+lint = """
+python -c
+\"import subprocess, sys
+files = subprocess.check_output(('git', 'ls-files', '--', '*.py')).decode('UTF-8').strip()
+args = ['pre-commit', 'run', 'flake8', '--files'] + files.split('\\n')
+subprocess.run(args, stdout=sys.stdout, stderr=sys.stderr)\"
+"""
precommit = "pre-commit install"
test = "pytest tests --cov . --cov-report term-missing -v"
report = "pytest tests --cov . --cov-report=html"