-
Notifications
You must be signed in to change notification settings - Fork 41
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
Enforce cuddling of error checks #65
Comments
Thanks for the issue! Yeah that would be cool! I agree that the recommended way is to cuddle the error with the assignment in your example (and that's why it's allowed/supported). I started working on fixing the errors and noticed that I had some design flaws I wanted to address first. I lost track a bit but I intend to pick up where I left and improve on this linter. When I do I'll add this feature as well! If someone wants to create a PR in the meanwhile that's very welcomed! |
Thanks to contributions from @JDiPierro this is now implemented and merged, thanks! @JDiPierro Since you're the one who also implemented this I'll let you close the issue if/when you're ready! |
I ran the error cuddling enforcement on a large codebase this morning and found a case that generates a false-positive:
I'll look into supporting that tonight. Other than that it ran great! Once that's fixed up I can put together a PR to |
Ah, thanks! Should've seen that and also another example of bad test coverage. :( I thought I've written tests but I guess I'm pretty biased since I wrote the linter. 😄 Please do, no rush since nothing is tagged, see master as development. |
@JDiPierro Have you tried out the master branch more this week? Do you think we can close this issue? |
I haven't run it on any repos beside the one project I've already integrated I was thinking of leaving this open until the golangci-lint changes get in for it and it's generally available. If you'd prefer to close it since the change is in master that's cool too :) I have a start to the golanci-lint changes in the But I believe before that can be merged WSL needs to cut a release so we can update the LMK how you'd like to proceed with that. |
Alright, no worries, just curious! No rush, just wanted to know if everything seems OK. Feel free to leave this open! I've drafted a new release (v2.1.0) on a new branch with the same name. I don't really like the idea of basing releases of specific branches but I think this is alright for this time. I think I'll probably merge v2.1.0 into master and the next release will be built directly on master. It's just easier to keep track of everything that way. |
PR in |
Merged to master in golangci-lint, will be in next release. |
I'd love to be able to enforce that error checking is cuddled with the error assignment.
For example, right now this doesn't trigger the linter:
But I'd like it to :)
Thanks for the awesome linter!
The text was updated successfully, but these errors were encountered: