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

Fix default rules section in documentation #3857

Merged
merged 2 commits into from
Feb 15, 2022

Conversation

natanrolnik
Copy link
Contributor

@natanrolnik natanrolnik commented Feb 15, 2022

While browsing the rules documentation, I noticed many rules were both in the Default Rules and in the Opt In Rules section.

I ran the generate-docs command and found the following:

Xcode-2022-02-15-15 35 21

The numbers confirm they don't add up.

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

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.

This PR fixes it:

Xcode-2022-02-15-15 33 18

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`.

This commit fixes it.
@SwiftLintBot
Copy link

SwiftLintBot commented Feb 15, 2022

12 Messages
📖 Linting Aerial with this PR took 0.97s vs 0.95s on master (2% slower)
📖 Linting Alamofire with this PR took 0.99s vs 0.99s on master (0% slower)
📖 Linting Firefox with this PR took 3.5s vs 3.51s on master (0% faster)
📖 Linting Kickstarter with this PR took 6.66s vs 6.64s on master (0% slower)
📖 Linting Moya with this PR took 4.31s vs 4.37s on master (1% faster)
📖 Linting Nimble with this PR took 0.38s vs 0.38s on master (0% slower)
📖 Linting Quick with this PR took 0.17s vs 0.17s on master (0% slower)
📖 Linting Realm with this PR took 6.44s vs 6.44s on master (0% slower)
📖 Linting SourceKitten with this PR took 0.3s vs 0.3s on master (0% slower)
📖 Linting Sourcery with this PR took 1.84s vs 1.85s on master (0% faster)
📖 Linting Swift with this PR took 2.8s vs 2.81s on master (0% faster)
📖 Linting WordPress with this PR took 6.61s vs 6.62s on master (0% faster)

Generated by 🚫 Danger

Copy link
Collaborator

@jpsim jpsim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, thanks.

@jpsim jpsim merged commit fe905f8 into realm:master Feb 15, 2022
@natanrolnik natanrolnik deleted the fix-documentation-sections branch February 15, 2022 14:23
rcole34 pushed a commit to rcole34/SwiftLint that referenced this pull request Feb 22, 2022
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`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants