From 57af08fde727231a878d32149bdf4a628ab48cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=AE=AE=E0=AE=A9=E0=AF=8B=E0=AE=9C=E0=AF=8D=E0=AE=95?= =?UTF-8?q?=E0=AF=81=E0=AE=AE=E0=AE=BE=E0=AE=B0=E0=AF=8D=20=E0=AE=AA?= =?UTF-8?q?=E0=AE=B4=E0=AE=A9=E0=AE=BF=E0=AE=9A=E0=AF=8D=E0=AE=9A=E0=AE=BE?= =?UTF-8?q?=E0=AE=AE=E0=AE=BF?= Date: Tue, 5 Apr 2022 10:21:07 +0530 Subject: [PATCH] updated requested changes in PR #6636 --- .pre-commit-config.yaml | 27 +++++++++++++++++++++++---- CONTRIBUTING.md | 2 ++ setup.sh | 7 +++++++ 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 93583de50..28eb0ae38 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,11 +5,30 @@ repos: rev: '4.0.1' hooks: - id: flake8 - args: - - max-line-length = 100, - - max-complexity = 12 + stages: [push] + - repo: https://github.com/pre-commit/mirrors-mypy rev: 'v0.942' hooks: - id: mypy - args: [--ignore-missing-imports] + stages: [push] + +- repo: https://github.com/pycqa/isort + rev: '5.10.1' + hooks: + - id: isort + name: isort (python) + stages: [push] + +# https://github.com/pre-commit/pre-commit/issues/761#issuecomment-394167542 +- repo: local + hooks: + - id: pytest + name: pytest + entry: venv/bin/pytest + language: script + pass_filenames: false + # alternatively you could `types: [python]` so it only runs when python files change + # though tests might be invalidated if you were to say change a data file + always_run: true + stages: [push] \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b4e0bc024..ae9c5d81e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,6 +20,8 @@ Best start by reading the [documentation](https://www.freqtrade.io/) to get a fe ## Before sending the PR +Do the following if you disabled pre-commit hook when commiting. + ### 1. Run unit tests All unit tests must pass. If a unit test is broken, change your code to diff --git a/setup.sh b/setup.sh index ebfabaca5..2c3a6710b 100755 --- a/setup.sh +++ b/setup.sh @@ -51,6 +51,7 @@ function updateenv() { echo "pip install in-progress. Please wait..." ${PYTHON} -m pip install --upgrade pip read -p "Do you want to install dependencies for dev [y/N]? " + dev=$REPLY if [[ $REPLY =~ ^[Yy]$ ]] then REQUIREMENTS=requirements-dev.txt @@ -88,6 +89,12 @@ function updateenv() { fi echo "pip install completed" echo + if [[ $dev =~ ^[Yy]$ ]] then + ${PYTHON} -m pre-commit install + if [ $? -ne 0 ]; then + echo "Failed installing pre-commit" + exit 1 + fi } # Install tab lib