From ba7c852b647f55cb98e747e73d0c7e98a9a458a5 Mon Sep 17 00:00:00 2001 From: Iain Samuel McLean Elder Date: Wed, 20 Apr 2022 00:18:28 +0200 Subject: [PATCH] Refer to correct black version (#5038) --- CONTRIBUTING.md | 2 +- Makefile | 3 ++- docs/docs/contributing/faq.rst | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3f8af617b..3cee7c392 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,7 +23,7 @@ You should be able to run `make init` to install the dependencies and then `make ## Linting -Ensure that the correct version of black is installed - `black==19.10b0`. (Different versions of black will return different results.) +Ensure that the correct version of black is installed (see `requirements-dev.txt`). Different versions of black will return different results. Run `make lint` to verify whether your code confirms to the guidelines. Use `make format` to automatically format your code, if it does not conform to `black`'s rules. diff --git a/Makefile b/Makefile index e16ece955..f5f240d54 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,8 @@ lint: @echo "Running flake8..." flake8 moto tests @echo "Running black... " - @echo "(Make sure you have black-22.1.0 installed, as other versions will produce different results)" + $(eval black_version := $(shell grep -oP "(?<=black==).*" requirements-dev.txt)) + @echo "(Make sure you have black-$(black_version) installed, as other versions will produce different results)" black --check moto/ tests/ @echo "Running pylint..." pylint -j 0 moto tests diff --git a/docs/docs/contributing/faq.rst b/docs/docs/contributing/faq.rst index 279b7be0c..912b97b39 100644 --- a/docs/docs/contributing/faq.rst +++ b/docs/docs/contributing/faq.rst @@ -16,7 +16,8 @@ When running the linter... Why does black give different results? **************************************** Different versions of black produce different results. -To ensure that our CI passes, please format the code using :bash:`black==19.10b0`. +The CI system uses the version set in `requirements-dev.txt`. +To ensure that our CI passes, please format the code using the same version. When running a test... #########################