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 hook #333

Merged
merged 4 commits into from Aug 12, 2020
Merged

Conversation

kidrahahjo
Copy link
Member

@kidrahahjo kidrahahjo commented Aug 3, 2020

Description

Enabling the support of pre-commit for pre-commit hook.
Developers will now have to perform these steps in order to enable the pre-commit hook.

pip install -r requirements-precommit.txt
pre-commit install

This will add the hook to git.

Motivation and Context

Types of Changes

  • Documentation update
  • Bug fix
  • New feature
  • Breaking change1

1The change breaks (or has the potential to break) existing functionality.

Checklist:

If necessary:

  • I have updated the API documentation as part of the package doc-strings.
  • I have created a separate pull request to update the framework documentation on signac-docs and linked it here.
  • I have updated the changelog.

@kidrahahjo kidrahahjo requested a review from bdice August 3, 2020 17:04
@kidrahahjo kidrahahjo requested review from a team as code owners August 3, 2020 17:04
@kidrahahjo kidrahahjo requested review from jennyfothergill and removed request for a team August 3, 2020 17:04
@mikemhenry
Copy link
Contributor

See glotzerlab/signac-docs#92 for how to setup pre-commit

Copy link

@jennyfothergill jennyfothergill left a comment

Choose a reason for hiding this comment

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

LGTM! I was able to install this with requirements-precommit.txt. I tested adding/committing a bad file with trailing whitespace and unused imports and the precommit tests failed when I tried to commit. This is definitely a great idea for keeping code clean and standard! :)
One question I have is why use a separate requirements file? It might be better to have the precommit requirements included with dev because I imagine we would want all developers to follow flake8.

@kidrahahjo
Copy link
Member Author

@jennyfothergill I agree but the developers use flake8 only before committing. Hence, I think we should keep all the pre-checks dependencies in a separate requirements file.
I proposed this for signac here and it was implemented in this manner by @bdice for signac.

@bdice
Copy link
Member

bdice commented Aug 4, 2020

@jennyfothergill Good question! The reason we split it is so that our CI doesn't have to install all the dependencies just to run the pre-checks. It speeds things up.

Copy link
Member

@bdice bdice left a comment

Choose a reason for hiding this comment

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

LGTM! Nice work @kidrahahjo.

@bdice bdice merged commit 5aedf0a into glotzerlab:master Aug 12, 2020
@bdice bdice added the GSoC Google Summer of Code label Aug 12, 2020
@bdice bdice added this to the v0.11.0 milestone Aug 12, 2020
kidrahahjo added a commit that referenced this pull request Aug 12, 2020
* Add pre-commit hook

* Edit circleci config file, add another file requirements-precommit.txt

* update changelog

* remove pre-check dependencies from requirements-dev.txt
kidrahahjo added a commit that referenced this pull request Sep 1, 2020
* Add pre-commit hook

* Edit circleci config file, add another file requirements-precommit.txt

* update changelog

* remove pre-check dependencies from requirements-dev.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GSoC Google Summer of Code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants