英文:
how do I check java code duplications from files
问题
我正在进行一个项目,其中我必须检查两个文件之间的抄袭情况。在这两个文件中都包含了一些 Java 代码。也就是说,如果有两个名为 a.java 和 b.java 的文件,并且这两个文件中都有一些写在 .java 类中的 Java 代码,我需要检查这些代码的重复百分比。是否有人可以告诉我该如何解决这个问题?我是一个初学者。
英文:
I am going through a project where I have to check the plagiarism between two files.In two files there have some java code.That means if there are two files named a.java and b.java and in two files have some java code which was written in .java class and I have to check the duplicacy in percantage between the java code which was written the two files.
can anyone tell me how can I solve this problem?I am a beginner.
答案1
得分: 2
有几种方法可以做到这一点,但总体上,您必须使用第三方服务。
示例解决方案1:
将插件安装到您的集成开发环境(IDE)中。例如,如果您正在使用Eclipse,PMD支持重复代码检查。
示例解决方案2:
如果您正在使用类似GitHub的版本控制系统,您可以向存储库添加插件,它将为您执行检查。例如,您可以使用名为Codacy的插件。这是一个用于CI/CD的自动化测试工具,支持重复代码检查。
英文:
There are several ways to do so, but in general, you have to use third party service.
Example Solution 1:
Install plugin to your IDE. For example, if you are using Eclipse, PMD supports duplicated code checking.
Example Solution 2:
If you are using version control system like GitHub, you can add plugins to your repository and it will do the check for you. For instance, you can use plugin named Codacy. It is an automatic testing tool used in CI/CD, which supports duplicated code checking.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论