-
Notifications
You must be signed in to change notification settings - Fork 1
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
Expand linters set #36
Comments
Linters are great, but in many cases it's a balance between false positives/time to spend pleasing the linter and the effect of the problem it can prevent. At the same time looking at your list I see some new ones, so some periodic reshuffling of the linter set can be useful. |
Mostly always I would say that 500 lines long functions are strange. If it is a huge
Ask yourself what led you to the times you use func that returns N args and you do not need most of them (if the func is the internal one, of course, external libs can't be fixed but I do not think we use such).
What do you call "false positives" in that context? My arg is the example I provided: panic in the
I would force a dev to check asserting and panic explicitly, it (may) adds details, it saves reviewer's time, it does not allow mistakes when a dev writes asserting to check his code but forget to add a check (where it is needed, of course). Anyway, if panicing is OK in some scenarios, we usually write comment about that (~the same number of chars compared to panicing with some detailed message).
What do you call "false positives" in that context?
Sure, that is why I filtered them, and not just copy-pasted all the linters |
But other users may use all of them anyway, so you'll waste some time, but gain nothing. It can be tried though, if there is a small number of places like this and all of them can be legitimately fixed, then maybe it's OK. BTW, we have exactly one case of this (but
What detail can I add to https://github.com/nspcc-dev/neo-go/blob/9185820289ce942153bc5ba012e677b5278f0cb5/cli/server/server.go#L469? "If you see this panic, then whoever wrote this code is an idiot, but this is not likely to help you anyway, the system has failed"? It's not always the case, but I'd expect the majority of them to be like that.
|
I meant if it is a private func for internals (like it is in my example), then you (may) want to split it into subfuncs and not do
Nothing can be done, agree.
Do you mind
Bad design, IMO. And the linter would highlight it. We are gonna remove it, aren't, we?
I am not sure about neo-go code. My ide says that
Well, they are real examples of the magics, no? We add comments to explain what is happening here. This is not smth obvious (even for a neofs dev payments and order details are tricky). Also, we reuse them (you added two links and both of them are the same numbers meaning the same).
Arguable, but agree that const for that may be too much (but having it does not bother me).
Magic, no? Sometimes we add comments (that also can be comments to some well-named constants) to such numbers. |
Do we have an issue for our single example of this behavior? I'd leave it to that. Maybe this code is bad, maybe it can be improved, but I'd not add a linter for it.
Yes, I do. I want some specific signer, this signer doesn't use Rules, so I don't want to think about many other fields that can be set. For some simple signers like None or CalledByEntry I also don't care about Now the problem would be if I'm to set
He won't. There is no need to, other than tests of some kind.
We have exactly this number of signers and all the code around works with exactly that number. You can't change a constant and expect all the other code to work, for example. Compare that to
Well, it's a GB, as the variable name suggests. We can write |
|
I would add some:
containedctx: thoughts(see Addcontextcheck
linter neofs-node#1911)contextcheck: will help the linter above, it encourages passing(see Addcontext.Context
contextcheck
linter neofs-node#1911)bool
as a return value or even adds useful return values but do not use them; it is a red flag IMOstoragegroup put
neofs-node#2399I have just run through the available but turned off linters. Not all of them are appliable to us (some of them may be already implemented via the others and I have not noticed that) but that is a discussion issue. @roman-khimov, @cthulhu-rider, @smallhive.
The text was updated successfully, but these errors were encountered: