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

feat: pre-commit-python-hooks #159

Merged
merged 10 commits into from
Jan 10, 2023
Merged

feat: pre-commit-python-hooks #159

merged 10 commits into from
Jan 10, 2023

Conversation

axiomofjoy
Copy link
Contributor

@axiomofjoy axiomofjoy commented Jan 9, 2023

Sets up pre-commit hook framework. Currently set up for formatting Python code, but in theory should work for the UI code as well.

This framework:

  • is language-agnostic,
  • has a large ecosystem of supported hooks,
  • supports creation of custom hooks if necessary,
  • looks like it will easily integrate with GitHub Actions, so we can run the same .pre-commit-config.yaml in the pipeline, can consolidate some of our actions and simplify our pipeline,
  • has a lot of stars and contributors on its GitHub page,
  • feels pretty simple to use, I got it running quickly.

Comment on lines 5 to 11
- id: isort
- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Runs with tool-specific config defined in pyproject.toml.

@axiomofjoy axiomofjoy marked this pull request as ready for review January 9, 2023 09:39
@axiomofjoy axiomofjoy merged commit 999a524 into main Jan 10, 2023
@axiomofjoy axiomofjoy deleted the feat/pre-commit-python-hooks branch January 10, 2023 09:15
@axiomofjoy
Copy link
Contributor Author

axiomofjoy commented Jan 10, 2023

Tried to incorporate eslint and prettier into the pre-commit framework, but did not get it to work. Looks like a known issue. Best solution I can see long-term is to use husky for the UI, pre-commit for the Python code and handle multiple pre-commit hooks using Make down the line. Punting for now. Would hold off on installing the Python pre-commit hooks for the time being if you use husky, as they will mess up your husky setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants