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 precommit #76

Merged
merged 4 commits into from
Dec 19, 2021
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
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: check-merge-conflict
- id: trailing-whitespace
- id: end-of-file-fixer

- repo: https://github.com/psf/black
rev: 21.5b1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this just to match the current version enforced in the CI

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's the option of turning off git hooks with git commit --no-verify -m '<insert-commit-message>'. But that's a hack IMO. I didn't pytest because I noticed that the repository already has CI that runs on every PR which also runs pytest.

hooks:
- id: black
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ Additional dependencies are needed for formatting and testing:
pip install -r requirements-dev.txt
```

## Automatic commit checking

You can use `pre-install` to ensure everything is ready to be submitted in a
pull request. Once `pip` installed, `pre-commit` must be installed once (only
the first time being used): `pre-commit install`. Formatting checks are then
run for every commit.

`PRE_COMMIT_ALLOW_NO_CONFIG=1 git commit ...` can be used to selectively skip
these checks.

Checks can instead be done manually, described below.

## Code formatting

HydraGNN is formatted with `black`. You should run `black .` from the top level
Expand Down
3 changes: 2 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
black
black==21.5b1
pre-commit
pytest
pytest-mpi