aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.pre-commit-config.yaml2
-rw-r--r--Pipfile2
-rw-r--r--azure-pipelines.yml12
3 files changed, 12 insertions, 4 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 4bb5e7e1c..f369fb7d1 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -21,7 +21,7 @@ repos:
- id: flake8
name: Flake8
description: This hook runs flake8 within our project's pipenv environment.
- entry: pipenv run lint
+ entry: pipenv run flake8
language: python
types: [python]
require_serial: true
diff --git a/Pipfile b/Pipfile
index 64760f9dd..decc13e33 100644
--- a/Pipfile
+++ b/Pipfile
@@ -41,7 +41,7 @@ python_version = "3.8"
[scripts]
start = "python -m bot"
-lint = "python -m flake8"
+lint = "pre-commit run --all-files"
precommit = "pre-commit install"
build = "docker build -t pythondiscord/bot:latest -f Dockerfile ."
push = "docker push pythondiscord/bot:latest"
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 35dea089a..902bfcd56 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -13,10 +13,12 @@ jobs:
variables:
PIP_CACHE_DIR: ".cache/pip"
+ PRE_COMMIT_HOME: $(Pipeline.Workspace)/pre-commit-cache
steps:
- task: UsePythonVersion@0
displayName: 'Set Python version'
+ name: PythonVersion
inputs:
versionSpec: '3.8.x'
addToPath: true
@@ -27,8 +29,14 @@ jobs:
- script: pipenv install --dev --deploy --system
displayName: 'Install project using pipenv'
- - script: python -m flake8
- displayName: 'Run linter'
+ - task: Cache@2
+ displayName: 'Restore pre-commit environment'
+ inputs:
+ key: pre-commit | .pre-commit-config.yaml | "$(PythonVersion.pythonLocation)"
+ path: $(PRE_COMMIT_HOME)
+
+ - script: pre-commit run --all-files --show-diff-on-failure
+ displayName: 'Run pre-commit hooks'
- script: BOT_API_KEY=foo BOT_SENTRY_DSN=blah BOT_TOKEN=bar WOLFRAM_API_KEY=baz REDDIT_CLIENT_ID=spam REDDIT_SECRET=ham coverage run -m xmlrunner
displayName: Run tests