fork的Jplag源码。掺杂了部分修改。

Patrick Thiel 0b0747c2ea Merge remote-tracking branch 'origin/master' into feature/endToEndDokumentation 4 лет назад
.github 64afd1472e Revert "Skip sonar scan if build skipped (#546)" (#547) 4 лет назад
.mvn e38e320981 Added spotless configuration. Not applied formatting yet. 4 лет назад
jplag dc1f710475 Merge pull request #659 from jplag/parallel-file-writing-fix 4 лет назад
jplag.cli 028d19caca Fix missing float -> double 4 лет назад
jplag.endtoend-testing 0b0747c2ea Merge remote-tracking branch 'origin/master' into feature/endToEndDokumentation 4 лет назад
jplag.frontend-testutils 9daac143f2 apply code suggestions 4 лет назад
jplag.frontend-utils 566b736026 adapt documentation after reviews 4 лет назад
jplag.frontend.cpp 787f38f61b fix SonarCloud issues 4 лет назад
jplag.frontend.csharp-6 787f38f61b fix SonarCloud issues 4 лет назад
jplag.frontend.emf-metamodel 5853e6d079 Merge branch 'master' into core-algorithm-refactoring 4 лет назад
jplag.frontend.emf-metamodel-dynamic 5853e6d079 Merge branch 'master' into core-algorithm-refactoring 4 лет назад
jplag.frontend.golang aaeab2c4c6 apply more code suggestions 4 лет назад
jplag.frontend.java 5853e6d079 Merge branch 'master' into core-algorithm-refactoring 4 лет назад
jplag.frontend.kotlin 5853e6d079 Merge branch 'master' into core-algorithm-refactoring 4 лет назад
jplag.frontend.python-3 787f38f61b fix SonarCloud issues 4 лет назад
jplag.frontend.rlang 5853e6d079 Merge branch 'master' into core-algorithm-refactoring 4 лет назад
jplag.frontend.rust 4742289c1c Merge branch 'master' into core-algorithm-refactoring 4 лет назад
jplag.frontend.scala aaeab2c4c6 apply more code suggestions 4 лет назад
jplag.frontend.scheme 787f38f61b fix SonarCloud issues 4 лет назад
jplag.frontend.text 4742289c1c Merge branch 'master' into core-algorithm-refactoring 4 лет назад
report-viewer 147fbcf968 Dependency(deps): Bump vue from 3.2.37 to 3.2.39 in /report-viewer 4 лет назад
.gitattributes 8cf2d8d80e Add gitattributes file. 4 лет назад
.gitignore d8496a73db add ignore rule for .vscode and .antlr directories 4 лет назад
LICENSE 15959fff5c Add license 11 лет назад
README.md 70ffa9e897 Change Report Viewer Part in README.md 4 лет назад
formatter.xml ad7184577a Adapt formatter configuration to indent statements in switch bodies. 4 лет назад
pom.xml ec2c3c47b3 Dependency(deps): Bump org.eclipse.emf.ecore.xmi from 2.16.0 to 2.17.0 4 лет назад
spotless.importorder e38e320981 Added spotless configuration. Not applied formatting yet. 4 лет назад

README.md

JPlag logo

JPlag - Detecting Software Plagiarism

CI Build Latest Release Maven Central License GitHub commit activity

JPlag is a system that finds similarities among multiple sets of source code files. This way it can detect software plagiarism and collusion in software development. JPlag currently supports various programming languages, EMF metamodels, and natural language text.

Supported Languages

In the following, a list of all supported languages with their supported language version is provided. A language can be selected from the command line using the -l <cli argument name> argument.

Language Version CLI Argument Name state parser
Java 17 java mature JavaC
C++ 11 cpp legacy JavaCC
C# 8 csharp beta ANTLR 4
Go 1.17 golang beta ANTLR 4
Kotlin 1.3 kotlin beta ANTLR 4
Python 3.6 python3 legacy ANTLR 4
R 3.5.0 rlang beta ANTLR 4
Rust 1.60.0 rust beta ANTLR 4
Scala 2.13.8 scala beta Scalameta
Scheme ? scheme unknown JavaCC
EMF Metamodel 2.25.0 emf-metamodel alpha EMF
EMF Metamodel (dynamic) 2.25.0 emf-metamodel-dynamic alpha EMF
Text (naive) - text legacy CoreNLP

Download and Installation

Downloading a release

Via Maven

JPlag is released on Maven Central, it can be included as follows:

<dependency>
  <groupId>de.jplag</groupId>
  <artifactId>jplag</artifactId>
</dependency>

Building from sources

  1. Download or clone the code from this repository.
  2. Run mvn clean package from the root of the repository to compile and build all submodules. Run mvn clean package assembly:single instead if you need the full jar which includes all dependencies.
  3. You will find the generated JARs in the subdirectory jplag.cli/target.

Usage

JPlag can either be used via the CLI or directly via its Java API. For more information, see the usage information in the wiki.

CLI

Note that the legacy CLI is varying slightly.

JPlag - Detecting Software Plagiarism

Usage: JPlag [ options ] [ <root-dir> ... ] [ -new <new-dir> ... ] [ -old <old-dir> ... ]
 <root-dir>        Root-directory with submissions to check for plagiarism
 <new-dir>         Root-directory with submissions to check for plagiarism
 <old-dir>         Root-directory with prior submissions to compare against

named arguments:
  -h, --help       show this help message and exit
  -l               {java,python3,cpp,csharp,golang,kotlin,rlang,rust,scala,text,scheme,emf-metamodel,emf-metamodel-dynamic} Select the language to parse the submissions (default: java)
  -bc BC           Path of the directory containing the base code (common framework used in all submissions)
  -v               {quiet,long} Verbosity of the logging (default: quiet)
  -d               Debug parser. Non-parsable files will be stored (default: false)
  -S S             Look in directories <root-dir>/*/<dir> for programs
  -p P             comma-separated list of all filename suffixes that are included
  -x X             All files named in this file will be ignored in the comparison (line-separated list)
  -t T             Tunes the comparison sensitivity by adjusting the minimum token  required  to be counted as a matching section. A smaller
                        <n> increases the sensitivity but might lead to more false-positives
  -m M             Comparison similarity threshold [0-100]: All comparisons above this threshold will be saved (default: 0.0)
  -n N             The maximum number of comparisons that will be shown in the  generated report, if set to -1 all comparisons will be shown
                        (default: 30)
  -r R             Name of the directory in which the comparison results will be stored (default: result)
  -c               {normal,parallel} Comparison mode used to compare the programs (default: normal)

Java API

The new API makes it easy to integrate JPlag's plagiarism detection into external Java projects:

JPlagOptions options = new JPlagOptions(List.of("/path/to/rootDir"), List.of(), LanguageOption.JAVA);
options.setBaseCodeSubmissionName("template");

JPlag jplag = new JPlag(options);
JPlagResult result = jplag.run();

List<JPlagComparison> comparisons = result.getComparisons();

// Optional
ReportObjectFactory reportObjectFactory = new ReportObjectFactory();
reportObjectFactory.createAndSaveReport(result, "/path/to/output");

report.writeResult(result);

Contributing

We're happy to incorporate all improvements to JPlag into this codebase. Feel free to fork the project and send pull requests. Please consider our guidelines for contributions.

Contact

If you encounter bugs or other issues, please report them here. For other purposes, you can contact us at jplag@ipd.kit.edu . If you are doing research related to JPlag, we would love to know what you are doing. Feel free to contact us!

More information can be found in our Wiki!