Skip to content
This repository has been archived by the owner on Apr 13, 2022. It is now read-only.

Commit

Permalink
Merge 7b92aab into ac24a65
Browse files Browse the repository at this point in the history
  • Loading branch information
aslesarenko committed Sep 27, 2020
2 parents ac24a65 + 7b92aab commit 601651e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/scala/scorex/core/validation/ModifierValidator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ case class ValidationState[T](result: ValidationResult[T], settings: ValidationS

/** Validate the condition is `true` or else return the `error` given
*/
def validate(id: Short, condition: => Boolean, details: String = ""): ValidationState[T] = {
def validate(id: Short, condition: => Boolean, details: => String = ""): ValidationState[T] = {
pass(if (!settings.isActive(id) || condition) result else settings.getError(id, details))
}

/** Reverse condition: Validate the condition is `false` or else return the `error` given */
def validateNot(id: Short, condition: => Boolean, details: String = ""): ValidationState[T] = {
def validateNot(id: Short, condition: => Boolean, details: => String = ""): ValidationState[T] = {
validate(id, !condition, details)
}

Expand Down Expand Up @@ -122,7 +122,7 @@ case class ValidationState[T](result: ValidationResult[T], settings: ValidationS

/** Wrap semantic validity to the validation state: if semantic validity was not Valid, then return the `error` given
*/
def validateSemantics(id: Short, validity: => ModifierSemanticValidity, details: String = ""): ValidationState[T] = {
def validateSemantics(id: Short, validity: => ModifierSemanticValidity, details: => String = ""): ValidationState[T] = {
validateNot(id, validity == ModifierSemanticValidity.Invalid, details)
}

Expand Down

0 comments on commit 601651e

Please sign in to comment.