diff --git a/CHANGELOG.md b/CHANGELOG.md index ff7d461726..569b3ef203 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ [Matthew Healy](https://github.com/matthew-healy) [#2663](https://github.com/realm/SwiftLint/pull/2663) +* Remove @ mark to fix invalid link in Rules.md. + [Hiroki Nagasawa](https://github.com/pixyzehn) + [#2669](https://github.com/realm/SwiftLint/pull/2669) + #### Bug Fixes * `colon` rule now catches violations when declaring generic types with diff --git a/Rules.md b/Rules.md index c630e787cc..89ec9b14df 100644 --- a/Rules.md +++ b/Rules.md @@ -116,7 +116,7 @@ * [Quick Discouraged Pending Test](#quick-discouraged-pending-test) * [Redundant Discardable Let](#redundant-discardable-let) * [Redundant Nil Coalescing](#redundant-nil-coalescing) -* [Redundant @objc Attribute](#redundant-@objc-attribute) +* [Redundant @objc Attribute](#redundant-objc-attribute) * [Redundant Optional Initialization](#redundant-optional-initialization) * [Redundant Set Access Control Rule](#redundant-set-access-control-rule) * [Redundant String Enum Value](#redundant-string-enum-value) diff --git a/Source/SwiftLintFramework/Models/RuleList+Documentation.swift b/Source/SwiftLintFramework/Models/RuleList+Documentation.swift index 19d1b509a1..df6d0c71ab 100644 --- a/Source/SwiftLintFramework/Models/RuleList+Documentation.swift +++ b/Source/SwiftLintFramework/Models/RuleList+Documentation.swift @@ -88,7 +88,15 @@ extension RuleList { } private func summaryItem(_ text: String) -> String { - let anchor = text.lowercased().components(separatedBy: .whitespaces).joined(separator: "-") + var allowed = CharacterSet() + allowed.formUnion(.letters) + allowed.formUnion(.decimalDigits) + allowed.formUnion(.whitespaces) + allowed.insert(charactersIn: "-") + + let anchor = text.lowercased() + .components(separatedBy: allowed.inverted).joined() + .components(separatedBy: .whitespaces).joined(separator: "-") return "* [\(text)](#\(anchor))\n" } }