From ae4b01d5c46eceb4942ef9fd7ca36ddeddc67675 Mon Sep 17 00:00:00 2001 From: JP Simard Date: Thu, 22 Dec 2016 10:23:32 -0800 Subject: [PATCH 01/11] re-enable a passing Linux unit test --- Tests/SwiftLintFrameworkTests/RulesTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/SwiftLintFrameworkTests/RulesTests.swift b/Tests/SwiftLintFrameworkTests/RulesTests.swift index 968815f7e..2731c5aa5 100644 --- a/Tests/SwiftLintFrameworkTests/RulesTests.swift +++ b/Tests/SwiftLintFrameworkTests/RulesTests.swift @@ -382,7 +382,7 @@ extension RulesTests { ("testOperatorFunctionWhitespace", testOperatorFunctionWhitespace), ("testOperatorUsageWhitespace", testOperatorUsageWhitespace), ("testPrivateOutlet", testPrivateOutlet), - // ("testPrivateUnitTest", testPrivateUnitTest), + ("testPrivateUnitTest", testPrivateUnitTest), ("testProhibitedSuper", testProhibitedSuper), ("testRedundantNilCoalescing", testRedundantNilCoalescing), ("testRedundantStringEnumValue", testRedundantStringEnumValue), From c82cc6d9f654fafe2f75b770c2bff716994d1e4f Mon Sep 17 00:00:00 2001 From: JP Simard Date: Thu, 22 Dec 2016 10:39:26 -0800 Subject: [PATCH 02/11] fix JSON reporter on Linux and re-enable its unit test the printed JSON string is slightly different on Linux than it is on Darwin, but produces equivalent JSON --- .../Reporters/JSONReporter.swift | 2 +- Tests/SwiftLintFrameworkTests/ReporterTests.swift | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Source/SwiftLintFramework/Reporters/JSONReporter.swift b/Source/SwiftLintFramework/Reporters/JSONReporter.swift index 9f6dadf78..d03755022 100644 --- a/Source/SwiftLintFramework/Reporters/JSONReporter.swift +++ b/Source/SwiftLintFramework/Reporters/JSONReporter.swift @@ -21,7 +21,7 @@ public struct JSONReporter: Reporter { return toJSON(violations.map(dictionaryForViolation)) } - fileprivate static func dictionaryForViolation(_ violation: StyleViolation) -> NSDictionary { + fileprivate static func dictionaryForViolation(_ violation: StyleViolation) -> [String: Any] { return [ "file": violation.location.file ?? NSNull() as Any, "line": violation.location.line ?? NSNull() as Any, diff --git a/Tests/SwiftLintFrameworkTests/ReporterTests.swift b/Tests/SwiftLintFrameworkTests/ReporterTests.swift index 01767ad9b..df596c9e4 100644 --- a/Tests/SwiftLintFrameworkTests/ReporterTests.swift +++ b/Tests/SwiftLintFrameworkTests/ReporterTests.swift @@ -69,7 +69,17 @@ class ReporterTests: XCTestCase { func testJSONReporter() { let expectedOutput = stringFromFile("CannedJSONReporterOutput.json") let result = JSONReporter.generateReport(generateViolations()) - XCTAssertEqual(result, expectedOutput) + func jsonValue(_ jsonString: String) -> NSObject { + let data = jsonString.data(using: .utf8)! + let result = try! JSONSerialization.jsonObject(with: data, options: []) + if let dict = (result as? [String: Any])?.bridge() { + return dict + } else if let array = (result as? [Any])?.bridge() { + return array + } + fatalError() + } + XCTAssertEqual(jsonValue(result), jsonValue(expectedOutput)) } func testCSVReporter() { @@ -107,8 +117,7 @@ extension ReporterTests { ("testReporterFromString", testReporterFromString), ("testXcodeReporter", testXcodeReporter), ("testEmojiReporter", testEmojiReporter), - // Fails on Linux - // ("testJSONReporter", testJSONReporter), + ("testJSONReporter", testJSONReporter), ("testCSVReporter", testCSVReporter), ("testCheckstyleReporter", testCheckstyleReporter), ("testJunitReporter", testJunitReporter), From e663cd04533317735119ae9f5efe774da695f24e Mon Sep 17 00:00:00 2001 From: JP Simard Date: Thu, 22 Dec 2016 11:08:07 -0800 Subject: [PATCH 03/11] disable force try rule in ReporterTests --- Tests/SwiftLintFrameworkTests/ReporterTests.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Tests/SwiftLintFrameworkTests/ReporterTests.swift b/Tests/SwiftLintFrameworkTests/ReporterTests.swift index df596c9e4..9bf9c8a8d 100644 --- a/Tests/SwiftLintFrameworkTests/ReporterTests.swift +++ b/Tests/SwiftLintFrameworkTests/ReporterTests.swift @@ -71,6 +71,7 @@ class ReporterTests: XCTestCase { let result = JSONReporter.generateReport(generateViolations()) func jsonValue(_ jsonString: String) -> NSObject { let data = jsonString.data(using: .utf8)! + // swiftlint:disable:next force_try let result = try! JSONSerialization.jsonObject(with: data, options: []) if let dict = (result as? [String: Any])?.bridge() { return dict From e4fa18df06ddbcc730dd2c08a1c0c42aa531ae0c Mon Sep 17 00:00:00 2001 From: JP Simard Date: Thu, 22 Dec 2016 14:40:12 -0800 Subject: [PATCH 04/11] release 0.15.0 --- CHANGELOG.md | 2 +- Source/SwiftLintFramework/Supporting Files/Info.plist | 2 +- Source/swiftlint/Supporting Files/Info.plist | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 96abeeb81..64497427a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## Master +## 0.15.0: Hand Washable Holiday Linens 🎄 ##### Breaking diff --git a/Source/SwiftLintFramework/Supporting Files/Info.plist b/Source/SwiftLintFramework/Supporting Files/Info.plist index c7ef8a298..d89620543 100644 --- a/Source/SwiftLintFramework/Supporting Files/Info.plist +++ b/Source/SwiftLintFramework/Supporting Files/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.14.0 + 0.15.0 CFBundleSignature ???? CFBundleVersion diff --git a/Source/swiftlint/Supporting Files/Info.plist b/Source/swiftlint/Supporting Files/Info.plist index 89c311650..7be956117 100644 --- a/Source/swiftlint/Supporting Files/Info.plist +++ b/Source/swiftlint/Supporting Files/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.14.0 + 0.15.0 CFBundleSignature ???? CFBundleVersion From 40494e48aba052ed44a27b3d253d5f9fda446959 Mon Sep 17 00:00:00 2001 From: JP Simard Date: Thu, 22 Dec 2016 15:14:35 -0800 Subject: [PATCH 05/11] add empty changelog section --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64497427a..45cb93e10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +## Master + +##### Breaking + +* None. + +##### Enhancements + +* None. + +##### Bug Fixes + +* None. + ## 0.15.0: Hand Washable Holiday Linens 🎄 ##### Breaking From 64a624ccf6dae218d3029b8017eba2b11fd7530d Mon Sep 17 00:00:00 2001 From: Marcelo Fabri Date: Thu, 22 Dec 2016 20:55:05 -0200 Subject: [PATCH 06/11] Add vertical_parameter_alignment rule Fixes #1033 --- CHANGELOG.md | 5 ++ .../Models/MasterRuleList.swift | 1 + .../VerticalParameterAlignmentRule.swift | 86 +++++++++++++++++++ SwiftLint.xcodeproj/project.pbxproj | 8 +- .../SwiftLintFrameworkTests/RulesTests.swift | 5 ++ 5 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 Source/SwiftLintFramework/Rules/VerticalParameterAlignmentRule.swift diff --git a/CHANGELOG.md b/CHANGELOG.md index 45cb93e10..0311cab7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,11 @@ [Marcelo Fabri](https://github.com/marcelofabri) [#1005](https://github.com/realm/SwiftLint/issues/1005) +* Add `vertical_parameter_alignment` rule that checks if parameters are + vertically aligned if there're line breaks in a function declaration. + [Marcelo Fabri](https://github.com/marcelofabri) + [#1033](https://github.com/realm/SwiftLint/issues/1033) + ##### Bug Fixes * `FunctionParameterCountRule` also ignores generic initializers. diff --git a/Source/SwiftLintFramework/Models/MasterRuleList.swift b/Source/SwiftLintFramework/Models/MasterRuleList.swift index 47f5c8571..014d882a9 100644 --- a/Source/SwiftLintFramework/Models/MasterRuleList.swift +++ b/Source/SwiftLintFramework/Models/MasterRuleList.swift @@ -102,6 +102,7 @@ public let masterRuleList = RuleList(rules: ValidDocsRule.self, ValidIBInspectableRule.self, VariableNameRule.self, + VerticalParameterAlignmentRule.self, VerticalWhitespaceRule.self, VoidReturnRule.self, WeakDelegateRule.self diff --git a/Source/SwiftLintFramework/Rules/VerticalParameterAlignmentRule.swift b/Source/SwiftLintFramework/Rules/VerticalParameterAlignmentRule.swift new file mode 100644 index 000000000..650aeba21 --- /dev/null +++ b/Source/SwiftLintFramework/Rules/VerticalParameterAlignmentRule.swift @@ -0,0 +1,86 @@ +// +// VerticalParameterAlignmentRule.swift +// SwiftLint +// +// Created by Marcelo Fabri on 22/12/16. +// Copyright © 2016 Realm. All rights reserved. +// + +import Foundation +import SourceKittenFramework + +public struct VerticalParameterAlignmentRule: ASTRule, ConfigurationProviderRule { + public var configuration = SeverityConfiguration(.warning) + + public init() {} + + public static let description = RuleDescription( + identifier: "vertical_parameter_alignment", + name: "Vertical Parameter Alignment", + description: "Function parameters should be aligned vertically if they're in multiple lines in a declaration.", + nonTriggeringExamples: [ + "func validateFunction(_ file: File, kind: SwiftDeclarationKind,\n" + + " dictionary: [String: SourceKitRepresentable]) { }\n", + "func validateFunction(_ file: File, kind: SwiftDeclarationKind,\n" + + " dictionary: [String: SourceKitRepresentable]) -> [StyleViolation]\n", + "func foo(bar: Int)\n", + "func foo(bar: Int) -> String \n", + "func validateFunction(_ file: File, kind: SwiftDeclarationKind,\n" + + " dictionary: [String: SourceKitRepresentable])\n" + + " -> [StyleViolation]\n", + "func validateFunction(\n" + + " _ file: File, kind: SwiftDeclarationKind,\n" + + " dictionary: [String: SourceKitRepresentable]) -> [StyleViolation]\n" + ], + triggeringExamples: [ + "func validateFunction(_ file: File, kind: SwiftDeclarationKind,\n" + + " ↓dictionary: [String: SourceKitRepresentable]) { }\n", + "func validateFunction(_ file: File, kind: SwiftDeclarationKind,\n" + + " ↓dictionary: [String: SourceKitRepresentable]) { }\n", + "func validateFunction(_ file: File,\n" + + " ↓kind: SwiftDeclarationKind,\n" + + " ↓dictionary: [String: SourceKitRepresentable]) { }\n" + ] + ) + + public func validateFile(_ file: File, + kind: SwiftDeclarationKind, + dictionary: [String: SourceKitRepresentable]) -> [StyleViolation] { + guard SwiftDeclarationKind.functionKinds().contains(kind) else { + return [] + } + + let contents = file.contents.bridge() + let pattern = "\\(\\s*(\\S)" + + guard let nameOffset = (dictionary["key.nameoffset"] as? Int64).flatMap({ Int($0) }), + let nameLength = (dictionary["key.namelength"] as? Int64).flatMap({ Int($0) }), + let nameRange = contents.byteRangeToNSRange(start: nameOffset, length: nameLength), + let paramStart = regex(pattern).firstMatch(in: file.contents, + options: [], range: nameRange)?.rangeAt(1).location, + let (startLine, startCharacter) = contents.lineAndCharacter(forCharacterOffset: paramStart), + let (endLine, _) = contents.lineAndCharacter(forByteOffset: nameOffset + nameLength - 1), + endLine > startLine else { + return [] + } + + let linesRange = (startLine + 1)...endLine + let violationLocations = linesRange.flatMap { lineIndex -> Int? in + let line = file.lines[lineIndex - 1] + guard let paramLocation = regex("\\S").firstMatch(in: file.contents, options: [], + range: line.range)?.range.location, + let (_, paramCharacter) = contents.lineAndCharacter(forCharacterOffset: paramLocation), + paramCharacter != startCharacter else { + return nil + } + + return paramLocation + } + + return violationLocations.map { + StyleViolation(ruleDescription: type(of: self).description, + severity: configuration.severity, + location: Location(file: file, characterOffset: $0)) + } + } +} diff --git a/SwiftLint.xcodeproj/project.pbxproj b/SwiftLint.xcodeproj/project.pbxproj index 32870f3e1..c6f88700e 100644 --- a/SwiftLint.xcodeproj/project.pbxproj +++ b/SwiftLint.xcodeproj/project.pbxproj @@ -89,9 +89,9 @@ D42D2B381E09CC0D00CD7A2E /* FirstWhereRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D42D2B371E09CC0D00CD7A2E /* FirstWhereRule.swift */; }; D4348EEA1C46122C007707FB /* FunctionBodyLengthRuleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4348EE91C46122C007707FB /* FunctionBodyLengthRuleTests.swift */; }; D43B04641E0620AB004016AF /* UnusedEnumeratedRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D43B04631E0620AB004016AF /* UnusedEnumeratedRule.swift */; }; - D43B046B1E075905004016AF /* ClosureEndIndentationRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D43B046A1E075905004016AF /* ClosureEndIndentationRule.swift */; }; D43B04661E071ED3004016AF /* ColonRuleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D43B04651E071ED3004016AF /* ColonRuleTests.swift */; }; D43B04691E072291004016AF /* ColonConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = D43B04671E07228D004016AF /* ColonConfiguration.swift */; }; + D43B046B1E075905004016AF /* ClosureEndIndentationRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D43B046A1E075905004016AF /* ClosureEndIndentationRule.swift */; }; D43DB1081DC573DA00281215 /* ImplicitGetterRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D43DB1071DC573DA00281215 /* ImplicitGetterRule.swift */; }; D44254201DB87CA200492EA4 /* ValidIBInspectableRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D442541E1DB87C3D00492EA4 /* ValidIBInspectableRule.swift */; }; D44254271DB9C15C00492EA4 /* SyntacticSugarRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D44254251DB9C12300492EA4 /* SyntacticSugarRule.swift */; }; @@ -108,6 +108,7 @@ D48AE2CC1DFB58C5001C6A4A /* AttributesRulesExamples.swift in Sources */ = {isa = PBXBuildFile; fileRef = D48AE2CB1DFB58C5001C6A4A /* AttributesRulesExamples.swift */; }; D4998DE71DF191380006E05D /* AttributesRuleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4998DE61DF191380006E05D /* AttributesRuleTests.swift */; }; D4998DE91DF194F20006E05D /* FileHeaderRuleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4998DE81DF194F20006E05D /* FileHeaderRuleTests.swift */; }; + D4B0226F1E0C75F9007E5297 /* VerticalParameterAlignmentRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4B0226E1E0C75F9007E5297 /* VerticalParameterAlignmentRule.swift */; }; D4C4A34C1DEA4FF000E0E04C /* AttributesConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4C4A34A1DEA4FD700E0E04C /* AttributesConfiguration.swift */; }; D4C4A34E1DEA877200E0E04C /* FileHeaderRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4C4A34D1DEA877200E0E04C /* FileHeaderRule.swift */; }; D4C4A3521DEFBBB700E0E04C /* FileHeaderConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4C4A3511DEFBBB700E0E04C /* FileHeaderConfiguration.swift */; }; @@ -327,9 +328,9 @@ D42D2B371E09CC0D00CD7A2E /* FirstWhereRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FirstWhereRule.swift; sourceTree = ""; }; D4348EE91C46122C007707FB /* FunctionBodyLengthRuleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FunctionBodyLengthRuleTests.swift; sourceTree = ""; }; D43B04631E0620AB004016AF /* UnusedEnumeratedRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnusedEnumeratedRule.swift; sourceTree = ""; }; - D43B046A1E075905004016AF /* ClosureEndIndentationRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClosureEndIndentationRule.swift; sourceTree = ""; }; D43B04651E071ED3004016AF /* ColonRuleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColonRuleTests.swift; sourceTree = ""; }; D43B04671E07228D004016AF /* ColonConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColonConfiguration.swift; sourceTree = ""; }; + D43B046A1E075905004016AF /* ClosureEndIndentationRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClosureEndIndentationRule.swift; sourceTree = ""; }; D43DB1071DC573DA00281215 /* ImplicitGetterRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImplicitGetterRule.swift; sourceTree = ""; }; D442541E1DB87C3D00492EA4 /* ValidIBInspectableRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValidIBInspectableRule.swift; sourceTree = ""; }; D44254251DB9C12300492EA4 /* SyntacticSugarRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SyntacticSugarRule.swift; sourceTree = ""; }; @@ -346,6 +347,7 @@ D48AE2CB1DFB58C5001C6A4A /* AttributesRulesExamples.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AttributesRulesExamples.swift; sourceTree = ""; }; D4998DE61DF191380006E05D /* AttributesRuleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AttributesRuleTests.swift; sourceTree = ""; }; D4998DE81DF194F20006E05D /* FileHeaderRuleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileHeaderRuleTests.swift; sourceTree = ""; }; + D4B0226E1E0C75F9007E5297 /* VerticalParameterAlignmentRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VerticalParameterAlignmentRule.swift; sourceTree = ""; }; D4C4A34A1DEA4FD700E0E04C /* AttributesConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AttributesConfiguration.swift; sourceTree = ""; }; D4C4A34D1DEA877200E0E04C /* FileHeaderRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileHeaderRule.swift; sourceTree = ""; }; D4C4A3511DEFBBB700E0E04C /* FileHeaderConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileHeaderConfiguration.swift; sourceTree = ""; }; @@ -775,6 +777,7 @@ E81CDE701C00FEAA00B430F6 /* ValidDocsRule.swift */, D442541E1DB87C3D00492EA4 /* ValidIBInspectableRule.swift */, E88DEA931B099C0900A66CB0 /* VariableNameRule.swift */, + D4B0226E1E0C75F9007E5297 /* VerticalParameterAlignmentRule.swift */, 1EC163511D5992D900DD2928 /* VerticalWhitespaceRule.swift */, D47079AE1DFE520000027086 /* VoidReturnRule.swift */, 094384FF1D5D2382009168CF /* WeakDelegateRule.swift */, @@ -1091,6 +1094,7 @@ D46252541DF63FB200BE2CA1 /* NumberSeparatorRule.swift in Sources */, E315B83C1DFA4BC500621B44 /* DynamicInlineRule.swift in Sources */, D42D2B381E09CC0D00CD7A2E /* FirstWhereRule.swift in Sources */, + D4B0226F1E0C75F9007E5297 /* VerticalParameterAlignmentRule.swift in Sources */, D44254271DB9C15C00492EA4 /* SyntacticSugarRule.swift in Sources */, E88198441BEA93D200333A11 /* ColonRule.swift in Sources */, E809EDA11B8A71DF00399043 /* Configuration.swift in Sources */, diff --git a/Tests/SwiftLintFrameworkTests/RulesTests.swift b/Tests/SwiftLintFrameworkTests/RulesTests.swift index 2731c5aa5..c2c2822d8 100644 --- a/Tests/SwiftLintFrameworkTests/RulesTests.swift +++ b/Tests/SwiftLintFrameworkTests/RulesTests.swift @@ -329,6 +329,10 @@ class RulesTests: XCTestCase { verifyRule(VariableNameRule.description) } + func testVerticalParameterAlignment() { + verifyRule(VerticalParameterAlignmentRule.description) + } + func testVoidReturn() { verifyRule(VoidReturnRule.description) } @@ -402,6 +406,7 @@ extension RulesTests { ("testUnusedEnumerated", testUnusedEnumerated), ("testValidIBInspectable", testValidIBInspectable), // ("testVariableName", testVariableName), + ("VerticalParameterAlignmentRule", testVerticalParameterAlignment), ("testVoidReturn", testVoidReturn), ("testSuperCall", testSuperCall), ("testWeakDelegate", testWeakDelegate) From d480c865bd65ce053926724c4a69cd3defd26e64 Mon Sep 17 00:00:00 2001 From: Marcelo Fabri Date: Thu, 22 Dec 2016 20:55:11 -0200 Subject: [PATCH 07/11] Fix violation --- Source/SwiftLintFramework/Rules/LineLengthRule.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/SwiftLintFramework/Rules/LineLengthRule.swift b/Source/SwiftLintFramework/Rules/LineLengthRule.swift index 51fb75f03..877bf3cd8 100644 --- a/Source/SwiftLintFramework/Rules/LineLengthRule.swift +++ b/Source/SwiftLintFramework/Rules/LineLengthRule.swift @@ -66,7 +66,7 @@ public struct LineLengthRule: ConfigurationProviderRule, SourceKitFreeRule { /// /// - returns: sourceString with the given literals replaced by `#` private func stripLiterals(fromSourceString sourceString: String, - withDelimiter delimiter: String) -> String { + withDelimiter delimiter: String) -> String { var modifiedString = sourceString // While copy of content contains literal, replace with a single character From 09802b52b58287c5174a331fb434027f81568bda Mon Sep 17 00:00:00 2001 From: Marcelo Fabri Date: Thu, 22 Dec 2016 21:21:49 -0200 Subject: [PATCH 08/11] Changelog position --- CHANGELOG.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0311cab7e..1b149654d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,10 @@ ##### Enhancements -* None. +* Add `vertical_parameter_alignment` rule that checks if parameters are + vertically aligned if there're line breaks in a function declaration. + [Marcelo Fabri](https://github.com/marcelofabri) + [#1033](https://github.com/realm/SwiftLint/issues/1033) ##### Bug Fixes @@ -53,11 +56,6 @@ [Marcelo Fabri](https://github.com/marcelofabri) [#1005](https://github.com/realm/SwiftLint/issues/1005) -* Add `vertical_parameter_alignment` rule that checks if parameters are - vertically aligned if there're line breaks in a function declaration. - [Marcelo Fabri](https://github.com/marcelofabri) - [#1033](https://github.com/realm/SwiftLint/issues/1033) - ##### Bug Fixes * `FunctionParameterCountRule` also ignores generic initializers. From 436af7c0e2e9e6e253b27026fdecf3a83bb9ff20 Mon Sep 17 00:00:00 2001 From: JP Simard Date: Thu, 22 Dec 2016 16:01:03 -0800 Subject: [PATCH 09/11] changelog wording edits --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b149654d..7e6184a14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ ##### Enhancements * Add `vertical_parameter_alignment` rule that checks if parameters are - vertically aligned if there're line breaks in a function declaration. + vertically aligned for multi-line function declarations. [Marcelo Fabri](https://github.com/marcelofabri) [#1033](https://github.com/realm/SwiftLint/issues/1033) From 793743894759d4366390dab42d68b2db0f6a3fa9 Mon Sep 17 00:00:00 2001 From: Marcelo Fabri Date: Thu, 22 Dec 2016 22:03:34 -0200 Subject: [PATCH 10/11] Date format --- .../Rules/VerticalParameterAlignmentRule.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/SwiftLintFramework/Rules/VerticalParameterAlignmentRule.swift b/Source/SwiftLintFramework/Rules/VerticalParameterAlignmentRule.swift index 650aeba21..f9f6dc388 100644 --- a/Source/SwiftLintFramework/Rules/VerticalParameterAlignmentRule.swift +++ b/Source/SwiftLintFramework/Rules/VerticalParameterAlignmentRule.swift @@ -2,7 +2,7 @@ // VerticalParameterAlignmentRule.swift // SwiftLint // -// Created by Marcelo Fabri on 22/12/16. +// Created by Marcelo Fabri on 12/22/16. // Copyright © 2016 Realm. All rights reserved. // From 1bc6c9d0d3cdbdb03d636bc5b68be2bcb3bd31b6 Mon Sep 17 00:00:00 2001 From: JP Simard Date: Thu, 22 Dec 2016 16:19:27 -0800 Subject: [PATCH 11/11] fix wrong rule identifier in changelog entry --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45cb93e10..c27766b88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ ##### Breaking -* `file_length` rule now has a default value of `120` for warnings. +* `line_length` rule now has a default value of `120` for warnings. [Marcelo Fabri](https://github.com/marcelofabri) [#1008](https://github.com/realm/SwiftLint/issues/1008)