-
Notifications
You must be signed in to change notification settings - Fork 807
Add pre-commit hooks #1083
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 #1083
Conversation
pre-commit (https://pre-commit.com/) is a tool that helps you easily manage pre-commit hooks. We are using this largely for quality control by running tools like flake8 and black.
Fix the versions of black, flake8, and isort in travis so that the same versions are being used to pass/fail the build as developers are using in their pre-commit hooks
Co-authored-by: Shreya Malviya <shreya.malviya@gmail.com>
@@ -24,7 +24,7 @@ install: | |||
# Python | |||
- pip freeze | |||
- pip install -r monkey/monkey_island/requirements.txt # for unit tests | |||
- pip install flake8 pytest pytest-cov dlint isort # for next stages | |||
- pip install black==20.8b1 flake8==3.9.0 pytest pytest-cov dlint isort==5.8.0 # for next stages |
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.
Make sure we use the same in our requirement file for island
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.
pre-commit uses the .pre-commit-config.yaml
to track these requirements. I believe it installs them in a virtualenv separate from the rest of the python libraries on the system. You can then run all of the hooks using pre-commit run
or pre-commit run -a
.
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.
Approved, but make sure that travis dependencies match island's.
What does this PR do?
Adds pre-commit config. Resolves #974.
Includes pre-commit hooks for black, flake8, and isort.
PR Checklist
Testing Checklist