diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index df1f6a7ef..81f22ba8f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -128,24 +128,29 @@ We recommend that your contribution complies with the following guidelines befor ```bash make check_lint ``` - If you want to fix linting errors automatically, run +- If you want to fix linting errors automatically, run ```bash make lint ``` -1. To run tests: +- To run tests: ```bash make test ``` -6. To check code style: +- To check code style: ```bash - make check_lint + make check_format ``` +- To fix code style automatically: + + ```bash + make format + ``` ## Overview of the MMM codebase diff --git a/Makefile b/Makefile index ce5b63ab3..6ddfc040f 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,28 @@ -.PHONY: init lint check_lint test html cleandocs run_notebooks +.PHONY: init lint check_lint format check_format test html cleandocs run_notebooks uml + +PACKAGE_DIR = pymc_marketing init: python3 -m pip install -e . lint: pip install .[lint] - ruff . --fix + ruff check $(PACKAGE_DIR) --fix mypy . check_lint: pip install .[lint] - ruff . + ruff check $(PACKAGE_DIR) mypy . +format: + pip install .[lint] + ruff format $(PACKAGE_DIR) + +check_format: + pip install .[lint] + ruff format --check $(PACKAGE_DIR) + test: pip install .[test] pytest