-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Assorted testing and linting improvements: * Makefile with test and lint targets * Long lines reformated with black * Sort imports with isort And in addition: * gh_refs_path changed to get_github_refs_path Instead of only returning heads or tags, and appending it to a GitHub url, the function now accepts an owner and a name and return the full refs path.
- Loading branch information
1 parent
3930d65
commit 0ef470b
Showing
5 changed files
with
94 additions
and
18 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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Run tests | ||
|
||
on: | ||
pull_request: | ||
branches: [master] | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: Upgrade pip | ||
run: python -m pip install --upgrade pip setuptools | ||
- name: Install dependencies | ||
run: | | ||
pip install black==23.7.0 \ | ||
isort==5.12.0 \ | ||
mypy==1.5.1 \ | ||
pylint==2.17.5 \ | ||
pytest==7.4.2 \ | ||
tutor==16.1.2 \ | ||
types-docutils==0.20.0.3 \ | ||
types-pyyaml==6.0.12.11 \ | ||
types-setuptools==68.1.0.0 | ||
- name: Test lint, types, and format | ||
run: make test |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
.DEFAULT_GOAL := help | ||
.PHONY: docs | ||
SRC_DIRS = ./tutormfe | ||
BLACK_OPTS = --exclude templates ${SRC_DIRS} | ||
|
||
# Warning: These checks are run on every PR. | ||
test: test-lint test-types test-format # Run some static checks. | ||
|
||
test-format: ## Run code formatting tests. | ||
black --check --diff $(BLACK_OPTS) | ||
|
||
test-lint: ## Run code linting tests | ||
pylint --errors-only --enable=unused-import,unused-argument --ignore=templates --ignore=docs/_ext ${SRC_DIRS} | ||
|
||
test-types: ## Run type checks. | ||
mypy --exclude=templates --ignore-missing-imports --implicit-reexport --strict ${SRC_DIRS} | ||
|
||
format: ## Format code automatically. | ||
black $(BLACK_OPTS) | ||
|
||
isort: ## Sort imports. This target is not mandatory because the output may be incompatible with black formatting. Provided for convenience purposes. | ||
isort --skip=templates ${SRC_DIRS} | ||
|
||
changelog-entry: ## Create a new changelog entry. | ||
scriv create | ||
|
||
changelog: ## Collect changelog entries in the CHANGELOG.md file. | ||
scriv collect | ||
|
||
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}' |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
- [Improvement] Added Makefile and test action to repository and formatted code with Black and isort. (by @CodeWithEmad) |
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
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