sonar-go
sonar-go copied to clipboard
Rule S1117: Local variables should not shadow class fields
Implements RSPEC-1117
I wonder if this rule works in Go, I am afraid it doesn't. @janos-ss wdyt?
The closest thing I can think of in Go:
var a int
func value() int {
var a int
return a
}
I think the idea in the rule can be applied here.
However, I'm not sure if a generic implementation is possible, because of the different search spaces. For example in Go we have to compare package scope with function bodies, and in Java class scope with member functions.