Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

State-of-the-Art Source Code Plagiarism & Collusion Detection. Check for plagiarism in a set of programs.

License

NotificationsYou must be signed in to change notification settings

jplag/JPlag

Repository files navigation

JPlag logo

JPlag - Detecting Source Code Plagiarism

CI BuildLatest ReleaseMaven CentralLicenseGitHub commit activitySonarCloud CoverageJava Version

JPlag finds pairwise similarities among a set of multiple programs. It can reliably detect software plagiarism and collusion in software development, even when obfuscated. All similarities are calculated locally; no source code or plagiarism results are ever uploaded online. JPlag supports a large number of programming and modeling languages.

Supported Languages

All supported languages and their supported versions are listed below.

LanguageVersionCLI Argument Namestateparser
Java21javamatureJavaC
C11clegacyJavaCC
C++14cppbetaANTLR 4
C#6csharpmatureANTLR 4
Python3.6python3betaANTLR 4
JavaScriptES6javascriptbetaANTLR 4
TypeScript~5typescriptbetaANTLR 4
Go1.17golangbetaANTLR 4
Kotlin1.3kotlinbetaANTLR 4
R3.5.0rlangbetaANTLR 4
Rust1.60.0rustbetaANTLR 4
Swift5.4swiftbetaANTLR 4
Scala2.13.8scalabetaScalameta
LLVM IR15llvmirbetaANTLR 4
Scheme?schemelegacyJavaCC
EMF Metamodel2.25.0emfbetaEMF
EMF Model2.25.0emf-modelalphaEMF
SCXML1.0scxmlalphaXML
Text (naive, use with caution)-textlegacyCoreNLP

Download and Installation

You need Java SE 21 to run or build JPlag.

Downloading a release

Via Maven

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

<dependency>  <groupId>de.jplag</groupId>  <artifactId>jplag</artifactId>  <version><!--desired version--></version></dependency>

Building from sources

  1. Download or clone the code from this repository.
  2. Runmvn clean package from the root of the repository to compile and build all submodules.Runmvn clean package assembly:single instead if you need the full jar which includes all dependencies.Runmvn -P with-report-viewer clean package assembly:single to build the full jar with the report viewer. In this case, you'll needNode.js installed.
  3. You will find the generated JARs in the subdirectorycli/target.

Usage

JPlag can either be used via the CLI or directly via its Java API. For more information, see theusage information in the wiki. If you are using the CLI, the report viewer UI will launch automatically. No data will leave your computer!

CLI

Note that thelegacy CLI is varying slightly.The language can either be set with the -l parameter or as a subcommand (jplag [jplag options] -l <language name> [language options]). A subcommand takes priority over the -l option.Language-specific arguments can be set when using the subcommand. A list of language-specific options can be obtained by requesting the help page of a subcommand (e.g.,jplag java —h).

Parameter descriptions:       [root-dirs[,root-dirs...]...]                        Root-directory with submissions to check for                          plagiarism. If mode is set to VIEW, this parameter                          can be used to specify a report file to open. In that                          case only a single file may be specified.      -bc, --bc, --base-code=<baseCode>                        Path to the base code directory (common framework used                          in all submissions).      -l, --language=<language>                        Select the language of the submissions (default: java).                          See subcommands below.      -M, --mode=<{RUN, VIEW, RUN_AND_VIEW, AUTO}>                        The mode of JPlag. One of: RUN, VIEW, RUN_AND_VIEW,                          AUTO (default: null). If VIEW is chosen, you can                          optionally specify a path to an existing report.      -n, --shown-comparisons=<shownComparisons>                        The maximum number of comparisons that will be shown in                          the generated report, if set to -1 all comparisons                          will be shown (default: 2500)      -new, --new=<newDirectories>[,<newDirectories>...]                        Root-directories with submissions to check for                          plagiarism (same as root).      --normalize       Activate the normalization of tokens. Supported for                          languages: Java, C++.      -old, --old=<oldDirectories>[,<oldDirectories>...]                        Root-directories with prior submissions to compare                          against.      -r, --result-file=<resultFile>                        Name of the file in which the comparison results will                          be stored (default: results). Missing .zip endings                          will be automatically added.      -t, --min-tokens=<minTokenMatch>                        Tunes the comparison sensitivity by adjusting the                          minimum token required to be counted as a matching                          section. A smaller value increases the sensitivity                          but might lead to more false-positives.Advanced      --csv-export      Export pairwise similarity values as a CSV file.      -d, --debug           Store on-parsable files in error folder.      --log-level=<{ERROR, WARN, INFO, DEBUG, TRACE}>                        Set the log level for the cli.      -m, --similarity-threshold=<similarityThreshold>                        Comparison similarity threshold [0.0-1.0]: All                          comparisons above this threshold will be saved                          (default: 0.0).      --overwrite       Existing result files will be overwritten.      -p, --suffixes=<suffixes>[,<suffixes>...]                        comma-separated list of all filename suffixes that are                          included.      -P, --port=<port>     The port used for the internal report viewer (default:                          1996).      -s, --subdirectory=<subdirectory>                        Look in directories <root-dir>/*/<dir> for programs.      -x, --exclusion-file=<exclusionFileName>                        All files named in this file will be ignored in the                          comparison (line-separated list).Clustering      --cluster-alg, --cluster-algorithm=<{AGGLOMERATIVE, SPECTRAL}>                        Specifies the clustering algorithm. Available                          algorithms: agglomerative, spectral (default:                          spectral).      --cluster-metric=<{AVG, MIN, MAX, INTERSECTION}>                        The similarity metric used for clustering. Available                          metrics: average similarity, minimum similarity,                          maximal similarity, matched tokens (default: average                          similarity).      --cluster-skip    Skips the cluster calculation.Subsequence Match Merging      --gap-size=<maximumGapSize>                        Maximal gap between neighboring matches to be merged                          (between 1 and minTokenMatch, default: 6).      --match-merging   Enables merging of neighboring matches to counteract                          obfuscation attempts.      --neighbor-length=<minimumNeighborLength>                        Minimal length of neighboring matches to be merged                          (between 1 and minTokenMatch, default: 2).      --required-merges=<minimumRequiredMerges>                        Minimal required merges for the merging to be applied                          (between 1 and 50, default: 6).Languages:  c  cpp  csharp  emf  emf-model  go  java  javascript  kotlin  llvmir  multi  python3  rlang  rust  scheme  scxml  swift  text  typescript

Java API

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

Languagelanguage =newJavaLanguage();Set<File>submissionDirectories =Set.of(newFile("/path/to/rootDir"));FilebaseCode =newFile("/path/to/baseCode");JPlagOptionsoptions =newJPlagOptions(language,submissionDirectories,Set.of()).withBaseCodeSubmissionDirectory(baseCode);try {JPlagResultresult =JPlag.run(options);// OptionalReportObjectFactoryreportObjectFactory =newReportObjectFactory(newFile("/path/to/output"));reportObjectFactory.createAndSaveReport(result);}catch (ExitExceptione) {// error handling here}catch (FileNotFoundExceptione) {// handle IO exception here}

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 ourguidelines for contributions.

Contact

If you encounter bugs or other issues, please report themhere.For other purposes, you can contact us atjplag@ipd.kit.edu.We would love to hear about your research related to JPlag. Feel free to contact us!

More information can be found in ourWiki!


[8]ページ先頭

©2009-2025 Movatter.jp