mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-03 12:50:06 +06:00

* [code quality] merge style and quality targets Any reason why we don't run `flake8` in `make style`? I find myself needing to run `make style` and `make quality` all the time, but I need the latter just for the last 2 checks. Since we have no control over the source code why bother with separating checking and fixing - let's just have one target that fixes and then performs the remaining checks, as we know the first two have been done already. This PR suggests to merge the 2 targets into one efficient target. I will edit the docs if this change resonates with the team. * move checks into style, re-use target * better name * add fixup target * document new target
42 lines
995 B
Makefile
42 lines
995 B
Makefile
.PHONY: quality_checks quality style fixup test test-examples docs
|
|
|
|
# Check that source code meets quality standards
|
|
|
|
quality_checks:
|
|
flake8 examples templates tests src utils
|
|
python utils/check_copies.py
|
|
python utils/check_repo.py
|
|
|
|
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:
|
|
python utils/check_copies.py --fix_and_overwrite
|
|
|
|
# Run tests for the library
|
|
|
|
test:
|
|
python -m pytest -n auto --dist=loadfile -s -v ./tests/
|
|
|
|
# Run tests for examples
|
|
|
|
test-examples:
|
|
python -m pytest -n auto --dist=loadfile -s -v ./examples/
|
|
|
|
# Check that docs can build
|
|
|
|
docs:
|
|
cd docs && make html SPHINXOPTS="-W"
|