nakedret
nakedret copied to clipboard
Why this reports error for named return
noticed https://github.com/alexkohler/nakedret/blob/b2c01465241327a7db35ec77f94ff19168bcabaa/testdata/nested.go#L11-L17
I think this return in line 16 is not harmful, and this linter should not report error :thinking:
Hey there - it looks like this is a bug - thanks for the report! I like won't have the time to get to this in the immediate future, but if anyone is looking for an easy bug to fix, I imagine this wouldn't be too bad to handle.
@lance6716 @alexkohler Why do you believe this to be a bug?
@lance6716 @alexkohler Why do you believe this to be a bug?
This is not that severe as a bug IMO. As the README says
Naked returns are okay if the function is a handful of lines. Once it's a medium sized function, be explicit with your return values.
Maybe different guys have different threshold about what's "a handful of lines"
@rittneje heh, on a second look, you're right. I originally read this bug as a naked return being reported on line 14, not 16. Line 16 reporting a naked return is as designed 👍
Maybe different guys have different threshold about what's "a handful of lines"
That is fair - that threshold should be configurable through the -l
parameter.