-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix Coverity COPY_PASTE_ERROR issues in acl_device_op_test.cpp
#254
Conversation
Yes, I agree with both. Maybe swapping the arguments works as suggested here? Besides swapping arguments, does reordering these lines have any effect? Taking a step back, how many more of these copy-paste issues are you seeing? Is there a common pattern to these issues that triggers Coverity? Are all of these false positives? |
There are only 5 of these Coverity issues in the runtime. I believe what triggers this is having similar expressions for some amount of lines, and then one line suddenly changing one (or possibly more) of the variables involved in those expressions, but utilizing the same overall structure. Reordering the lines does work, but I don't like that we have to do this just to avoid Coverity from complaining. It is still better than adding a comment, though.
It looks like 4/5 of them are. The only one that is likely not a false positive (but albeit a minor problem that doesn't effect our tests) is:
Taking a look at the code for that, it does look like it should be |
Indeed, these tweaks are slightly annoying but still preferable over a all-caps marker that briefly draws and wastes the attention of the reader. 5 of these issues out of ~160 is not too bad. You can pick whichever tweak you think preserves the original intent better, reordering arguments or reordering lines. |
Fixes: ``` test/acl_device_op_test.cpp:987:3: Type: Copy-paste error (COPY_PASTE_ERROR) test/acl_device_op_test.cpp:984:3: original: "op0->timestamp" looks like the original copy. test/acl_device_op_test.cpp:987:3: copy_paste_error: "op0" in "op0->timestamp" looks like a copy-paste error. test/acl_device_op_test.cpp:987:3: remediation: Should it say "op1" instead? test/acl_device_op_test.cpp:906:3: Type: Copy-paste error (COPY_PASTE_ERROR) test/acl_device_op_test.cpp:878:3: original: "op0->timestamp" looks like the original copy. test/acl_device_op_test.cpp:906:3: copy_paste_error: "op0" in "op0->timestamp" looks like a copy-paste error. test/acl_device_op_test.cpp:906:3: remediation: Should it say "op1" instead? ```
fcca7ec
to
b1dda9b
Compare
@pcolberg I've removed the comment. This should still make Coverity happy. |
acl_device_op_test.cpp
After taking a look at the code, it does not appear that these are copy paste errors.
I don't really like putting a comment to mark Coverity issues as false-positives, but I dislike obfuscating the code to resolve the error even more.
Fixes: