Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go: Fix FPs in go/incorrect-integer-conversion query #16234

Merged

Conversation

owen-mc
Copy link
Contributor

@owen-mc owen-mc commented Apr 16, 2024

I found the type switch FPs while looking at the results for #16120, which fixed some broken flow into type switch clauses. While thinking about how best to fix them I also realised that any type assertion should transform the flow state, so I implemented that as well.

A before and after MRVA run suggests that on the top 1000 repos this PR removes 218 FPs, but the more detailed picture is more nuanced. On a very small number of repos it increased the number of alerts. This seems counter-intuitive, as this PR only adds barriers and hence should only remove results. I investigated and found that this was because removing some flow allowed us to find more results within the default limit for fieldFlowBranchLimit.

@owen-mc owen-mc requested a review from a team as a code owner April 16, 2024 20:10
@github-actions github-actions bot added the Go label Apr 16, 2024
smowton
smowton previously approved these changes Apr 17, 2024
Copy link
Contributor

@smowton smowton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks plausible, though of course a performance risk. Sounds like you already have data on this from QA though?

@owen-mc
Copy link
Contributor Author

owen-mc commented Apr 17, 2024

@smowton I only did MRVA. I will do a QA run.

@owen-mc owen-mc force-pushed the go/incorrect-integer-conversion-type-switch-fp branch from 99c7b97 to 212a0f2 Compare April 17, 2024 16:03
@owen-mc
Copy link
Contributor Author

owen-mc commented Apr 17, 2024

I did a DCA run. No alert changes. The two biggest repos had a slight increase in analysis time, of 2-3%, but almost all the rest showed no difference at all. I suspect this may be due to the field flow branch limit. I will do a QA run just to be sure.

@owen-mc
Copy link
Contributor Author

owen-mc commented Apr 19, 2024

QA results look fine. No increases in alerts - not sure why that's different from MRVA. Big decreases on a couple of repos, just for go/incorrect-integer-conversion, and smaller decreases on quite a few others. Decrease in analysis time, especially on repos with big decreases.

@owen-mc owen-mc merged commit ea2cf27 into github:main Apr 19, 2024
14 checks passed
@owen-mc owen-mc deleted the go/incorrect-integer-conversion-type-switch-fp branch April 19, 2024 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants