diff --git a/CHANGELOG.md b/CHANGELOG.md index 231ecf7286..452ef18d58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,10 @@ ##### Bug Fixes +* Fixed whitespace being added to TODO messages. + [W. Bagdon](https://github.com/wbagdon) + [#792](https://github.com/realm/SwiftLint/issues/792) + * Fixed regex bug in Vertical Whitespace Rule by using SourceKitten instead. The rule now enabled by default again (no longer opt-in). [J. Cheyo Jimenez](https://github.com/masters3d) diff --git a/Source/SwiftLintFramework/Rules/TodoRule.swift b/Source/SwiftLintFramework/Rules/TodoRule.swift index afdf7ebe0b..b1f07ef13f 100644 --- a/Source/SwiftLintFramework/Rules/TodoRule.swift +++ b/Source/SwiftLintFramework/Rules/TodoRule.swift @@ -58,6 +58,8 @@ public struct TodoRule: ConfigurationProviderRule { message = message.stringByReplacingOccurrencesOfString("TODO", withString: "") } message = message.stringByReplacingOccurrencesOfString("//", withString: "") + // trim whitespace + message = message.stringByTrimmingCharactersInSet(.whitespaceAndNewlineCharacterSet()) // limiting the output length of todo message let maxLengthOfMessage = 30