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

Clarify documentation for multiline_arguments_brackets and multiline_literal_brackets #4060

Closed
2 tasks done
chrisjf opened this issue Aug 1, 2022 · 2 comments
Closed
2 tasks done

Comments

@chrisjf
Copy link
Contributor

chrisjf commented Aug 1, 2022

New Issue Checklist

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.
Screen Shot 2022-08-01
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

@SimplyDanny
Copy link
Collaborator

SimplyDanny commented Aug 2, 2022

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!

@chrisjf
Copy link
Contributor Author

chrisjf commented Aug 15, 2022

Thanks for the info @SimplyDanny. I have made a new PR: #4098 🙂

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

No branches or pull requests

2 participants