-
Notifications
You must be signed in to change notification settings - Fork 44
Improve makefile and pre-commit #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ryansurf
merged 4 commits into
ryansurf:main
from
K-dash:improve-makefile-and-precommit
Jul 24, 2024
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a81f423
feat: Add Makefile targets and improve pre-commit hooks
K-dash ba8f166
chore: Configure pre-commit to run only Makefile's lint task
K-dash 2fc17b0
chore: Improve pytest configuration
K-dash 1a8d4bd
fix(docs): Update development setup steps and installation commands
K-dash File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,10 +1,17 @@ | ||
| repos: | ||
| - repo: https://github.com/charliermarsh/ruff-pre-commit | ||
| rev: v0.4.6 | ||
| - repo: local | ||
| hooks: | ||
| # Run the linter. | ||
| - id: ruff | ||
| entry: ruff check . --fix | ||
| - id: lint | ||
| name: Lint | ||
| entry: make lint | ||
| types: [python] | ||
| language: system | ||
| pass_filenames: false | ||
| # Run the formatter. | ||
| - id: ruff-format | ||
| args: [ . ] | ||
| - id: format | ||
| name: Format | ||
| entry: make format | ||
| types: [python] | ||
| language: system | ||
| pass_filenames: false |
This file contains hidden or 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 hidden or 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 hidden or 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,25 +1,68 @@ | ||
| .PHONY: run run_docker test test_docker post_test docker_post_test send_email send_email_docker | ||
| .DEFAULT_GOAL := all | ||
| sources = src tests | ||
|
|
||
| .PHONY: install | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This install target is great |
||
| install: | ||
| poetry install | ||
| poetry shell | ||
| pre-commit install | ||
|
|
||
| .PHONY: run | ||
| run: | ||
| poetry run python src/server.py | ||
|
|
||
| .PHONY: format | ||
| format: | ||
| poetry run ruff check --fix $(sources) | ||
| poetry run ruff format $(sources) | ||
|
|
||
| .PHONY: lint | ||
| lint: | ||
| poetry run ruff check $(sources) | ||
| poetry run ruff format --check $(sources) | ||
|
|
||
| .PHONY: run_docker | ||
| run_docker: | ||
| docker compose up -d | ||
|
|
||
| .PHONY: test | ||
| test: | ||
| poetry run pytest -s -x --cov=src -vv | ||
| poetry run pytest | ||
|
|
||
| .PHONY: test_docker | ||
| test_docker: | ||
| docker compose exec flask poetry run pytest -s -x --cov=src -vv | ||
| docker compose exec flask poetry run pytest | ||
|
|
||
| .PHONY: output_coverage | ||
| output_coverage: | ||
| poetry run coverage html | ||
| @rm -rf htmlcov | ||
| @mkdir -p htmlcov | ||
| poetry run coverage run -m pytest | ||
| poetry run coverage report | ||
| poetry run coverage html -d htmlcov | ||
|
|
||
| .PHONY: output_coverage_docker | ||
| output_coverage_docker: | ||
| docker compose exec flask poetry run coverage html | ||
| @docker compose exec flask rm -rf htmlcov | ||
| @docker compose exec flask mkdir -p htmlcov | ||
| docker compose exec flask poetry run coverage run -m pytest | ||
| docker compose exec flask poetry run coverage report | ||
| docker compose exec flask poetry run coverage html -d htmlcov | ||
|
|
||
| .PHONY: send_email | ||
| send_email: | ||
| poetry run python src/send_email.py | ||
|
|
||
| .PHONY: send_email_docker | ||
| send_email_docker: | ||
| docker compose exec flask poetry run python src/send_email.py | ||
|
|
||
| .PHONY: clean | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good addition |
||
| clean: | ||
| rm -rf htmlcov | ||
| rm -rf .pytest_cache | ||
| rm -f .coverage | ||
| rm -f .coverage.* | ||
|
|
||
| .PHONY: all | ||
| all: format lint test | ||
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much more simple for potential contributors, nice!