-
Notifications
You must be signed in to change notification settings - Fork 8
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
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
6e15111
Change function name
rishav-karanjit f161e58
Bring function name generator in a constant utils file
rishav-karanjit 4182f4b
Remove commented code
rishav-karanjit 2c98204
Add v4
rishav-karanjit 1ce2183
Some nits
rishav-karanjit 750ea96
Remove redundant var
rishav-karanjit 3a3ed47
Remove redundant var
rishav-karanjit a3701df
Use FQN
rishav-karanjit 8738b87
Merge mistake fix
rishav-karanjit 204d4d3
remove func name generator from validationGenerator
rishav-karanjit 466e6a3
Formatting
rishav-karanjit 7c86c25
remove redundant import
rishav-karanjit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...mithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithygo/utils/Constants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,29 @@ | ||
package software.amazon.polymorph.smithygo.utils; | ||
|
||
import software.amazon.smithy.model.shapes.MemberShape; | ||
|
||
public class Constants { | ||
|
||
public static final String DAFNY_RUNTIME_GO_LIBRARY_MODULE = | ||
"github.com/dafny-lang/DafnyRuntimeGo/v4"; | ||
|
||
// TODO: Is it possible to make this function name shorter and in camelCase? | ||
/** | ||
* Generates a function name for shape visitors for AWS SDK and localservice. | ||
* | ||
* @param memberShape The visiting MemberShape | ||
* @param suffix A string to be appended at the end of the generated function name | ||
* @return A string representing the generated function name | ||
*/ | ||
public static String funcNameGenerator( | ||
final MemberShape memberShape, | ||
final String suffix | ||
) { | ||
return memberShape | ||
.getId() | ||
.toString() | ||
.replaceAll("[.$#]", "_") | ||
.concat("_") | ||
.concat(suffix); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
nit: I'd prefer fully-qualified-name / FQN over static imports. Improves readability / reasoning around where this function belongs.
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.
Done