sonar-golang icon indicating copy to clipboard operation
sonar-golang copied to clipboard

Unreachable code error not shown

Open Cosby86 opened this issue 8 years ago • 9 comments

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?

Cosby86 avatar Oct 05 '17 15:10 Cosby86

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

Blackmage89 avatar Oct 05 '17 15:10 Blackmage89

Hi, I will add. Thanks for your feedback.

thibaultfalque avatar Oct 06 '17 06:10 thibaultfalque

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

Cosby86 avatar Oct 06 '17 06:10 Cosby86

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

thibaultfalque avatar Oct 06 '17 09:10 thibaultfalque

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

Cosby86 avatar Oct 06 '17 09:10 Cosby86

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

danielleberre avatar Oct 14 '17 11:10 danielleberre

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?

Cosby86 avatar Oct 16 '17 06:10 Cosby86

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

danielleberre avatar Feb 18 '18 19:02 danielleberre

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/).

thibaultfalque avatar Feb 19 '18 13:02 thibaultfalque