From 1a7f79250fbc04498b0e57137d71e0cd4d2df47e Mon Sep 17 00:00:00 2001 From: Andy Davidoff Date: Tue, 14 Jan 2020 21:22:12 -0500 Subject: [PATCH] style --- src/nimph/requirement.nim | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/nimph/requirement.nim b/src/nimph/requirement.nim index 3dfc93d..2296dd9 100644 --- a/src/nimph/requirement.nim +++ b/src/nimph/requirement.nim @@ -28,21 +28,20 @@ proc `$`*(req: Requirement): string = proc isValid*(req: Requirement): bool = ## true if the requirement seems sensible result = req.release.isValid - if not result: - return - case req.operator: - # if the operator is Tag, it's essentially a #== test - of Tag: - result = req.release.kind in {Tag} - # if the operator supports a mask, then so might the release - of Caret, Tilde, Wild: - result = req.release.kind in {Wild, Equal} - # if the operator supports only equality, apply it to tags, versions - of Equal: - result = req.release.kind in {Tag, Equal} - # else it can only be a relative comparison to a complete version spec - else: - result = req.release.kind in {Equal} + if result: + case req.operator: + # if the operator is Tag, it's essentially a #== test + of Tag: + result = req.release.kind in {Tag} + # if the operator supports a mask, then so might the release + of Caret, Tilde, Wild: + result = req.release.kind in {Wild, Equal} + # if the operator supports only equality, apply it to tags, versions + of Equal: + result = req.release.kind in {Tag, Equal} + # else it can only be a relative comparison to a complete version spec + else: + result = req.release.kind in {Equal} proc isSatisfiedBy(requirement: Requirement; version: Version): bool = ## true if the version satisfies the requirement