Skip to content

Commit

Permalink
List Analyzer rules in an independent section in the rule directory (r…
Browse files Browse the repository at this point in the history
  • Loading branch information
GetToSet authored Jan 3, 2023
1 parent d6ff2a7 commit 68dc0f5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
[jimmya](https://github.com/jimmya)
[#issue_number](https://github.com/realm/SwiftLint/issues/4609)

* Separate analyzer rules as an independent section in the rule directory of the reference.
[Ethan Wong](https://github.com/GetToSet)
[#4664](https://github.com/realm/SwiftLint/pull/4664)

#### Bug Fixes

* Report violations in all `<scope>_length` rules when the error threshold is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public struct RuleListDocumentation {

private var indexContents: String {
let defaultRuleDocumentations = ruleDocumentations.filter { !$0.isOptInRule }
let optInRuleDocumentations = ruleDocumentations.filter { $0.isOptInRule }
let optInRuleDocumentations = ruleDocumentations.filter { $0.isOptInRule && !$0.isAnalyzerRule }
let analyzerRuleDocumentations = ruleDocumentations.filter { $0.isAnalyzerRule }

return """
# Rule Directory
Expand All @@ -51,6 +52,12 @@ public struct RuleListDocumentation {
.map { "* `\($0.ruleIdentifier)`: \($0.ruleName)" }
.joined(separator: "\n"))
## Analyzer Rules
\(analyzerRuleDocumentations
.map { "* `\($0.ruleIdentifier)`: \($0.ruleName)" }
.joined(separator: "\n"))
"""
}

Expand Down

0 comments on commit 68dc0f5

Please sign in to comment.