-
Notifications
You must be signed in to change notification settings - Fork 825
Add pre-commit hook protolint for Protocol Buffer files
#6527
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
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.
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!
Summary of Changes
This pull request addresses an indentation issue found by the Super-Linter in the ruby.proto file. The changes involve standardizing the indentation to use two spaces within message and enum definitions, improving the file's readability and consistency.
Highlights
- Indentation Fix: The primary focus is to correct the indentation throughout the
ruby.protofile, ensuring consistent formatting. - Super-Linter: The issue was initially identified by the Super-Linter, highlighting the importance of automated code quality checks.
Changelog
- oss-fuzz/ruby.proto
- Standardized indentation within message definitions (e.g., VarRef, ArrType, KVPair, HashType, StringExtNoArg, MathConst, Const, BinaryOp, UnaryOp, Rvalue, IfElse, Ternary, ObjectSpace, Time, Array, MathType, MathOps, BuiltinFuncs, Statement).
- Corrected indentation within enum definitions (e.g., MathConstLit, OS_methods, T_methods, Arr_methods, Mops).
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 is currently in preview and 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 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.
Two spaces neatly aligned,
Code's beauty, refined.
Linter's keen eye,
Catches errors nigh,
Readability defined.
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
The pull request addresses indentation issues in the ruby.proto file, identified by the Super-Linter. The changes appear to be straightforward and improve the file's readability. However, a closer look reveals some inconsistencies in the applied indentation.
Summary of Findings
- Inconsistent Indentation: The primary issue is the inconsistent use of indentation throughout the
ruby.protofile. While the intention was to standardize the indentation, the changes introduce a mix of single-space and double-space indentation, which detracts from the file's readability.
Merge Readiness
The pull request aims to improve code readability by standardizing indentation. However, due to the inconsistencies introduced, it's recommended that the author revisit the changes and ensure consistent indentation (preferably two spaces) throughout the file. I am unable to approve this pull request, and recommend that others review and approve this code before merging. It is not ready to be merged until the indentation issues are resolved.
399126f to
1c96c0b
Compare
1c96c0b to
500bd85
Compare
ruby.proto500bd85 to
9b5d930
Compare
protolint for Protocol Buffer files
9b5d930 to
674b15e
Compare
Run `protolint -fix` to autofix some linter errors Add `.protolint.yaml` config file and disable all rules for `comments` https://github.com/yoheimuta/protolint Hook usage listed here: https://github.com/yoheimuta/protolint?tab=readme-ov-file#version-control-integration Here is the style guide: https://protobuf.dev/programming-guides/style/ Next link is an example config file: https://github.com/yoheimuta/protolint/blob/master/_example/config/.protolint.yaml Also updated `proto_to_ruby.cpp`
674b15e to
5a2b694
Compare
|
Only concern is oss-fuzz is a contributed code and I do not maintain. |
|
mruby itself does not use protobuf at all. the code under oss-fuzz are not maintained by us. thus I don't think we need to add protolint check. |
The Super-Linter found this issue today when I was working on #6398
Run
protolint -fixto autofix some linter errorsAdd
.protolint.yamlconfig file and disable all rules forcommentshttps://github.com/yoheimuta/protolint
Hook usage listed here:
https://github.com/yoheimuta/protolint?tab=readme-ov-file#version-control-integration
Here is the style guide:
https://protobuf.dev/programming-guides/style/
Next link is an example config file:
https://github.com/yoheimuta/protolint/blob/master/_example/config/.protolint.yaml
Also updated
proto_to_ruby.cpp