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

Add option to exclude examples from the rule documentation #3834

Merged

Conversation

SimplyDanny
Copy link
Collaborator

The option can be used if an example has mainly been added as another test case, but is not suitable as a user example. User examples should be easy to understand. They should clearly show where and why a rule is applied and where not. Complex examples with rarely used language constructs or pathological use cases which are indeed important to test but not helpful for understanding can be hidden from the documentation with this option.

I want to use this option especially to clean up the examples in the prefer_self_in_static_references rule. Some of them are not very user-friendly.

The option can be used if an example has mainly been added as another test case, but is not suitable
as a user example. User examples should be easy to understand. They should clearly show where and
why a rule is applied and where not. Complex examples with rarely used language constructs or
pathological use cases which are indeed important to test but not helpful for understanding can be
hidden from the documentation with this option.
@SwiftLintBot
Copy link

1 Warning
⚠️ Please include a CHANGELOG entry to credit yourself!
You can find it at CHANGELOG.md.
12 Messages
📖 Linting Aerial with this PR took 0.94s vs 0.96s on master (2% faster)
📖 Linting Alamofire with this PR took 1.0s vs 1.01s on master (0% faster)
📖 Linting Firefox with this PR took 3.38s vs 3.42s on master (1% faster)
📖 Linting Kickstarter with this PR took 6.7s vs 6.72s on master (0% faster)
📖 Linting Moya with this PR took 4.33s vs 4.33s on master (0% slower)
📖 Linting Nimble with this PR took 0.39s vs 0.39s on master (0% slower)
📖 Linting Quick with this PR took 0.17s vs 0.18s on master (5% faster)
📖 Linting Realm with this PR took 6.46s vs 6.49s on master (0% faster)
📖 Linting SourceKitten with this PR took 0.31s vs 0.31s on master (0% slower)
📖 Linting Sourcery with this PR took 1.89s vs 1.87s on master (1% slower)
📖 Linting Swift with this PR took 2.83s vs 2.84s on master (0% faster)
📖 Linting WordPress with this PR took 6.67s vs 6.67s on master (0% slower)

Here's an example of your CHANGELOG entry:

* Add option to exclude examples from the rule documentation.  
  [SimplyDanny](https://github.com/SimplyDanny)
  [#issue_number](https://github.com/realm/SwiftLint/issues/issue_number)

note: There are two invisible spaces after the entry's text.

Generated by 🚫 Danger

@codecov-commenter
Copy link

Codecov Report

Merging #3834 (72a3ead) into master (2f2a4ad) will decrease coverage by 0.00%.
The diff coverage is 25.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3834      +/-   ##
==========================================
- Coverage   92.13%   92.13%   -0.01%     
==========================================
  Files         438      438              
  Lines       22529    22532       +3     
==========================================
+ Hits        20758    20760       +2     
- Misses       1771     1772       +1     
Impacted Files Coverage Δ
...intFramework/Documentation/RuleDocumentation.swift 0.00% <0.00%> (ø)
Source/SwiftLintFramework/Models/Example.swift 100.00% <100.00%> (ø)
...iftLintFramework/Extensions/String+SwiftLint.swift 90.90% <0.00%> (+1.51%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2f2a4ad...72a3ead. Read the comment docs.

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.

This is great, thanks.

@jpsim jpsim merged commit d77d23c into realm:master Mar 2, 2022
@SimplyDanny SimplyDanny deleted the exclude-examples-from-documentation branch March 2, 2022 22:33
coffmark pushed a commit to coffmark/SwiftLint that referenced this pull request Apr 11, 2022
The option can be used if an example has mainly been added as another test case, but is not suitable
as a user example. User examples should be easy to understand. They should clearly show where and
why a rule is applied and where not. Complex examples with rarely used language constructs or
pathological use cases which are indeed important to test but not helpful for understanding can be
hidden from the documentation with this option.
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.

4 participants