-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
104 additions
and
407 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,50 @@ | ||
# Directories | ||
SRC_DIRS := src/ test/ # FIXME | ||
SRC_DIRS := project_name/ test/ # FIXME | ||
|
||
# Tasks | ||
.PHONY: help | ||
help: | ||
@echo "Available targets:" | ||
@echo " format : Format code using Black and isort" | ||
@echo " check_format : Check code formatting with Black and isort" | ||
@echo " lint : Run pylint and Mypy for static code analysis" | ||
@echo " format : Format code using Ruff format" | ||
@echo " check_format : Check code formatting with Ruff format" | ||
@echo " lint : Run Ruff linter and Mypy for static code analysis" | ||
@echo " test : Run tests using pytest" | ||
@echo " clean : Clean up caches and build artifacts" | ||
@echo " run_local_checks : Run format, lint, and test" | ||
@echo " help : Show this help message" | ||
|
||
.PHONY: format | ||
format: | ||
@echo "==> Formatting code..." | ||
@poetry run black $(SRC_DIRS) | ||
@echo "==> Sorting imports..." | ||
@poetry run isort $(SRC_DIRS) | ||
@# Currently, the Ruff formatter does not sort imports, see https://docs.astral.sh/ruff/formatter/#sorting-imports | ||
@poetry run ruff check --select I --fix $(SRC_DIRS) | ||
@echo "=====> Formatting code..." | ||
@poetry run ruff format $(SRC_DIRS) | ||
|
||
.PHONY: check_format | ||
check_format: | ||
@echo "==> Checking format..." | ||
@poetry run black --check --diff $(SRC_DIRS) | ||
@echo "==> Checking isort..." | ||
@poetry run isort --check --diff $(SRC_DIRS) | ||
@echo "=====> Checking format..." | ||
@poetry run ruff format --check --diff $(SRC_DIRS) | ||
@echo "=====> Checking imports are sorted..." | ||
@poetry run ruff check --select I --exit-non-zero-on-fix $(SRC_DIRS) | ||
|
||
|
||
.PHONY: lint | ||
lint: | ||
@echo "==> Running pylint..." | ||
@poetry run pylint $(SRC_DIRS) | ||
@echo "==> Running Mypy..." | ||
@echo "=====> Running Ruff linter..." | ||
@poetry run ruff check $(SRC_DIRS) | ||
@echo "=====> Running Mypy..." | ||
@poetry run mypy $(SRC_DIRS) | ||
|
||
.PHONY: test | ||
test: | ||
@echo "==> Running tests..." | ||
@echo "=====> Running tests..." | ||
@poetry run pytest | ||
|
||
.PHONY: clean | ||
clean: | ||
@echo "==> Cleaning caches..." | ||
@find ./ -name '*.pyc' -exec rm -f {} \; | ||
@find ./ -name '__pycache__' -exec rm -rf {} \; | ||
@rm -rf .cache | ||
@rm -rf .pytest_cache | ||
@rm -rf .mypy_cache | ||
@rm -rf build | ||
@rm -rf dist | ||
@rm -rf *.egg-info | ||
@echo "=====> Cleaning caches..." | ||
@poetry run ruff clean | ||
@rm -rf .cache .pytest_cache .mypy_cache build dist *.egg-info | ||
|
||
run_local_checks: format lint test |
Oops, something went wrong.