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

filter out empty string #2323

Merged
merged 9 commits into from
Sep 5, 2018
Merged

filter out empty string #2323

merged 9 commits into from
Sep 5, 2018

Conversation

james-ray
Copy link
Contributor

@james-ray james-ray commented Sep 4, 2018

  • Updated all relevant documentation in docs
  • Updated all code comments where relevant
  • Wrote tests
  • Updated CHANGELOG_PENDING.md

fix #2322

node/strings.go Outdated
import "strings"

//move from string.go. filter out empty string too.
func SplitAndTrim(s, sep, cutset string) []string {
Copy link
Contributor

Choose a reason for hiding this comment

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

let's make it private

node/strings.go Outdated

import "strings"

//move from string.go. filter out empty string too.
Copy link
Contributor

Choose a reason for hiding this comment

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

The proper godoc should be in form of splitAndTrim ...

node/strings.go Outdated
@@ -2,7 +2,8 @@ package node

import "strings"

//move from string.go. filter out empty string too.
// SplitAndTrimEmpty is copied from common/string.go
Copy link
Contributor

Choose a reason for hiding this comment

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

Whats the point of saying that it is copied from common/string.go, we can just delete it from there as its only used here.

@codecov-io
Copy link

codecov-io commented Sep 4, 2018

Codecov Report

Merging #2323 into develop will increase coverage by 1.44%.
The diff coverage is 86.66%.

@@             Coverage Diff             @@
##           develop    #2323      +/-   ##
===========================================
+ Coverage    60.88%   62.33%   +1.44%     
===========================================
  Files          197      215      +18     
  Lines        16283    17617    +1334     
===========================================
+ Hits          9914    10981    +1067     
- Misses        5502     5726     +224     
- Partials       867      910      +43
Impacted Files Coverage Δ
node/node.go 65.01% <86.66%> (+0.82%) ⬆️
libs/common/math.go 7.95% <0%> (-35.8%) ⬇️
libs/common/string.go 65.11% <0%> (-9.25%) ⬇️
rpc/grpc/api.go 81.81% <0%> (-7.08%) ⬇️
state/execution.go 72.77% <0%> (-2.48%) ⬇️
libs/db/go_level_db.go 65% <0%> (-1.67%) ⬇️
crypto/encoding/amino/amino.go 84.21% <0%> (-1.51%) ⬇️
p2p/peer.go 57.95% <0%> (-1.14%) ⬇️
libs/autofile/autofile.go 69.23% <0%> (-0.47%) ⬇️
libs/common/cmap.go 90.47% <0%> (-0.44%) ⬇️
... and 71 more

@ValarDragon
Copy link
Contributor

ValarDragon commented Sep 4, 2018

Please don't keep amending the commits, we can squash it when merging. Constantly amending the commit makes it much harder to keep track of what the change between commits is :)

It also hides our review comments which weren't addressed.

@james-ray
Copy link
Contributor Author

@ValarDragon Ok,I got it. I will check more carefully. Retain all the commits.
Is it ok to modify the codes in the libs/common? I feel directly add a function in string.go would be a better way?

@james-ray
Copy link
Contributor Author

Sorry for the commits loss thing.

@@ -58,6 +58,23 @@ func SplitAndTrim(s, sep, cutset string) []string {
return spl
}

// SplitAndTrimEmpty only returns non-empty strings
func SplitAndTrimEmpty(s, sep, cutset string) []string {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please move it to node.go

node/node.go Outdated


// SplitAndTrimEmpty returns only non-empty strings
func SplitAndTrimEmpty(s, sep, cutset string) []string {
Copy link
Contributor

Choose a reason for hiding this comment

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

can you also make it private? splitAndTrimEmpty

Copy link
Contributor

Choose a reason for hiding this comment

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

also we need to delete original cmn.SplitAndTrim and add a changelog entry saying "[common] SplitAndTrim was deleted"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh,really,can I delete it? I'll check if anywhere used it. I will leave a changelog.

CHANGELOG.md Outdated
@@ -38,6 +38,7 @@ IMPROVEMENTS:
- tweak params
- only process one block at a time to avoid starving
- [common] bit array functions which take in another parameter are now thread safe
- [common] SplitAndTrim was deleted
Copy link
Contributor

Choose a reason for hiding this comment

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

Its kind of confusing, but we put changelog updates for the next release in CHANGELOG_PENDING.md, could you move this there, and put it in the breaking changes section?

@ValarDragon
Copy link
Contributor

Looks good to me! Thank you for the PR! Just needs the changelog update moved to CHANGELOG_PENDING.md

Copy link
Contributor

@ValarDragon ValarDragon left a comment

Choose a reason for hiding this comment

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

💯 👍 🦑 :shipit:
Looks good to me! Thanks for the contribution

@melekes melekes merged commit d0bb1ab into tendermint:develop Sep 5, 2018
@melekes
Copy link
Contributor

melekes commented Sep 5, 2018

Thanks for your contribution 🖖

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.

4 participants