-
Notifications
You must be signed in to change notification settings - Fork 1.7k
C++: Fix FPs for cpp/unused-static-function in files that were not extracted completely #10510
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
Conversation
I'm just looking at a possible performance issue on this PR... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to run a DCA on this once you've fixed the performance issue?
I'm actually fairly confident, the issue was an uncomplicated cartesian product. I will start a DCA run to be sure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM if DCA is happy!
Looks like this change removes > 200 results on DCA. I think we should check a subset of those to see if this looks reasonable. What do you say, @geoffw0? |
Yep, I'm not surprised if it removes a lot of results (and some of them will be TPs), but we should check at least a proportion of them are really FP. |
Do you know where to find the total number of results for |
I don't think this is possible out-of-the-box, no. There might be an option somewhere to tell it to generate the full list of alerts. We could ask in the DCA Slack channel about this if you think it'd be useful. |
I think it would be useful in cases like this, yes, but I'm tracking a million things today already. Feel free to talk to them. |
DCA: I'm ignoring the 5% overall increase in query run times, because this is a change to one QL file and it isn't very plausible its had an effect on so many other queries. Looking at some of the results: Kitware__CMake: Source/cmCPluginAPI.cxx:25:20:25:35 (represents 54 similar results)
abseil-cpp-linux: absl/base/exception_safety_testing_test.cc:526:6:526:13
systemd__systemd: src/analyze/analyze-security.c:148:22:148:40
Overall, many of these cases are in tests (so we wouldn't normally report them) and in macro or template heavy code (so difficult to understand manually). On MRVA I see the total number of results in 69 projects decrease from 779 to 416 (47% reduction), which seems fine for such a noisy query. Most cases we lose had both We could remove the part of the change that looks at |
cpp/ql/src/Best Practices/Unused Entities/UnusedStaticFunctions.ql
Outdated
Show resolved
Hide resolved
I've just done the change to just basing this on Tests still pass. There are now 717 MRVA results on 69 repos (8% less than original). Does anyone want to see another DCA run? |
DCA showed:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I do expect the changes in DCA results to be somewhat less dramatic in the first nightly we run after this is merged, as frontend fixes went in that affect systemd
and zeek/spicy
Merged. Thanks for reviewing! |
Fix FPs for
cpp/unused-static-function
in files that were not extracted completely, e.g. due to a compilation error part way through the file. As the test shows, this may hide some good results as well, but we expect the majority of results in incompletely extracted files to be false positives caused by the incomplete extraction.