Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove @ mark to fix invalid link in Rules.md #2669

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 9 additions & 1 deletion Source/SwiftLintFramework/Models/RuleList+Documentation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}