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

Support linting cuddled else #651

Closed
ateliercw opened this issue May 4, 2016 · 4 comments
Closed

Support linting cuddled else #651

ateliercw opened this issue May 4, 2016 · 4 comments
Labels
enhancement Ideas for improvements of existing features and rules.

Comments

@ateliercw
Copy link

ateliercw commented May 4, 2016

As an alternative to the standard StatementPosition Rule, I'd like to see support for uncuddled else statements, either as a configuration option for statement position, or as a separate mutually exclusive rule.

@jpsim
Copy link
Collaborator

jpsim commented Jun 2, 2016

yup, I'd envision this working as a configuration option on the statement position rule.

@jpsim jpsim added the enhancement Ideas for improvements of existing features and rules. label Jun 2, 2016
@ateliercw
Copy link
Author

@jpsim I folded the listing for uncuddled else into statement position on my branch, but I closed the PR until I get autocorrect implemented for the alternate style, if you have any comments on the parameter name or implementation let me know

https://github.com/ateliercw/SwiftLint/blob/ms-cuddled-else-rule/Source/SwiftLintFramework/Rules/StatementPositionRule.swift

@jpsim
Copy link
Collaborator

jpsim commented Jun 8, 2016

That looks good to me! Not 100% sure about the wording, but can't think of anything better either.

I could imagine autocorrect for the uncuddled case being difficult to get right with indentation, so I'd accept if autocorrect just skipped that rule if the uncuddled mode was specified.

@ateliercw
Copy link
Author

@jpsim I changed the options to use snake case to match the rest of the options, and have an autocorrect option that's passing tests

@jpsim jpsim closed this as completed Jun 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Ideas for improvements of existing features and rules.
Projects
None yet
Development

No branches or pull requests

2 participants