-
-
Notifications
You must be signed in to change notification settings - Fork 155
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
chore: add isort as pre-commit hook #319
Conversation
Ready for Review :) |
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.
Thanks @Mustaballer ! Just a few small things 🙏
README.md
Outdated
@@ -226,6 +226,29 @@ In summary (from https://stackoverflow.com/a/69673312): | |||
alembic revision --autogenerate -m "<msg>" | |||
``` | |||
|
|||
### Pre-commit Hooks | |||
|
|||
To ensure code quality and consistency, OpenAdapt uses pre-commit hooks. These hooks will be executed automatically before each commit to perform various checks and validations on your codebase. |
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.
Can we also add a pre-commit hook to split long lines like this one onto multiple lines? 😅
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.
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.
* Add precommit hooks for isort, check-yaml, end-of-file-fixer, trailing-whitespaces * Updated README on setting up precommit hooks * Add updated poetry.lock * Fix step numbering of pre-commit section in README.md
What kind of change does this PR introduce?
Adds pre-commit hooks namely isort, check-yaml, end-of-file-fixer, trailing-whitespace.
Summary
At the moment, OpenAdapt does not provide an automated way to sort imports. However, we have incorporated the isort pre-commit hook, which detects unsorted imports and rejects a commit if they are found. If any unsorted imports are detected, isort will automatically modify the affected files to sort the imports correctly. This helps maintain consistent import organization across the codebase. The other hooks I added I believe are useful and are listed below.
Checklist
How can your code be run and tested?
poetry install
pre-commit install
note: in root directory