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

Add new rule to SwiftLint for linting newlines before return statements #47

Open
svenmuennich opened this issue Oct 30, 2019 · 0 comments
Assignees
Labels
enhancement Issues that describe new features or improvements to existing features.

Comments

@svenmuennich
Copy link
Member

svenmuennich commented Oct 30, 2019

We should add a rule to SwiftLint via PR that allows linting newlines before a return statement.

This cannot be linted using a regular expression with reasonable complexity and hence needs to be implemented in code. Once we implemented this we should send it as a PR to the main SwiftLint repo and see if they would like to add it. Hence we should think about configuration options, for which I propse the following:

  • allowPrecedingComments: If set to true, a comment might precede a return statement without an empty line between them. In that case the comment must be preceded by a newline instead. true by default.

The rule should work similar to the one we already implemented for PHP.

The rule should be implemented using the AST provided by the new SyntaxRule.

@svenmuennich svenmuennich added the enhancement Issues that describe new features or improvements to existing features. label Oct 30, 2019
@svenmuennich svenmuennich self-assigned this Nov 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issues that describe new features or improvements to existing features.
Projects
None yet
Development

No branches or pull requests

1 participant