From 337358f81d2ed4db14a84b74953560e80a12f88a Mon Sep 17 00:00:00 2001 From: uabyss Date: Sun, 28 Jul 2024 23:25:03 +0900 Subject: [PATCH] fix: test --- .../VoidFunctionInTernaryConditionRule.swift | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Source/SwiftLintBuiltInRules/Rules/Idiomatic/VoidFunctionInTernaryConditionRule.swift b/Source/SwiftLintBuiltInRules/Rules/Idiomatic/VoidFunctionInTernaryConditionRule.swift index fd0b2b9bd5..5d5beef0b9 100644 --- a/Source/SwiftLintBuiltInRules/Rules/Idiomatic/VoidFunctionInTernaryConditionRule.swift +++ b/Source/SwiftLintBuiltInRules/Rules/Idiomatic/VoidFunctionInTernaryConditionRule.swift @@ -273,9 +273,10 @@ private extension CodeBlockItemSyntax { return false } if let codeBlockItemListSyntax = ifExprSytax.parent?.parent?.parent?.as(CodeBlockItemListSyntax.self), - let expressionStmtSyntax = codeBlockItemListSyntax.last?.item.as(ExpressionStmtSyntax.self) - { - return parent.children(viewMode: .sourceAccurate).count == 1 && ( codeBlockItemListSyntax.count == 1 || expressionStmtSyntax.expression.is(IfExprSyntax.self)) && funcDecl.signature.allowsImplicitReturns + let expressionStmtSyntax = codeBlockItemListSyntax.last?.item.as(ExpressionStmtSyntax.self) { + return parent.children(viewMode: .sourceAccurate).count == 1 && + ( codeBlockItemListSyntax.count == 1 || expressionStmtSyntax.expression.is(IfExprSyntax.self)) && + funcDecl.signature.allowsImplicitReturns } return false } @@ -288,7 +289,9 @@ private extension CodeBlockItemSyntax { guard let funcDecl = switchExprSytax.parent?.parent?.parent?.parent?.parent?.as(FunctionDeclSyntax.self) else { return false } - return parent.children(viewMode: .sourceAccurate).count == 1 && funcDecl.signature.allowsImplicitReturns && switchExprSytax.parent?.parent?.parent?.as(CodeBlockItemListSyntax.self)?.count == 1 + return parent.children(viewMode: .sourceAccurate).count == 1 && + funcDecl.signature.allowsImplicitReturns && + switchExprSytax.parent?.parent?.parent?.as(CodeBlockItemListSyntax.self)?.count == 1 } }