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
Treat short declarations as declarations, not assignments (enhancement) #102
Comments
Interesting! We had a quite long discussion in #82 about a similar question but that was to group I would be open to a PR for the first case, I encourage everyone who wants to use whitespaces! I would however not enforce this by default but as an opt in. The second one is violating the enforcing of cuddle error checks to where the error is defined, I'm not sure how they would work together. Maybe just have the new flag only allowing assignment grouping override any other flag. What do you thing this kind of configuration would be referenced to and how would it work? |
Yeah. One thing is that I find it clearer to talk about Yes, it would definitely be opt-in, and yes, it would force these things to be grouped apart You can see my style in https://github.com/matt4biz/envy for example; I've found over the years that I have about 30% of the total lines as blank lines, even across different languages (well, at least since giving up punch cards ;-) I particularly like separating declarations into bunches and having spaces around all block constructs; it's all about making the code easier to speed-read |
Sounds reasonable to group it that way! I like your code style in general, we seem to have very similar idea. Feel free to start working on a PR with an opt-in option to enforce shorthand declarations to be cuddled only with other shorthand declarations! |
This option treats a short declaration with := as different than a plain assignment with = and so prevents them cuddling together, as well as not allowing a short declaration to cuddle with a block, for example.
I'll hold of drafting a new release until we decided on #104 as well so we can merge them to |
Both PRs merged and I created v3.3.0 so it should be easy to update Thanks for your issues and PRs, really appreciated! |
😎 |
Ahh, having looked at your last merge to golangci-lint, I see it's a bit more than just updating a version LMK if you'd like me to help / review the PR |
I'll create a PR later today and let you know when it's ready! |
PR looks good to me; thanks again, this has been really easy! |
Merged! |
I'd like to see a configuration option that would prevent short declarations from cuddling with anything but themselves, e.g.
would work, but this should fail with the option enabled:
and it would override many other cuddle rules automatically, also preventing these sorts of things:
I'm apparently an even bigger fan of whitespace than most 😄
I'd be happy to work on a PR for this if you're open to it
The text was updated successfully, but these errors were encountered: