Copy paste detector
Hi,
I‘m searching for a good copy paste code detector for my ci pipeline.
I tried sonarqube but I want to have the result in the ci and don’t want to wait for the webhook.
pmd cpd looks quite promising.
What are you using or recommending?
6 Replies
I believe codefactor.io is an alternative to sonarqube. See what they have to offer, maybe it has what you need
Seems like I can’t connect my on premise gitlab to it.
Thanks anyway.
i have no direct idea, as i have never thought about the problem.
are you trying to detect code that is duplicated within the same codebase or do you want to check if the code is also used outside, in open source repos?
ah ok, the CPD website explains it.
https://pmd.github.io/pmd/pmd_userdocs_cpd.html
it is essentially trying to push u towards the DRY principle.
Interesting!
what are your problems with integrating the CPD cli?
Finding duplicated code with CPD | PMD Source Code Analyzer
Learn how to use CPD, the copy-paste detector shipped with PMD.
thanks for the info. so i am on the right way.
have you ever seen casacades of copied code in switch case blocks? or near similar functions? cpd is a good indicator that more then one place is responsible for the same thing. i had good experiecnes with it in other languages. so i was searching for something to build into the ci
Cloned code 'can' be ok sometimes. Just saying 😁