Skip to content

Commit

Permalink
Fix default rules section in documentation (#3857)
Browse files Browse the repository at this point in the history
While browsing the rules documentation, I noticed **many** rules were both in the Default Rules and in the Opt In Rules section.

After looking into it, the docs of the `drop(while predicate: (Element) throws -> Bool` function states:

A closure that takes an element of the sequence as its argument and returns true if the element should be skipped or false if it should be included. **Once the predicate returns false it will not be called again.**

This caused the `defaultRuleDocumentations` array to contain almost all `ruleDocumentation`.
  • Loading branch information
natanrolnik authored Feb 15, 2022
1 parent c09b6fe commit fe905f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
* Fix crash in the `closure_end_indentation` rule when linting with Swift 5.6.
[JP Simard](https://github.com/jpsim)
[#3830](https://github.com/realm/SwiftLint/issues/3830)

* Fix default rules section in documentation.
[Natan Rolnik](https://github.com/natanrolnik)
[#3857](https://github.com/realm/SwiftLint/pull/3857)

## 0.46.2: Detergent Package

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public struct RuleListDocumentation {
// MARK: - Private

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

return """
Expand Down

0 comments on commit fe905f8

Please sign in to comment.