List Analyzer rules in an independent section in the rule directory (#4664)

This commit is contained in:
Ethan Wong 2023-01-03 14:18:25 +08:00 committed by GitHub
parent d6ff2a7f37
commit 68dc0f58d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -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

View File

@ -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
@ -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"))
"""
}