8000 pre-commit add manual hooks bundle `install` and `audit` by jbampton · Pull Request #6692 · mruby/mruby · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@jbampton
Copy link
Contributor

refs #6597

Ruby Dependency Hooks (Manual)

We use pre-commit to manage our local development checks. The hooks for bundle-install and bundle-audit are configured as manual stages to balance security with development speed.

Why Manual Hooks?

1. Zero Friction Workflow

Standard hooks run on every git commit. Because bundle-audit requires a network connection to update its database, moving it to a manual stage ensures your daily commits remain instant.

2. Intelligent Triggering

Even though these are manual, they still respect the files filter. They will only run if Gemfile or Gemfile.lock have been modified, preventing wasted time during unrelated code changes.

3. Standardized Audits

Defining this in .pre-commit-config.yaml ensures every developer uses the same command and updates the ruby-advisory-db before scanning, keeping the team in sync.


Usage Instructions

Trigger these before pushing a Pull Request or after modifying dependencies.

Run all manual hooks

pre-commit run --hook-stage manual

Run only the security audit

pre-commit run bundle-audit --hook-stage manual

Run on all files (CI/CD mode)

pre-commit run --all-files --hook-stage manual


Hook Descriptions

Hook ID Description
bundle-install Ensures the local environment matches the Gemfile.lock.
bundle-audit Checks for known vulnerabilities (CVEs) in your gems.

@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 enhances the project's development workflow by integrating new manual pre-commit hooks for Ruby dependency management and security auditing. The bundle-install hook ensures local environments match the Gemfile.lock, while the bundle-audit hook scans for known vulnerabilities. These hooks are designed to be explicitly triggered by developers, offering a flexible approach to maintaining code quality and security without disrupting the standard commit process. The necessary bundler-audit gem has also been added to the project's dependencies.

Highlights

  • New Manual Pre-Commit Hooks: Introduced two new manual pre-commit hooks: bundle-install to ensure local Ruby environments are in sync with Gemfile.lock, and bundle-audit to scan for security vulnerabilities in dependencies.
  • Manual Stage Configuration: Both bundle-install and bundle-audit hooks are configured to run in the manual stage. This design choice balances security and environment consistency with development speed, preventing automatic execution on every commit while still allowing intelligent triggering based on file changes.
  • Dependency Management: The bundler-audit gem has been added to the development and test groups in the Gemfile, and the Gemfile.lock has been updated to reflect this new dependency, including a Bundler version bump and the addition of checksums for all gems.

🧠 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 manual pre-commit hooks for bundle-install and bundle-audit, which is a great way to standardize dependency installation and security scanning without slowing down the regular commit workflow. The implementation is solid, and I've provided a couple of suggestions for the .pre-commit-config.yaml file to make the hook commands more efficient and concise.

@jbampton jbampton marked this pull request as draft December 30, 2025 11:19
@jbampton jbampton force-pushed the pre-commit-add-bundle-audit branch from 1fcf387 to b987d8c Compare December 30, 2025 12:05
@jbampton jbampton marked this pull request as ready for review December 30, 2025 12:34
@jbampton
Copy link
Contributor Author

/gemini review

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 two useful manual pre-commit hooks: bundle-install to ensure dependencies are in sync, and bundle-audit to check for security vulnerabilities in gems. The rationale for making them manual hooks is well-explained and sensible for maintaining a fast development workflow. The changes are clear and well-implemented. I've added a couple of suggestions to simplify the hook definitions in .pre-commit-config.yaml for better maintainability.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0