uartois / sonar-golang

Sonarqube plugin for the golang language.
GNU Lesser General Public License v3.0
245 stars 32 forks source link

Change the gocyclo regex to recognize methods as well as functions #47

Closed maclav3 closed 6 years ago

maclav3 commented 6 years ago

The current regex for gocyclo does not match methods, only functions. Here I propose a regex that matches the following:

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.

Also, I replaced the hardcoded 10, in case someone configures gocyclo with a different threshold.

maclav3 commented 6 years ago

Sorry, just realized that I should rather propose this for the maintenance branch. Will open another PR.