Rule Request: [doc_pattern]. required_pattern for a doc comment
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 19.7k
- Forks
- 2.3k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 11
Description
New Issue Checklist
- Updated SwiftLint to the latest version
- I searched for existing GitHub issues
New rule request
I've been trying to create a custom rule to force a pattern in documenting functions, specifically tests functions.
I want to force a multiline format for the tests as follows
class MyTests: XCTestCase {
/// ### Given
/// a
/// ### When
/// b
/// ### Then
/// c
func testExample() throws {
}
I've been trying to achieve this required pattern rule using a custom rule but I could not succeed, I don't even know if it would be possible.
I think a required pattern rule for functions can be beneficial:
- to enforce doc styling,
- to ease automatic parsing of doc for other tools to use.
The format of the rule could be inspired by the file_header rule
doc_pattern:
required_pattern:
included:
name:
match_kinds:
message:
severity:
The rule should be opt-in.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No implementation file or test is identified in the issue. Start by reviewing SwiftLint’s existing file_header rule and custom-rule capabilities, then define the opt-in configuration using the requested fields and add coverage for the multiline function-documentation pattern.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- documentation, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100