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 to force/forbid ending newlines in case block #54

Merged
merged 2 commits into from
Nov 10, 2019

Conversation

bombsimon
Copy link
Owner

Addresses #49.

This is (maybe) a WIP/POC. I spent a lot of time on this since I couldn't get the logic to be easy enough to make this obvious. And just when I thought that I had something going on I realised that I should probably split this up in two settings.

  1. Force newlines at
  2. Forbid newlines before

I'm not sure how to combine these but I'll use this PR to iterate proposals.

@coveralls
Copy link

coveralls commented Oct 26, 2019

Pull Request Test Coverage Report for Build 140

  • 76 of 76 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+1.0%) to 89.1%

Totals Coverage Status
Change from base Build 137: 1.0%
Covered Lines: 1128
Relevant Lines: 1266

💛 - Coveralls

This commit loosens up quite alot on how case blocks should look. The main
reason is because they're quite complex, especially if you consider
comments. A comment in the end of a case might (depending on ths Pos())
belong to the next case for example. Even gofmt handles indentation
for comments in case blocks in multiple ways.

From now on the end user may or may not end cases with newlines or
comments. With this commit a user can configure when you *must* end
with a whitespace to improve readability which essentially is what this
litner is about
@bombsimon
Copy link
Owner Author

bombsimon commented Nov 10, 2019

Ok so now I've written my thoughts in #49 and in the commit but might as well add a short description here as well.

  • wsl should focus on when to add whitespace, not remove them
  • There are reasons to always allow trailing comments in case blocks so now we do that
  • It's reasonable to mix traling newlines and not in case blocks so now we allow that
  • It's now supported to force trailing newlines if a case block exceeds a set limit

Resolves #49

@bombsimon bombsimon merged commit 8b7218b into master Nov 10, 2019
@bombsimon bombsimon deleted the case-trailing-newline branch November 10, 2019 13:33
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

Successfully merging this pull request may close these issues.

3 participants