diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 630b6b2db6..857f351695 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -170,13 +170,19 @@ Follow these steps to start contributing: $ make style ``` - `transformers` also uses `flake8` to check for coding mistakes. Quality + `transformers` also uses `flake8` and a few custom scripts to check for coding mistakes. Quality control runs in CI, however you can also run the same checks with: ```bash $ make quality ``` + You can do the automatic style corrections and code verifications that can't be automated in one go: + + ```bash + $ make fixup + ``` + If you're modifying documents under `docs/source`, make sure to validate that they can still be built. This check also runs in CI. To run a local check make sure you have installed the documentation builder requirements, by diff --git a/Makefile b/Makefile index 6aef4b10f7..878d6885eb 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,25 @@ -.PHONY: quality style test test-examples docs +.PHONY: quality_checks quality style fixup test test-examples docs # Check that source code meets quality standards -quality: - black --check examples templates tests src utils - isort --check-only examples templates tests src utils +quality_checks: flake8 examples templates tests src utils python utils/check_copies.py python utils/check_repo.py -# Format source code automatically +quality: + black --check examples templates tests src utils + isort --check-only examples templates tests src utils + ${MAKE} quality_checks + +# Format source code automatically and check is there are any problems left that need manual fixing style: black examples templates tests src utils isort examples templates tests src utils +fixup: style quality_checks + # Make marked copies of snippets of codes conform to the original fix-copies: