Skip to content

Replace dashes with underscore for member var names#3291

Merged
SergeyRyabinin merged 1 commit intomainfrom
sr/DashInLocName
Feb 11, 2025
Merged

Replace dashes with underscore for member var names#3291
SergeyRyabinin merged 1 commit intomainfrom
sr/DashInLocName

Conversation

@SergeyRyabinin
Copy link
Copy Markdown
Contributor

@SergeyRyabinin SergeyRyabinin commented Feb 10, 2025

Issue #, if available:
n/a
Description of changes:
Replace - with _
Check all that applies:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@SergeyRyabinin SergeyRyabinin marked this pull request as ready for review February 10, 2025 18:45

public static String computeVariableName(String memberName) {
return memberName.substring(0, 1).toLowerCase() + memberName.substring(1);
return lowercasesFirstChar(memberName).replace("-", "_");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

instead of underscores/string manipulation should we just copy what we do for upper camel case, but make it for lower camel case? since its only variable names shouldn't be publicly impacting, but it could make a nasty delta.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

well, the issue with CaseFormat is that we need to know the source case convention, but we don't know it.

Copy link
Copy Markdown
Collaborator

@sbiscigl sbiscigl Feb 10, 2025

Choose a reason for hiding this comment

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

wouldn't it always be lower camelcase with variables?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we don't control it, it comes from the model file.

@SergeyRyabinin SergeyRyabinin merged commit a7d0531 into main Feb 11, 2025
@SergeyRyabinin SergeyRyabinin deleted the sr/DashInLocName branch February 12, 2025 17:55
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.

3 participants