Skip to content
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

chore: refactor to put function name generator in constant #641

Merged
merged 12 commits into from
Oct 23, 2024

Conversation

rishav-karanjit
Copy link

@rishav-karanjit rishav-karanjit commented Oct 17, 2024

Issue #, if available:

Description of changes:

  • AWS, local shape visitor helper and validation generator contains funcNameGenerator. So, brought it in a common constant file to avoid code duplication.
  • ignoring java formating for this PR

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

@rishav-karanjit rishav-karanjit changed the title Chore: Function name generator changes Chore: Change function name Oct 17, 2024
@@ -598,7 +600,7 @@ func Error_ToDafny(err error)($L.Error) {
}
""",
DafnyNameResolver.dafnyTypesNamespace(serviceShape),
writer.consumer(w -> {
writer.consumer(w -> {
Copy link
Author

Choose a reason for hiding this comment

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

Not sure how this came in diff but make format_java will fix this. So, Ignoring this for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Personally I'm not a fan of our java formatter - it keeps line too short and I think uses 2 white-spaces for indentation.

@rishav-karanjit rishav-karanjit marked this pull request as ready for review October 17, 2024 21:42
@rishav-karanjit rishav-karanjit requested a review from a team as a code owner October 17, 2024 21:42
@rishav-karanjit rishav-karanjit changed the title Chore: Change function name Chore: Change function names and refactor Oct 17, 2024
@rishav-karanjit rishav-karanjit changed the title Chore: Change function names and refactor chore: Change function names and refactor Oct 18, 2024
@@ -807,7 +809,7 @@ private void generateSerializerFunctions(final GenerationContext context, final
return $L
}
""",
ShapeVisitorHelper.funcNameGenerator(
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I'd prefer fully-qualified-name / FQN over static imports. Improves readability / reasoning around where this function belongs.

Copy link
Author

Choose a reason for hiding this comment

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

Done

@@ -598,7 +600,7 @@ func Error_ToDafny(err error)($L.Error) {
}
""",
DafnyNameResolver.dafnyTypesNamespace(serviceShape),
writer.consumer(w -> {
writer.consumer(w -> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Personally I'm not a fan of our java formatter - it keeps line too short and I think uses 2 white-spaces for indentation.

Comment on lines 19 to 25
) {
return memberShape
.getId()
.toString()
.replaceAll("[.$#]", "_")
.concat("_")
.concat(suffix);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this different than one in the ValidationGenerator ?

Copy link
Author

Choose a reason for hiding this comment

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

I thought the name in ValidationGenerator won't collide and will look good but the name collided (Caught in CI in 8738b87) So, I made ValidationGenerator to use same function name.

@rishav-karanjit rishav-karanjit changed the title chore: Change function names and refactor chore: refactor to put function name generator in constant Oct 23, 2024
Copy link
Contributor

@ShubhamChaturvedi7 ShubhamChaturvedi7 left a comment

Choose a reason for hiding this comment

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

Follow this up with the formatting fix.

@rishav-karanjit rishav-karanjit merged commit 756bcd9 into Golang/dev Oct 23, 2024
86 checks passed
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