-
Notifications
You must be signed in to change notification settings - Fork 53
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
refactor: Trim imported connor package #530
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #530 +/- ##
=========================================
Coverage 56.58% 56.59%
=========================================
Files 121 118 -3
Lines 14082 13952 -130
=========================================
- Hits 7969 7896 -73
+ Misses 5421 5364 -57
Partials 692 692
|
I might continue to grow this whilst waiting on #471 so maybe dont rush to review this or anything |
3a32d83
to
24744cd
Compare
1a9ba41
to
9b78eab
Compare
7d97edd
to
ce9790c
Compare
praise: I like this a lot! I'll review more later but on first pass it's 👌 |
9ef3540
to
2f2ebc8
Compare
We dont need to worry about this being called outside of this lib
I think this simplifies the code futher, feel very free to contradict me. Inits had to be preserved as Golang doesnt seem to treat static functions as constants and complained about an infinate init loop
No need for runtime string matching etc
No need to bother with prefix, so long as it wont panic any unknown operators will be caught on the next few lines.
Allows removal of prefix swap, and (I think) makes the explain results more user friendly.
We will probably add this back in at somepoint, but it is easy to do so and at the moment it is dead code
ce9790c
to
c539992
Compare
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.
LGTM!
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.
This is such a beautiful trim. Thanks for taking the time to clean this up! I had two non-blocking thoughts/questions/suggestions:
-
Perhaps some documentation on the only functions that are remaining to be documented under the connor package for completeness in the following files:
connor/key.go
connor/numbers/upcast.go
connor/numbers/equality.go
-
Since this seems to be the PR where we start "owning" connor did we want to do the rename to
eval
here? (or is that planned for a follow-up PR?) -
Why not add the license on the headers of the files like we have for
net
? have we decided to have this entire folder be MIT from now on?
Cheers Shahzad, answers inline below:
Will look into this, but from memory
I would suggest this is out of scope, I see this as a pure technical refactoring to make the code simpler for us, and I don't particularly care what the package is called. Might also be nice to do this in it's own PR to ensure a clear commit (given that we are not the original authors.
Similar to (2), I don't really want to deal with that here. Is a technical PR only in my eyes, and I'm not so comfy changing the license, and would probably want a PR specific to that for clearer commit-tracking (if we do want to change the licence). |
Cheers, thanks for the clarifications. Let'ss ssship it, or should I say trimmmm itttt hahaha. |
suggestion: replace the README (already deleted) by package documentation demonstrating its remaining functionality. |
I saw it not as changing the license but just implementing the convention of indicating the license as a header, so instead of having the folder-level license file, each file having a header indicating its license. IMO if we agree on following that convention, might as well do that here and not summon another PR just for that. |
I am of the opinion that it would be more efficient to merge this now instead of waiting on consensus here (let alone dev time to make any potiential move) |
Now that this is internal code, and how we have a fair number of integration tests covering aspects of this that we use (providing lots of examples), I would suggest that this is a 'nice to have' and doesn't quite justify the dev time atm. Is also as easy to add later than to add now. |
Looked at this again today, upcast and equality look pretty self explanatory, and key is already documented. Leaving as is. |
I wonder if there is a very tiny performance cost to doing this, but I like the removal of the extra code branch and possible error.
c539992
to
e3bc9f5
Compare
* Remove unused case Could be re-added in some form when adding filters for inline-arrays perhaps * Our filters can never contain these types (always .*64) * We dont support these operators for strings * Make MatchWith private We dont need to worry about this being called outside of this lib * Remove unused Operators func * Reduce connor state I think this simplifies the code futher, feel very free to contradict me. Inits had to be preserved as Golang doesnt seem to treat static functions as constants and complained about an infinate init loop * Simplify condition recursion No need for runtime string matching etc * Simplify operator safety check No need to bother with prefix, so long as it wont panic any unknown operators will be caught on the next few lines. * Use '_' as operator prefix. Allows removal of prefix swap, and (I think) makes the explain results more user friendly. * Remove unused fields sub package * Remove unfriendly test suite stuff * Remove out of date readme * Remove unsupported time checks We will probably add this back in at somepoint, but it is easy to do so and at the moment it is dead code * Remove unsupported contains operator * Replace map, init funcs, and type, with simple switch * Dont bother skipping first rune in switch I wonder if there is a very tiny performance cost to doing this, but I like the removal of the extra code branch and possible error. * Stop looping on eq failure
Relevant issue(s)
Resolves #529
Description
Simplifies the connor package a little bit. Done whilst waiting on reviewers for #471
Tasks
How has this been tested?
Integration tests.
Specify the platform(s) on which this was tested: