-
Notifications
You must be signed in to change notification settings - Fork 23
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
Fixed bug with passedValidation property #40
Conversation
var closestDistance = Int.max | ||
|
||
// TODO: Use better name for arrayString parameter | ||
for arrayString in array { | ||
let distance = Int(string.levenshteinDistance(from: arrayString)) | ||
|
||
if distance < closestDistance && Float(distance) / Float(string.count) < tolerance { | ||
if distance < closestDistance, Float(distance) / Float(string.count) < tolerance { |
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.
Is this just a preference change? (Personally like boolean operators checks like this, so just wondering).
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 a SwiftFormat thing based on the rules we have defined.
Co-authored-by: Kyle Haptonstall <khaptonstall@users.noreply.github.com>
@objc public let passedValidation: Bool | ||
|
||
/// The autocorrect suggestion to be applied. Nil if there no suggestion. | ||
@objc public let autocorrectSuggestion: String? | ||
|
||
@objc public init(passedValidation: Bool, autocorrectSuggestion: String?) { |
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.
Attributes should be on their own lines in functions and types, but on the same line as variables and imports.attributes SHValidationResult.swift:12 |
Generated by 🚫 Danger |
Description
passedValidation
should be true so long as the incoming/submitted email is in a valid syntax/format. If it isn't, it should actually throw an error. Previously, this was returningfalse
if it had no autocorrect suggestion, which was incorrect logic.