Thank you for providing this useful tool.
I’d like to propose an enhancement to improve how gocyclo handles function-level complexity thresholds.
Currently, gocyclo offers two options: setting a global complexity threshold (--over) or ignoring a function entirely via gocyclo:ignore. However, this binary approach is limiting.
Consider a project where all functions stay below --over=10, except for one function with a complexity of 20.
If this function cannot be easily refactored without sacrificing other qualities, my only options are:
- Raising
--over to 20, allowing all functions to double in complexity.
- Ignoring the function via
gocyclo:ignore, which removes all complexity checks for it.
Neither option is ideal. To address this, I propose a per-function override:
// Foo - a complex function.
//gocyclo:max-complexity=20
func Foo() { ... }
This would:
- Allow case-by-case complexity adjustments while keeping the global threshold.
- Enforce limits even for overridden functions, preventing unchecked complexity growth.
I’d love to hear your thoughts on this proposal.
Thank you for providing this useful tool.
I’d like to propose an enhancement to improve how gocyclo handles function-level complexity thresholds.
Currently, gocyclo offers two options: setting a global complexity threshold (--over) or ignoring a function entirely via gocyclo:ignore. However, this binary approach is limiting.
Consider a project where all functions stay below
--over=10, except for one function with a complexity of20.If this function cannot be easily refactored without sacrificing other qualities, my only options are:
--overto20, allowing all functions to double in complexity.gocyclo:ignore, which removes all complexity checks for it.Neither option is ideal. To address this, I propose a per-function override:
This would:
I’d love to hear your thoughts on this proposal.