SonarSource / sonar-go-archived

SonarGo: Go Analyzer for SonarQube
https://docs.sonarqube.org/display/PLUG/SonarGo
Other
120 stars 24 forks source link

Support method receivers for finding test files associated to report #342

Open sgleizes opened 5 years ago

sgleizes commented 5 years ago

The GoTestSensor used for analyzing unit test reports seems to assume that the tests are defined as free functions, whereas depending on the test framework or harness tests can be defined as methods of a test suite. This is a common pattern using test suites from testify.

The following regex could be updated to optionally support method receivers: https://github.com/SonarSource/sonar-go/blob/master/sonar-go-plugin/src/main/java/org/sonar/go/plugin/GoTestSensor.java#L139