SwiftLint
SwiftLint copied to clipboard
Clarify documentation for multiline_arguments_brackets and multiline_literal_brackets
New Issue Checklist
- [x] Updated SwiftLint to the latest version
- [x] I searched for existing GitHub issues
Describe the bug
Hello SwiftLint Team!
I have a documentation improvement request. Today, my coworkers and I were reviewing the documentation for two rules multiline_arguments_brackets
and multiline_literal_brackets
and we thought it could be improved by including the following triggering examples.
The reason I am requesting these triggering examples be included in the documentation is because they are a common style, and it's not immediately obvious from the rule definitions whether these examples would trigger or not. We ended up wasting time making a sample project and integrating SwiftLint, just to figure out if these two examples would trigger or not. So to avoid future lost person-hours, I propose this documentation improvement! π
Thanks, Chris
multiline_arguments_brackets
Existing documentation: https://realm.github.io/SwiftLint/multiline_arguments_brackets.html
// Triggering Example
foo(βparam1: "Param1",
param2: "Param2",
param3: "Param3"β)
multiline_literal_brackets
Existing documentation: https://realm.github.io/SwiftLint/multiline_literal_brackets.html
// Triggering Example
let houseCup = [β"gryffinder": 460,
"hufflepuff": 370,
"ravenclaw": 410,
"slytherin": 450β]
I have attached a screenshot and a sample project showing that the above two examples are indeed triggering. Sample Project: SwiftLintTest.zip
P.s. If you'd like me to make a pull request to update the documentation, would you kindly confirm how I could do so? I don't see a central location for the documentation in the repository. I wonder if the documentation is generated from those RuleDescription
objects in the code? For example: https://github.com/realm/SwiftLint/blob/master/Source/SwiftLintFramework/Rules/Style/MultilineLiteralBracketsRule.swift
You are exactly right. The examples are listed in the RuleDescription
of every rule. They will be used in the documentation of the rule. Furthermore, they are automatically tested. Feel free to create a PR!
Thanks for the info @SimplyDanny. I have made a new PR: https://github.com/realm/SwiftLint/pull/4098 π