8000 pre-commit add hook to ensure all hooks have descriptions by jbampton · Pull Request #6693 · mruby/mruby · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@jbampton
Copy link
Contributor
@jbampton jbampton commented Dec 30, 2025

First run of the hook / script and the hook failed and printed below:

run check-hooks-apply....................................................Passed
check hook descriptions..................................................Failed
- hook id: check-hook-descriptions
- exit code: 1

FAIL: 19 hook(s) failed documentation requirements.
================================================================================
  [!] Repo: https://github.com/pre-commit/pre-commit-hooks | Hook: check-added-large-files -> Missing 'description' key.
  [!] Repo: https://github.com/pre-commit/pre-commit-hooks | Hook: check-case-conflict -> Missing 'description' key.
  [!] Repo: https://github.com/pre-commit/pre-commit-hooks | Hook: check-executables-have-shebangs -> Missing 'description' key.
  [!] Repo: https://github.com/pre-commit/pre-commit-hooks | Hook: check-illegal-windows-names -> Missing 'description' key.
  [!] Repo: https://github.com/pre-commit/pre-commit-hooks | Hook: pretty-format-json -> Missing 'description' key.
  [!] Repo: https://github.com/pre-commit/pre-commit-hooks | Hook: check-json -> Missing 'description' key.
  [!] Repo: https://github.com/pre-commit/pre-commit-hooks | Hook: check-merge-conflict -> Missing 'description' key.
  [!] Repo: https://github.com/pre-commit/pre-commit-hooks | Hook: check-shebang-scripts-are-executable -> Missing 'description' key.
  [!] Repo: https://github.com/pre-commit/pre-commit-hooks | Hook: check-vcs-permalinks -> Missing 'description' key.
  [!] Repo: https://github.com/pre-commit/pre-commit-hooks | Hook: check-yaml -> Missing 'description' key.
  [!] Repo: https://github.com/pre-commit/pre-commit-hooks | Hook: destroyed-symlinks -> Missing 'description' key.
  [!] Repo: https://github.com/pre-commit/pre-commit-hooks | Hook: detect-aws-credentials -> Missing 'description' key.
  [!] Repo: https://github.com/pre-commit/pre-commit-hooks | Hook: detect-private-key -> Missing 'description' key.
  [!] Repo: https://github.com/pre-commit/pre-commit-hooks | Hook: end-of-file-fixer -> Missing 'description' key.
  [!] Repo: https://github.com/pre-commit/pre-commit-hooks | Hook: file-contents-sorter -> Missing 'description' key.
  [!] Repo: https://github.com/pre-commit/pre-commit-hooks | Hook: fix-byte-order-marker -> Missing 'description' key.
  [!] Repo: https://github.com/pre-commit/pre-commit-hooks | Hook: forbid-submodules -> Missing 'description' key.
  [!] Repo: https://github.com/pre-commit/pre-commit-hooks | Hook: mixed-line-ending -> Missing 'description' key.
  [!] Repo: https://github.com/pre-commit/pre-commit-hooks | Hook: trailing-whitespace -> Missing 'description' key.
================================================================================
Tip: Ensure each hook has a 'description' of 15+ chars.

disallow zip files...................................(no files to check)Skipped

@jbampton jbampton requested a review from matz as a code owner December 30, 2025 13:29
@github-actions github-actions bot added the build label Dec 30, 2025
@gemini-code-assist
Copy link

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 improves the maintainability and clarity of the project's pre-commit configuration by introducing a new validation step. This ensures that every pre-commit hook is adequately documented with a clear and sufficiently long description, making the purpose and function of each hook immediately understandable to all contributors.

Highlights

  • New Pre-Commit Hook: A new pre-commit hook, check-hook-descriptions, has been added to enforce that all pre-commit hooks have a descriptive explanation.
  • Description Enforcement Logic: A new Python script, scripts/pre-commit/check_hook_descriptions.py, was introduced to validate the presence and minimum length (15 characters) of hook descriptions within the .pre-commit-config.yaml file.
  • Existing Hook Documentation: Numerous existing pre-commit hooks in the .pre-commit-config.yaml file have been updated with description fields to comply with the newly enforced documentation standard.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

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

  1. 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.

Copy link
@gemini-code-assist gemini-code-assist bot left a 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 ensure all hooks in the configuration have a description. This is a valuable addition for maintaining a clear and self-documenting .pre-commit-config.yaml. The implementation is solid, with a new Python script to perform the validation and updates to the configuration file to add the new hook and descriptions for existing ones. My review includes one suggestion to modernize the YAML parsing in the Python script for better code clarity and maintainability.

Comment on lines +36 to +38
# Use CSafeLoader if available for better performance on large files
loader = getattr(yaml, 'CSafeLoader', yaml.SafeLoader)
config = yaml.load(f, Loader=loader)

Choose a reason for hiding this comment

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

medium

For improved code clarity and to adhere to modern PyYAML API usage, it's better to use yaml.safe_load() directly. This function is the recommended safe way to parse YAML and it will automatically use the faster C-based loader (CSafeLoader) if it's available, so the explicit check is not necessary.

Suggested change
# Use CSafeLoader if available for better performance on large files
loader = getattr(yaml, 'CSafeLoader', yaml.SafeLoader)
config = yaml.load(f, Loader=loader)
config = yaml.safe_load(f)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0