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

Dominik Fuchß 9fc37f8ade Cleanup CollectedLogger %!s(int64=4) %!d(string=hai) anos
.github 0780fc49c5 Dependency(deps): Bump JamesIves/github-pages-deploy-action %!s(int64=4) %!d(string=hai) anos
.mvn e38e320981 Added spotless configuration. Not applied formatting yet. %!s(int64=4) %!d(string=hai) anos
jplag 560a121990 Merge remote-tracking branch 'origin/master' into feature/own-logger %!s(int64=4) %!d(string=hai) anos
jplag.cli 9fc37f8ade Cleanup CollectedLogger %!s(int64=4) %!d(string=hai) anos
jplag.frontend-testutils dd72088414 Replace Error Consumer everywhere. %!s(int64=4) %!d(string=hai) anos
jplag.frontend-utils dd72088414 Replace Error Consumer everywhere. %!s(int64=4) %!d(string=hai) anos
jplag.frontend.chars dd72088414 Replace Error Consumer everywhere. %!s(int64=4) %!d(string=hai) anos
jplag.frontend.cpp dd72088414 Replace Error Consumer everywhere. %!s(int64=4) %!d(string=hai) anos
jplag.frontend.csharp-6 dd72088414 Replace Error Consumer everywhere. %!s(int64=4) %!d(string=hai) anos
jplag.frontend.java dd72088414 Replace Error Consumer everywhere. %!s(int64=4) %!d(string=hai) anos
jplag.frontend.kotlin ef3c1b4cba Fixed build %!s(int64=4) %!d(string=hai) anos
jplag.frontend.python-3 89a0ffb304 Fixed JavaDoc %!s(int64=4) %!d(string=hai) anos
jplag.frontend.rlang c3ecab4022 Merge branch 'master' into feature/own-logger %!s(int64=4) %!d(string=hai) anos
jplag.frontend.scheme dd72088414 Replace Error Consumer everywhere. %!s(int64=4) %!d(string=hai) anos
jplag.frontend.text dd72088414 Replace Error Consumer everywhere. %!s(int64=4) %!d(string=hai) anos
report-viewer 33ecda9aea Merge pull request #487 from nestabentum/max_metric_in_web_report %!s(int64=4) %!d(string=hai) anos
.gitattributes 8cf2d8d80e Add gitattributes file. %!s(int64=4) %!d(string=hai) anos
.gitignore 69db96882a Activate flatten maven plugin %!s(int64=4) %!d(string=hai) anos
LICENSE 15959fff5c Add license %!s(int64=11) %!d(string=hai) anos
README.md 2753aa336c Fix typo; add new frontends to top level README %!s(int64=4) %!d(string=hai) anos
formatter.xml ad7184577a Adapt formatter configuration to indent statements in switch bodies. %!s(int64=4) %!d(string=hai) anos
pom.xml 7a60b4028c Dependency(deps): Bump maven-source-plugin from 3.2.0 to 3.2.1 %!s(int64=4) %!d(string=hai) anos
spotless.importorder e38e320981 Added spotless configuration. Not applied formatting yet. %!s(int64=4) %!d(string=hai) anos

README.md

JPlag logo

JPlag - Detecting Software Plagiarism

CI Build Latest Release Maven Central License Lines of code

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 Java, C#, C, C++, Python 3, Scheme, and natural language text.

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,rlang,kotlin,char,text,scheme} 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
File outputDir = new File("/path/to/output");
Report report = new Report(outputDir);

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!