gernest / mention

Twitter like mentions and #hashtags parser for Go(Golang)
MIT License
107 stars 14 forks source link

Refactor #12

Closed cbarraford closed 6 years ago

cbarraford commented 6 years ago

I was trying to solve that a url like "http://example.com/foo#bar" doesn't return any hashtags (ie "#bar") and found the source code really hard to follow. Lots of variables that aren't clear what value they hold, lots of indentations, etc.

So I refactored with a different approach that is simpler to follow, significantly less code, and better commented. There are some behavior changes....

the GetTags func now takes a string instead of io.Reader "@gernest@mwanza" not returns [gernest@mwanza] instead of [gernest, mwanza] Having your char also be a terminator results in not the behavior you want. Some of this may be controversial, happy to have that discussion.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+3.3%) to 97.619% when pulling fa2eaf19dc66be5dfc8a637fbe1668a358dd97d1 on cbarraford:refactor into ad0f22d1fbfec8ee91ba27704007a4eeebdb9eca on gernest:master.

gernest commented 6 years ago

@cbarraford you can merge this. When I get time I will add benchmarks and go-fuzz this so we can easily detect regressions in the future.

cbarraford commented 6 years ago

👍