diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 824b748c..12277331 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -23,7 +23,7 @@ jobs: poetry install - name: Format check with black run: | - make format + make format-check - name: Typecheck with mypy run: | make typecheck diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 374b4e85..b9650cee 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -45,4 +45,8 @@ Please add type annotations for all new code. ### Code Formatting -Rich uses `black` for code formatting. I recommend setting up black in your editor to format on save. +Rich uses [`black`](https://github.com/psf/black) for code formatting. +I recommend setting up black in your editor to format on save. + +To run black from the command line, use `make format-check` to check your formatting, +and use `make format` to format and write to the files. \ No newline at end of file diff --git a/Makefile b/Makefile index a4c62de2..6bed4f76 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,9 @@ test: pytest --cov-report term-missing --cov=rich tests/ -vv +format-check: + black --check . format: - black --check rich tests + black . typecheck: mypy -p rich --ignore-missing-imports --warn-unreachable typecheck-report: