tutor-android/Makefile
Abdul-Muqadim-Arbisoft a539ca2693 feat: migrate from pylint/black to ruff (#64)
* feat: migrate from pylint/black to ruff
Linked Epic: overhangio/tutor#1251

Some new rules that have been added are:

I: sort imports
N: check for pep8-naming standards
W292: check for missing extra line at EOF

Some of our lines, particularly in config break the 88 character line length limit. For that, we add a # noqa: E501 to let ruff know to ignore the rule for that line

* test: python package distribution build when running make test
Pushing to pypi would occasionally fail because of breaking distribution build.
We verify the build in the github CI now so that we can mitigate those errors later on.

* fix: install ruff instead of pylint/black as optional dev dependency
2025-09-07 19:44:37 +05:00

43 lines
1.5 KiB
Makefile
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

.DEFAULT_GOAL := help
.PHONY: docs
SRC_DIRS = ./tutorandroid
# Warning: These checks are not necessarily run on every PR.
test: test-lint test-types test-format test-pythonpackage # Run some static checks.
test-format: ## Run code formatting tests
ruff format --check --diff ${SRC_DIRS}
test-lint: ## Run code linting tests
ruff check ${SRC_DIRS}
test-types: ## Run type checks.
mypy --exclude=templates --ignore-missing-imports --implicit-reexport --strict ${SRC_DIRS}
build-pythonpackage: ## Build the "tutor-android" python package for upload to pypi
python -m build --sdist
test-pythonpackage: build-pythonpackage ## Test that package can be uploaded to pypi
twine check dist/tutor_android-$(shell make version).tar.gz
format: ## Format code automatically
ruff format ${SRC_DIRS}
fix-lint: ## Fix lint errors automatically
ruff check --fix ${SRC_DIRS}
changelog-entry: ## Create a new changelog entry.
scriv create
changelog: ## Collect changelog entries in the CHANGELOG.md file.
scriv collect
version: ## Print the current tutor-android version
@python -c 'import io, os; about = {}; exec(io.open(os.path.join("tutorandroid", "__about__.py"), "rt", encoding="utf-8").read(), about); print(about["__version__"])'
ESCAPE = 
help: ## Print this help
@grep -E '^([a-zA-Z_-]+:.*?## .*|######* .+)$$' Makefile \
| sed 's/######* \(.*\)/@ $(ESCAPE)[1;31m\1$(ESCAPE)[0m/g' | tr '@' '\n' \
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[33m%-30s\033[0m %s\n", $$1, $$2}'