From 12eb3fece7fd314240e8eaa229ded0b1802207c8 Mon Sep 17 00:00:00 2001 From: Marcelo Fabri Date: Thu, 14 Jan 2016 20:47:17 -0800 Subject: [PATCH] Updating reason message --- .../Rules/FunctionBodyLengthRule.swift | 3 ++- .../FunctionBodyLengthRuleTests.swift | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Source/SwiftLintFramework/Rules/FunctionBodyLengthRule.swift b/Source/SwiftLintFramework/Rules/FunctionBodyLengthRule.swift index 9cd1284c7..8fbcda505 100644 --- a/Source/SwiftLintFramework/Rules/FunctionBodyLengthRule.swift +++ b/Source/SwiftLintFramework/Rules/FunctionBodyLengthRule.swift @@ -86,7 +86,8 @@ public struct FunctionBodyLengthRule: ASTRule, ViolationLevelRule { severity: parameter.severity, location: location, reason: "Function body should span \(parameter.value) lines " + - "or less: currently spans \(lineCount) lines")] + "or less: currently spans \(lineCount) lines (already ignoring " + + "comment and whitespace only ones)")] } } diff --git a/Source/SwiftLintFrameworkTests/FunctionBodyLengthRuleTests.swift b/Source/SwiftLintFrameworkTests/FunctionBodyLengthRuleTests.swift index b33968486..d13e9a1b9 100644 --- a/Source/SwiftLintFrameworkTests/FunctionBodyLengthRuleTests.swift +++ b/Source/SwiftLintFrameworkTests/FunctionBodyLengthRuleTests.swift @@ -24,7 +24,8 @@ class FunctionBodyLengthRuleTests: XCTestCase { XCTAssertEqual(violations(longerFunctionBody), [StyleViolation( ruleDescription: FunctionBodyLengthRule.description, location: Location(file: nil, line: 1, character: 1), - reason: "Function body should span 40 lines or less: currently spans 41 lines")]) + reason: "Function body should span 40 lines or less: currently spans 41 lines " + + "(already ignoring comment and whitespace only ones)")]) let longerFunctionBodyWithEmptyLines = "func abc() {" + Repeat(count: 100, repeatedValue: "\n").joinWithSeparator("") + @@ -48,7 +49,8 @@ class FunctionBodyLengthRuleTests: XCTestCase { XCTAssertEqual(violations(longerFunctionBodyWithComments), [StyleViolation( ruleDescription: FunctionBodyLengthRule.description, location: Location(file: nil, line: 1, character: 1), - reason: "Function body should span 40 lines or less: currently spans 41 lines")]) + reason: "Function body should span 40 lines or less: currently spans 41 lines " + + "(already ignoring comment and whitespace only ones)")]) } func testFunctionBodyLengthsWithMultilineComments() { @@ -67,6 +69,7 @@ class FunctionBodyLengthRuleTests: XCTestCase { XCTAssertEqual(violations(longerFunctionBodyWithMultilineComments), [StyleViolation( ruleDescription: FunctionBodyLengthRule.description, location: Location(file: nil, line: 1, character: 1), - reason: "Function body should span 40 lines or less: currently spans 41 lines")]) + reason: "Function body should span 40 lines or less: currently spans 41 lines " + + "(already ignoring comment and whitespace only ones)")]) } }