Skip to content

Conversation

@yordis
Copy link
Member

@yordis yordis commented Dec 31, 2025

Signed-off-by: Yordis Prieto yordis.prieto@gmail.com

…PascalCase conversion

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@cursor
Copy link

cursor bot commented Dec 31, 2025

PR Summary

Improves PascalCase conversion to correctly handle underscores and validates it with new tests.

  • Update toPascalCase to split on _ and capitalize each segment (supports snake_case like user_profileUserProfile), affecting module name generation from package parts and method names
  • Add unit cases for underscore inputs and a new generation test for package acme.user_profile.v1 to assert correct server/handler module names
  • Minor test refactors without behavior changes

Written by Cursor Bugbot for commit 1b42009. This will update automatically on new commits. Configure here.

@coderabbitai
Copy link

coderabbitai bot commented Dec 31, 2025

Walkthrough

The toPascalCase function was modified to properly convert underscore-delimited strings to PascalCase by splitting input on underscores, capitalizing the first character of each non-empty segment, and concatenating them. Test coverage was expanded to validate the new behavior with underscore-containing package names and various underscore-separated identifiers.

Changes

Cohort / File(s) Summary
PascalCase conversion logic
cmd/protoc-gen-elixir-grpc/main.go
Modified toPascalCase to split input on underscores and capitalize each segment, enabling conversion of underscore-delimited words (e.g., team_lookupTeamLookup) instead of only uppercasing the first character.
Test coverage expansion
cmd/protoc-gen-elixir-grpc/main_test.go
Added test scenario for underscore-containing package names in TestGenerate and expanded toPascalCase test cases to cover various underscore patterns (leading/trailing/double underscores, mixed-case segments). Minor formatting refactors applied to test blocks.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 Underscores dance, now split with care,
Each segment crowned in capitals fair,
From team_lookup springs TeamLookup's might,
PascalCase whispers shine so bright! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive The description contains only a sign-off line and lacks any meaningful information about the changes or objectives of the pull request. Add a substantive description explaining the problem being fixed, the solution implemented, and any relevant context or testing notes.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: modifying PascalCase conversion to handle underscores in package names, which aligns with the primary code change in toPascalCase function.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 581b755 and 1b42009.

📒 Files selected for processing (2)
  • cmd/protoc-gen-elixir-grpc/main.go
  • cmd/protoc-gen-elixir-grpc/main_test.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Cursor Bugbot
🔇 Additional comments (3)
cmd/protoc-gen-elixir-grpc/main.go (1)

485-499: LGTM! Proper underscore-aware PascalCase conversion.

The implementation correctly splits on underscores, capitalizes the first character of each non-empty segment, and joins them to produce proper PascalCase. The length check on line 493 properly handles edge cases (leading, trailing, and consecutive underscores) by skipping empty parts.

cmd/protoc-gen-elixir-grpc/main_test.go (2)

833-887: Excellent integration test for underscore handling.

This test validates the end-to-end behavior of underscore-to-PascalCase conversion in package names. It confirms that acme.user_profile.v1 correctly generates module names with UserProfile (not User_profile), and that the handler module prefix interacts properly with underscore-containing package parts.


1170-1178: Comprehensive test coverage for underscore edge cases.

The new test cases thoroughly validate underscore handling, including leading underscores, trailing underscores, consecutive underscores, and various multi-part identifiers. This ensures the implementation is robust across all expected inputs.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@yordis yordis marked this pull request as ready for review December 31, 2025 23:06
@yordis yordis merged commit dc7878b into main Dec 31, 2025
4 checks passed
@yordis yordis deleted the fix-bug-1 branch December 31, 2025 23:14
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.

2 participants