From a37445d06805c8aaa21d9791679b6176bdd90134 Mon Sep 17 00:00:00 2001 From: Jeffrey Date: Tue, 25 Apr 2017 13:39:12 -0700 Subject: [PATCH 1/5] Revert "We should be using parameter.value instead of configuration.warning in order to report accurate information about the violation." This reverts commit c4006276a38d7691b3f1f62d8307aaccb57887b3. --- Source/SwiftLintFramework/Rules/FileLengthRule.swift | 2 +- .../SwiftLintFramework/Rules/FunctionParameterCountRule.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/SwiftLintFramework/Rules/FileLengthRule.swift b/Source/SwiftLintFramework/Rules/FileLengthRule.swift index fcccbd6ff..96bcd4679 100644 --- a/Source/SwiftLintFramework/Rules/FileLengthRule.swift +++ b/Source/SwiftLintFramework/Rules/FileLengthRule.swift @@ -31,7 +31,7 @@ public struct FileLengthRule: ConfigurationProviderRule, SourceKitFreeRule { return [StyleViolation(ruleDescription: type(of: self).description, severity: parameter.severity, location: Location(file: file.path, line: lineCount), - reason: "File should contain \(parameter.value) lines or less: " + + reason: "File should contain \(configuration.warning) lines or less: " + "currently contains \(lineCount)")] } return [] diff --git a/Source/SwiftLintFramework/Rules/FunctionParameterCountRule.swift b/Source/SwiftLintFramework/Rules/FunctionParameterCountRule.swift index 8239e11f5..fc45f9f19 100644 --- a/Source/SwiftLintFramework/Rules/FunctionParameterCountRule.swift +++ b/Source/SwiftLintFramework/Rules/FunctionParameterCountRule.swift @@ -69,7 +69,7 @@ public struct FunctionParameterCountRule: ASTRule, ConfigurationProviderRule { return [StyleViolation(ruleDescription: type(of: self).description, severity: parameter.severity, location: Location(file: file, byteOffset: offset), - reason: "Function should have \(parameter.value) parameters or less: " + + reason: "Function should have \(configuration.warning) parameters or less: " + "it currently has \(parameterCount)")] } From 3812ef3612d27c30ed0a901f16098121dff13688 Mon Sep 17 00:00:00 2001 From: Jeffrey Date: Tue, 25 Apr 2017 13:46:44 -0700 Subject: [PATCH 2/5] change parameter.value to configuration.warning --- Source/SwiftLintFramework/Rules/FunctionBodyLengthRule.swift | 2 +- Source/SwiftLintFramework/Rules/LargeTupleRule.swift | 2 +- Source/SwiftLintFramework/Rules/TypeBodyLengthRule.swift | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/SwiftLintFramework/Rules/FunctionBodyLengthRule.swift b/Source/SwiftLintFramework/Rules/FunctionBodyLengthRule.swift index f962fd1eb..7edae905c 100644 --- a/Source/SwiftLintFramework/Rules/FunctionBodyLengthRule.swift +++ b/Source/SwiftLintFramework/Rules/FunctionBodyLengthRule.swift @@ -39,7 +39,7 @@ public struct FunctionBodyLengthRule: ASTRule, ConfigurationProviderRule { return [StyleViolation(ruleDescription: type(of: self).description, severity: parameter.severity, location: Location(file: file, byteOffset: offset), - reason: "Function body should span \(parameter.value) lines or less " + + reason: "Function body should span \(configuration.warning) lines or less " + "excluding comments and whitespace: currently spans \(lineCount) " + "lines")] } diff --git a/Source/SwiftLintFramework/Rules/LargeTupleRule.swift b/Source/SwiftLintFramework/Rules/LargeTupleRule.swift index eb88304da..d595f082e 100644 --- a/Source/SwiftLintFramework/Rules/LargeTupleRule.swift +++ b/Source/SwiftLintFramework/Rules/LargeTupleRule.swift @@ -66,7 +66,7 @@ public struct LargeTupleRule: ASTRule, ConfigurationProviderRule { return offsets.flatMap { location, size in for parameter in configuration.params where size > parameter.value { - let reason = "Tuples should have at most \(parameter.value) members." + let reason = "Tuples should have at most \(configuration.warning) members." return StyleViolation(ruleDescription: type(of: self).description, severity: parameter.severity, location: Location(file: file, byteOffset: location), diff --git a/Source/SwiftLintFramework/Rules/TypeBodyLengthRule.swift b/Source/SwiftLintFramework/Rules/TypeBodyLengthRule.swift index afaaf32f8..e35712fb9 100644 --- a/Source/SwiftLintFramework/Rules/TypeBodyLengthRule.swift +++ b/Source/SwiftLintFramework/Rules/TypeBodyLengthRule.swift @@ -59,7 +59,7 @@ public struct TypeBodyLengthRule: ASTRule, ConfigurationProviderRule { return [StyleViolation(ruleDescription: type(of: self).description, severity: parameter.severity, location: Location(file: file, byteOffset: offset), - reason: "Type body should span \(parameter.value) lines or less " + + reason: "Type body should span \(configuration.warning) lines or less " + "excluding comments and whitespace: currently spans \(lineCount) " + "lines")] } From 38f5e51f4c1547aea7fe38954322b19ecea3813c Mon Sep 17 00:00:00 2001 From: Jeffrey Date: Tue, 25 Apr 2017 13:56:57 -0700 Subject: [PATCH 3/5] Edit Changelog ultimatedbz --- CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09eac5d0f..5e4d781a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,10 @@ * Add lowercase and missing colon checks to the `mark` rule. [Jason Moore](https://github.com/xinsight) +* Improve violation report UX in `function_body_length`, + `large_type`, and `type_body_length` rules.   + [ultimatedbz](https://github.com/ultimatedbz) + ##### Bug Fixes * `emoji` and `checkstyle` reporter output report sorted by file name. @@ -27,10 +31,6 @@ * Fix typo in `DiscardedNotificationCenterObserverRule`. [Spencer Kaiser](https://github.com/spencerkaiser) -* Fix inaccurate violation report in `file_length` and - `function_parameter_count` rules.   - [ultimatedbz](https://github.com/ultimatedbz) - ## 0.18.1: Misaligned Drum ##### Breaking From bc76bd1745344dc7170313312557a9fe8fd29798 Mon Sep 17 00:00:00 2001 From: Jeffrey Date: Tue, 25 Apr 2017 13:56:57 -0700 Subject: [PATCH 4/5] Edit Changelog ultimatedbz --- CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09eac5d0f..81d6249d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,10 @@ * Add lowercase and missing colon checks to the `mark` rule. [Jason Moore](https://github.com/xinsight) +* Improve violation reason wording in `function_body_length`, + `large_type`, and `type_body_length` rules.   + [ultimatedbz](https://github.com/ultimatedbz) + ##### Bug Fixes * `emoji` and `checkstyle` reporter output report sorted by file name. @@ -27,10 +31,6 @@ * Fix typo in `DiscardedNotificationCenterObserverRule`. [Spencer Kaiser](https://github.com/spencerkaiser) -* Fix inaccurate violation report in `file_length` and - `function_parameter_count` rules.   - [ultimatedbz](https://github.com/ultimatedbz) - ## 0.18.1: Misaligned Drum ##### Breaking From b837f07f48327f15d9a18dbfaacedd6d96729873 Mon Sep 17 00:00:00 2001 From: Jeffrey Date: Tue, 25 Apr 2017 14:12:31 -0700 Subject: [PATCH 5/5] Update Changelog ultimatedbz --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 549268e7b..81d6249d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,6 @@ [Jason Moore](https://github.com/xinsight) * Improve violation reason wording in `function_body_length`, -* Improve violation report UX in `function_body_length`, `large_type`, and `type_body_length` rules.   [ultimatedbz](https://github.com/ultimatedbz)