Skip to content

Conversation

yzh119
Copy link
Collaborator

@yzh119 yzh119 commented Oct 2, 2025

πŸ“Œ Description

πŸ” Related Issues

πŸš€ Pull Request Checklist

Add clang-tidy linter for C++/CUDA codebase as part of pre-commits

βœ… Pre-commit Checks

  • I have installed pre-commit by running pip install pre-commit (or used your preferred method).
  • I have installed the hooks with pre-commit install.
  • I have run the hooks manually with pre-commit run --all-files and fixed any reported issues.

If you are unsure about how to set up pre-commit, see the pre-commit documentation.

πŸ§ͺ Tests

  • Tests have been added or updated as needed.
  • All tests are passing (unittest, etc.).

Reviewer Notes

Copy link
Contributor

Summary of Changes

Hello @yzh119, 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 integrates clang-tidy into the project's pre-commit workflow. The primary goal is to enhance code quality and consistency for C++/CUDA components by automatically checking for common errors, style violations, and potential improvements before code is committed. This setup includes a detailed configuration for clang-tidy checks and ensures its application to relevant source files.

Highlights

  • Clang-Tidy Integration: Introduces clang-tidy as a new pre-commit hook to enforce C++/CUDA coding standards and identify potential issues.
  • Clang-Tidy Configuration: A new .clang-tidy configuration file has been added, specifying a comprehensive set of enabled and disabled checks, header filtering rules, and detailed naming conventions for various code elements (namespaces, classes, functions, variables, etc.).
  • Pre-commit Hook Setup: The .pre-commit-config.yaml file has been updated to include the clang-tidy hook, configured to run on C++, C, and CUDA files within the include and csrc directories, while excluding 3rdparty code.
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
Contributor

@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 clang-tidy as a pre-commit hook to lint the C++/CUDA codebase, which is a great addition for maintaining code quality. The configuration is added in a new .clang-tidy file and the hook is defined in .pre-commit-config.yaml. My review found a potential misconfiguration in the .clang-tidy file that could lead to unexpected linting behavior for member variables. Please see the specific comment for details and a suggested fix.

- key: readability-identifier-naming.ParameterCase
value: lower_case
- key: readability-identifier-naming.MemberCase
value: lower_case_
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The value lower_case_ for MemberCase seems incorrect, especially in combination with PrivateMemberSuffix: '_'. This configuration implies that non-private member variables must end with an underscore (e.g., var_), and private member variables must end with a double underscore (e.g., var__) to pass the linter. This is likely not the intended style.

This is also inconsistent with VariableCase and ParameterCase which are set to lower_case.

For a more conventional style where private members are suffixed with an underscore and public members are not, you should set MemberCase to lower_case.

    value: lower_case

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.

1 participant