uartois / sonar-golang

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

Unreachable code error not shown #37

Open Cosby86 opened 6 years ago

Cosby86 commented 6 years ago

Hello, I've the following gometalinter entry in my gometalinter's report: <error column="0" line="93" message="unreachable code" severity="error" source="vet"></error>

but this isn't shown in sonar. Can you kindly add this rule?

Blackmage89 commented 6 years ago

Yes it would be really helpful to see these kinds of errors.

thibaultfalque commented 6 years ago

Hi, I will add. Thanks for your feedback.

Cosby86 commented 6 years ago

Thank youl. I don't know if the regexp is the same but, the vet errors should be added:

<error column="0" line="186" message="possible misuse of unsafe.Pointer" severity="error" source="vet"/>

<error column="0" line="12" message="this return statement may be reached without using the backgroundcancel var defined on line 11" severity="error" source="vet"/>

<error column="0" line="11" message="the backgroundcancel function is not used on all paths (possible context leak)" severity="error" source="vet"/>

<error column="0" line="14" message="NotificationEventsHandler passes lock by value: sync.WaitGroup contains sync.noCopy" severity="error" source="vet"/>

Thank you for your kind support

thibaultfalque commented 6 years ago

Can you test this solution for resolve the problem with the rules unreachable code?

Cosby86 commented 6 years ago

I just tested it. It worked fine. I have the "unreachable code" in the sonar report. Thank you. Let me know if I can support you for adding other errors.

Kind regards

danielleberre commented 6 years ago

@Cosby86 could you close the issue now that the problem is fixed?

Cosby86 commented 6 years ago

Hi danielle I'm waiting for the other errors support:

<error column="0" line="186" message="possible misuse of unsafe.Pointer" severity="error" source="vet"/>

<error column="0" line="12" message="this return statement may be reached without using the backgroundcancel var defined on line 11" severity="error" source="vet"/>

<error column="0" line="11" message="the backgroundcancel function is not used on all paths (possible context leak)" severity="error" source="vet"/>

<error column="0" line="14" message="NotificationEventsHandler passes lock by value: sync.WaitGroup contains sync.noCopy" severity="error" source="vet"/>

Are those errors already implemented?

danielleberre commented 6 years ago

@thibaultfalque could we add the above vet errors in the plugin to close that issue?

thibaultfalque commented 6 years ago

hi @Cosby86 and @danielleberre the first and the last error are present (00465710136012130065ea25ca3b20c1857d5222).

I will add the other rules but I don't find the rules in vet page (https://golang.org/cmd/vet/).