fix(caser): ToSnake does not replace spaces with _#1094
fix(caser): ToSnake does not replace spaces with _#1094ankur0904 wants to merge 3 commits intocloudquery:mainfrom
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1094 +/- ##
==========================================
- Coverage 47.17% 47.09% -0.08%
==========================================
Files 84 85 +1
Lines 7728 7792 +64
==========================================
+ Hits 3646 3670 +24
- Misses 3748 3787 +39
- Partials 334 335 +1
☔ View full report in Codecov by Sentry. |
erezrokah
left a comment
There was a problem hiding this comment.
Thanks for the PR @ankur0904, do you mind adding some unit tests to it? There's a caser/caser_test.go file you can use
|
@erezrokah I will add unit test. |
|
@erezrokah After observing I come to know when I remove this According to my observation |
|
@erezrokah What are your thoughts? |
Hi @ankur0904 thank you for looking into it, will that solution work for the following test I think we might need to first replace spaces on the entire string, then split the words, WDYT? You can also use https://textedit.tools/snakecase to test |
|
@erezrokah You are absolutely right |
|
@erezrokah I have updated the code, in this code I first replace spaces on the entire string then if there is Unit test I added After running |
|
Thanks for following up @ankur0904, looks better but I think it's missing |
|
@erezrokah Apologize, I have forgotten to mention that. |
|
@erezrokah Does anything else we need to change? |
Sorry for the late reply. I missed your last commit. I'll take a look tomorrow. |
Can this PR be merged? |
Hi @ankur0904, let me look at this again. I think this could be simplified to replace the spaces once before splitting the words. |
|
@erezrokah Should I need to change the code? |
Not yet, I'll comment on the PR if that's needed |
|
@erezrokah OK |
|
Hi @ankur0904 I opened #1148 as a draft with a different approach to get rid of the spaces. I think that's more consistent with the current code (doesn't use regular expressions). Please let me know what you think |
|
@erezrokah #1148 That looks fine and more consistent. |
|
Closing, as #1198 was released as part of |
Summary
This PR fixes #728
Use the following steps to ensure your PR is ready to be reviewed
go fmtto format your code 🖊golangci-lint run🚨 (install golangci-lint here)