-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 for Code Formatting and Linting - Resolves #188 #323
Conversation
Thanks @smb-h, I appreciate your work and thinking here, and the focus on code quality is great. That said, as I noted in #188, I'm still not sold on This is for a few reasons:
We're currently working on shipping v2 with the key things we need to switch over to a more flexible templating CLI. This will allow us to have more extensibility and allow more options during the project configuration flow. At the same time, we're moving things into a roadmap for v2.1 where those are added options that use the new functionality. I'm open to discussing pre-commit for 2.1, but at the moment, it's my opinion it's not the right project default. |
For what it's worth, as a lurker, I can see why you might want to exclude it from the default (i.e. walk-before-you-can-run), but I'm generally in favour of pre-commit for most projects. This is for a few reasons:
|
Thanks, appreciate the comments @jamesmyatt. The last two points are well taken.
On this that I have often seen things go wrong when a dev runs |
I'd like to express my gratitude for your input, @jamesmyatt. Totally agree with you. I appreciate @pjbull perspective on dependency conflicts. While conflicts between I'd like to emphasize that, especially for growing projects like ours, maintaining a structured and standardized code and environment is crucial. Pre-commit hooks help us achieve this by enforcing code quality and formatting standards, ultimately contributing to the project's long-term maintainability and scalability. I understand that, in your opinion, this addition might not be deemed necessary at this moment. However, I'd like to emphasize that, from a software development perspective (acknowledging my limited experience), the inclusion of In my interactions with various teams and contributors, I've observed that such tools can be invaluable for maintaining code quality and consistency, especially in collaborative environments. That said, I respect your decision, and if the consensus leans towards not incorporating this change, I fully understand. I initially added it manually because I found it helpful for my own use of cookiecutter-data-science, and I noticed similar requests in our issues. My aim was to make the development experience smoother for others as well. Once again, I appreciate your engagement in this discussion, and I'm open to any outcome that aligns with our project's best interests. Thank you both for your valuable input and insights. |
Yes, agreed. We are on the same page here about the value of linting, formatting, and code standards. V2 has linting and formatting commands with flake8/black/isort for exactly this purpose. These commands will be able to be used both in git-native pre commit flows locally and also for CI/CD. I lean towards not adding the specific pre-commit tool as an additional layer on top of that. I will, however, start a discussion on this topic once we ship v2 so we can have other voices chime in. Appreciate the discussion! |
Description
This pull request addresses issue #188 by adding pre-commit hooks to enhance code quality and consistency in the
cookiecutter-data-science
project. The following tools have been integrated as pre-commit hooks:Additional Notes
The project documentation has been updated to include information on how to set up and use these pre-commit hooks.
The changes have been tested locally and do not introduce any regressions or errors.
This PR is ready for review and can be merged into the main branch.
This PR is a part of my ongoing effort to improve code quality and maintainability in the
cookiecutter-data-science
project. I look forward to your feedback and suggestions for further improvements.