-
Notifications
You must be signed in to change notification settings - Fork 10
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
Enable all golangci-lint linters #46
Conversation
e6e5c47
to
b378dc7
Compare
Hard to say without using them, but generally for more consistent code 👍 |
b378dc7
to
ebf62d3
Compare
@at-wat @tarrencev Here is another pass! https://gist.github.com/dbd355c702abbbf8ae818856ef50fa72 this is what it gives us on I think it is better to disable things selectively. These linters really push newer programmers the right way I think. |
I'm a bit confused. The PR says "enable all" but there's a bunch we disable? |
There's a few places in DTLS that I think the linters are a bit too enthusiastic about
True it's a global. But why is that bad? Structs can't be assigned to a const otherwise we would've done that. Same for the lookup maps. There's some cognitive complexity issues too, but I'm not sure how to deal with those in the TLS flights. It also seems unhappy about anything with a Then we have stuff like:
Which I get, but this is just how they're named to match with the IANA registry. Few other places too where it raises some eyebrows for me:
Yes crypto/rand is better, but it's not necessary here. Similarly, some of these:
We have a default clause there, so I don't see how it's not exhaustive? There's a few other places where this happens too where we don't have defaults though, but you can't reach those due to earlier validation logic. |
Also, can we override those exclude rules at the repo level? B/c there's a bunch of stuff in
|
BTW, it's better to mark review comments resolved instead of deleting. |
@daenney sorry at first I turned them all on, but after a few rounds of review I turned some stuff off. I also made the mistake of deleting my comments (should have just hidden them) The trade-off I am trying to make is to have the most restrictive linters possible, without hurting contributors/maintainers. Having to review PRs has taken up a lot of my time lately. It takes a lot of time to explain to people why certain things need to change and feels subjective. I feel like when we go with a global we know when it is good (or bad) but is hard for new programmers. I really want to get them involved though!
You can drop a For the linters you called out
|
Exhaustive might be less annoying with this setting enabled: exhaustive:
default-signifies-exhaustive: true Other than that I'm guess I'm OK with most of this. But someone's going to have to do a big PR to fix all the warnings on DTLS. There's a bunch of complexity warnings too for the different flight handlers, and a lot around the dynamic errors thing. |
This is going to take a long time to fix
ebf62d3
to
3abfb2e
Compare
What do you think? I prefer being aggressive with these (less to worry about with contributors)
But I don't want to make things miserable for people