-
Notifications
You must be signed in to change notification settings - Fork 824
pre-commit: validate hooks and auto create docs with Python #6590
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
base: master
Are you sure you want to change the base?
Conversation
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.
Summary of Changes
Hello @jbampton, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request significantly enhances the project's CI/CD automation by implementing a system to automatically generate and maintain documentation for all configured pre-commit hooks. This ensures that the project's code quality and style standards are transparently documented and easily accessible to all contributors.
Highlights
- Automated Pre-Commit Hook Documentation: Introduced a new
create-pre-commit-docslocal hook in.pre-commit-config.yaml. This Python-based hook automatically generates a Markdown file (doc/guides/pre-commit-hooks.md) detailing all configured pre-commit hooks, including their IDs, names, descriptions, and versions. - Enhanced Pre-Commit Hook Definitions: Updated existing pre-commit hook definitions within
.pre-commit-config.yamlby addingnameanddescriptionfields. This enrichment provides the necessary metadata for the new documentation generation script to produce comprehensive and informative output. - Documentation File Management: Added
doc/guides/pre-commit-hooks.mdas the target file for the auto-generated pre-commit hook documentation. This file has also been added to.prettierignoreto prevent automatic formatting, ensuring the generated content remains as intended. - Dependency Management: A new
requirements.txtfile was added to manage Python dependencies, specifically includingpre-commitandpyyaml, which are required for the new documentation generation script.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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.
Code Review
This pull request introduces a new pre-commit hook to automatically generate documentation for all configured hooks.
7bc42d5 to
18d417e
Compare
|
/gemini 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.
Code Review
This pull request introduces a great automation for generating documentation for the pre-commit hooks, which will improve the project's maintainability. The changes to .pre-commit-config.yaml to add names and descriptions are a good step towards self-documenting configuration.
I've found a few issues that should be addressed:
- There's a critical error in the description of one of the hooks in
.pre-commit-config.yaml. - The new
requirements.txtfile is missing version pinning for dependencies, which can cause issues with build reproducibility. - The generated documentation could be more accurate regarding the language of each hook.
Please see my detailed comments for suggestions on how to fix these issues.
d69ebf2 to
9da33b1
Compare
|
/gemini 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.
Code Review
This pull request introduces a great automation for validating the pre-commit configuration and generating documentation for the hooks. The changes to .pre-commit-config.yaml to add names and descriptions to all hooks are extensive but necessary for the new tooling.
However, the main implementation files, .github/workflows/scripts/pre_commit_hooks_validator.py and .github/workflows/scripts/create_pre_commit_docs.py, are missing from this PR. They are referenced in .pre-commit-config.yaml but not included in the changes, so I cannot review the core logic. Please add them to the pull request.
I've added a few specific comments on the files that are present regarding dependency management, configuration consistency, and the accuracy of the generated documentation.
9da33b1 to
647e435
Compare
Adds some more automation by creating some pre-commit hook docs in Markdown