Skip to content

Commit

Permalink
Merge pull request #2669 from pixyzehn/fix-link-for-redundant-@objc-a…
Browse files Browse the repository at this point in the history
…ttribute

Remove @ mark to fix invalid link in Rules.md
  • Loading branch information
marcelofabri authored Mar 13, 2019
2 parents 57af7f0 + ddce88f commit 9fc1d57
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,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 @@ -117,7 +117,7 @@
* [Reduce Boolean](#reduce-boolean)
* [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"
}
}

0 comments on commit 9fc1d57

Please sign in to comment.