-
Notifications
You must be signed in to change notification settings - Fork 19
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
Ignore idiomatic error checking #40
Comments
Hi @MohammadBnei, thanks in advance. Gocognit calculates complexity based on the paper, I'm not trying to bring new way to calculate cognitive complexity. I do understand Go use "err checking and return" instead of throw exception. Which means it easy for Go to have complexity higher compare to language that has exception handling. But again, the cognitive load of our brains is the same like we read another Sometimes inside the I very appreciate. I promise nothing, but let me consider this. I'm open if you want to have a discussion on this. Or PoC/PR would be very welcome. |
+1 the proposal. I would like to see a switch to ignore Cognitive complexity penalizes for nested I'm seeing the cognitive complexity is 2X higher than cyclomatic complexity for some of my functions, but I'm not feeling that when looking at code in my IDE. The other relevant point is that a good IDE will hide/collapse the idiomatic error checking code -- this makes code more readable and less cognitively complex. |
If this is the case then no cognitive load for the
If the IDE automatically hide this, then (it can be) true there is no cognitive load. Which IDE doing this? Btw, I'm open for the proposal and contribution for this. We can make it by default disabled and enable it by consent |
Nice project !
Since golang has the
if err !=nil { return err }
way of handling errors, it may be a nice touch to not increment the complexity when using the idiomatic golang error checking implementation.This is just a proposition.
The text was updated successfully, but these errors were encountered: