-
Notifications
You must be signed in to change notification settings - Fork 1
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
add support for targeting rule evaluation with semver (FF-1562) #10
Conversation
@@ -18,13 +18,14 @@ let package = Package( | |||
dependencies: [ | |||
// Dependencies declare other packages that this package depends on. | |||
// .package(url: /* package url */, from: "1.0.0"), | |||
.package(url: "https://github.com/ddddxxx/Semver", from: "0.2.1") |
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.
I chose this package because it supported swift 5.0, which is a fairly old version that we are supporting. When we move forward can replace it with a more package; however the scope of "semver" functionality is not that complex so I decided this is fairly safe.
do { | ||
let comparisonResult: Bool | ||
switch condition.targetingOperator { | ||
case .GreaterThanEqualTo, .GreaterThan, .LessThanEqualTo, .LessThan: |
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.
I really like this programming style! Makes a lot of sense to me to branch at this top level as the behavior is quite different from matches
and oneof/notoneof
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.
💯
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.
Nice work! Approving but with some potential clean ups I'd love for you to quickly look at.
return false | ||
} | ||
|
||
do { |
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.
Do we need this outer do
now that we use a guard clause? Or can we just un-nest everything one level?
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.
it's so that we can catch all errors:
} catch {
// Handle or log the error
return false
}
do you think this is not good behavior?
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.
oh sorry didn't realize that! I thought it was tied to the removed if
statement. Appologies for my lack of swift fluency. Carry on!
do { | ||
let comparisonResult: Bool | ||
switch condition.targetingOperator { | ||
case .GreaterThanEqualTo, .GreaterThan, .LessThanEqualTo, .LessThan: |
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.
💯
* add support for targeting rule evaluation with semver (FF-1562) * remove comparisonResult intermediate value * add unit test when one semver is invalid; return nil * typo and comment
* add support for targeting rule evaluation with semver (FF-1562) * remove comparisonResult intermediate value * add unit test when one semver is invalid; return nil * typo and comment
* add support for targeting rule evaluation with semver (FF-1562) * remove comparisonResult intermediate value * add unit test when one semver is invalid; return nil * typo and comment
No description provided.