This is a reincarnation of https://github.com/uartois/sonar-golang/pull/47 - after I realized that maintenance is the development branch and a better place to propose these changes. Sorry for the mess.
The current regex for gocyclo does not match methods, only functions. Here I propose a regex that matches the following:
This is a reincarnation of https://github.com/uartois/sonar-golang/pull/47 - after I realized that
maintenance
is the development branch and a better place to propose these changes. Sorry for the mess.Foo()
(currently supported)(Foo).Bar()
(*Foo).Bar()
(foo *Foo).Bar()
AFAIK,
gocyclo
doesn't generate the last example, but I included it just to be safe.Replaced the hardcoded
10
ingocyclo
regex, in case someone configuresgocyclo
with a different threshold.Improved the regex for
vet/shadow
, to allow for file paths, for example:declaration of "err" shadows declaration at foo/bar/baz.go:123