Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Show description of rule #1078

Closed
RishabhTayal opened this issue Dec 28, 2016 · 5 comments · Fixed by #1107
Closed

Show description of rule #1078

RishabhTayal opened this issue Dec 28, 2016 · 5 comments · Fixed by #1107
Labels
enhancement Ideas for improvements of existing features and rules.

Comments

@RishabhTayal
Copy link

It would be nice to show the description of the rule when running the swiftlint rules command.

@marcelofabri
Copy link
Collaborator

@RishabhTayal, thanks for the suggestion, however I feel that the table would be to large in that case. We already have an issue because of it (#1002).

However, you can use swiftlint rules [rule_id] to check all the information about one rule.

For example:

$ swiftlint rules comma
Comma Spacing (comma): There should be no space before and one after any comma.

Triggering Examples (violation is marked with '↓'):

Example #1

    func abc(a: String↓ ,b: String) { }

Example #2

    func abc(a: String↓ ,b: String↓ ,c: String↓ ,d: String) { }

Example #3

    abc(a: "string"↓,b: "string"

Example #4

    enum a { case a↓ ,b }

Example #5

    let result = plus(
        first: 3↓ , // #683
        second: 4
    )
    

Would that solve the issue for you?

@RishabhTayal
Copy link
Author

Thanks for quick response. I think it would be nice to see description of all rules at once. How about a new command swiflint rules_description or swiflint rules description?

@marcelofabri marcelofabri added the enhancement Ideas for improvements of existing features and rules. label Dec 28, 2016
@marcelofabri
Copy link
Collaborator

I think a subcommand would be nice but I have doubts on how readable would it be. IMO the better approach would be having a command that generated markdown and we would keep it in this repo so people could it all of this formatted.

@RishabhTayal
Copy link
Author

That would work too. 👍

@marcelofabri
Copy link
Collaborator

I've taken a shot on generating a markdown: https://gist.github.com/marcelofabri/7f568c40030bb672e62f72911e0392fc

It's currently missing rules configurations.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement Ideas for improvements of existing features and rules.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants