Skip to content
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

Add pre-commit hooks to automatically format code on git commit #18

Merged
merged 2 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pypi-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}
python_version: 3.9
python_version: 3.9
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ venv.bak/
*.png

**/.DS_Store

# IDE config
.idea/
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 24.2.0
hooks:
- id: black
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ pip install poetry
# Install dependencies
poetry install

# Setup pre-commit hooks
poetry run pre-commit install

# Run the tool
poetry run shadowfinder --help

Expand Down
163 changes: 162 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pytz = "^2024.1"

[tool.poetry.group.dev.dependencies]
black = "^24.2.0"
pre-commit = "^3.7.1"


[build-system]
Expand Down
2 changes: 1 addition & 1 deletion shadowfinder/shadowfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def set_details(
# either height or angle must be set (but not both or neither)
# fmt: off
valid_input = (
((object_height is None) == (shadow_length is None)) and
((object_height is None) == (shadow_length is None)) and
((object_height is None) or (sun_altitude_angle is None))
)
# fmt: on
Expand Down
2 changes: 1 addition & 1 deletion timezone_grid.json

Large diffs are not rendered by default.