Programming Code Plagiarism Plugin

From MoodleDocs


This plugin integrates two well-known source code plagiarism detectors MOSS and JPlag into Moodle to compare the similarities of programming assignments of students within the same course. By integrating these detectors seamlessly into Moodle, it eliminates the overhead of manually preparing the assignments to feed into these detectors, present the reports with an interactive interface and, more importantly, serve as an educational tool to provide feedback to students and raise their awareness of plagiarism.

Please note: - It only scans for similarities between students in the same course (as MOSS and JPlag do) - It is for academic use only (see the term and condition of MOSS and JPlag)

Registration for JPlag and MOSS account

This plugin relies on JPlag and MOSS engine in the background to carry out the scanning for similarity.

Create a JPlag account: There is no support for the server version of JPlag anymore - if you have an account, you can use it. Otherwise you will have to download JPlag from GitHub ( and run it locally.

Create MOSS account: email to a message containing 2 lines

 mail username@domain

in which username@domain is your email address. You will receive reply containing a perl script to use MOSS. Visit for more information.

Adding code to server

Extract the zip file containing the code of the plugin and put it to the directory <moodle_dir>/plagiarism/. Leave the directory name, which is "programming", intact. A correct directory structure should look like the following:


Server configuration

The plugin should run on any platform that Moodle runs, and the installation process should happen smoothly. Please ensure the followings (which are all the conditions of a proper Moodle installation):

+ Make sure that the process on which Apache run have sufficient right to read all the files in the new directory (which is <moodle_dir>/plagiarism/programming/*).

+ Make sure the cron service is configured properly to call the script <moodle_dir>/admin/cron.php periodically. A guide to install the cron service could be found on Moodle website This cron service is necessary for scheduling the submission of all students' code to JPlag and MOSS service.

Plugin installation

Installation is similar to any other standard Moodle plugin. Login to Moodle as an administrator and visit the notification page (go to Site Administration → Notification or visit the url http://<moodle_url>/admin/index.php), the plugin installation page of Moodle will appear with the programming plagiarism plugin in the list. Click upgrade button to install the plugin to Moodle. The installation should be successful.

Plugin configuration

First, plagiarism plugins should be enabled on your Moodle (see Managing plagiarism prevention)

Go to Site Administrator → Plugin → Plagiarism Prevention → Programming Assignment to configure the plugin for the whole Moodle installation. The following options are provided: Use source code plagiarism detection checkbox: enable or disable the plugin for all the assignments Enable this plugin for the whole Moodle: every assignment created will see the configuration block for code similarity matching. Enable this plugin at the course level: just assignments of the specified courses will see the configuration block for code similarity matching. Once this option is selected, a dialog box will appear allowing users to select which course to enable. JPlag Username: user name of the JPlag account (registered at the beginning) JPlag Password: password of the JPlag account MOSS Userid: the userid emailed to you when registered for MOSS. If you find it difficult to locate the userid in that email. Just copy the entire email to the textbox below (you need either find the user id or copy the email. You don't need to do both)

File:plugin config.png

Assignment configuration

Once the plugin is enabled for the whole Moodle or for the course (see the previous section), users will see the following block when creating or editing an assignment, near the bottom of the assignment configuration page: This block offers the following parameters: Code similarity checking: enable the plugin for the current assignment if checked. Programming language: select the programming language for this assignment. Currently, just one programming language is supported for each assignment. Submit date: the date when all the submission is scanned for similarity. Multiple dates could be specified. To allow "draft submission", you can select some dates before the due date so that students can see the report and modify their assignments before it due. If multiple scannings are performed, you can see the entire history in the report. Alternatively, you can manually trigger the scanning at anytime you want (see Manual scanning section) Detection tools: select which detection tool to use. At least one tool must be selected. Publish similarity report: if checked, students could see the similarity report comparing their work with others (see part d below). Display notification: if checked, students are notified that this assignment will be checked for plagiarism in the assignment page. Notification text: this box is enabled when display notification is checked, and enables specification of the message to students

If "Publish similarity report" and "Display notification" are not checked, student will not aware of the similarity checking behind.

File:assignment config.png

Manual scanning

Other than scheduling a date to scan the assignment, you can manually trigger the scanning process by clicking the button at anytime on the assignment page. This allows for flexibility in case of late submissions or some unanticipated changes. Different scheduled and manual scannings will be saved and you can look back the history in the report.

File:manual scan.png

Viewing the report

In the assignment page, teachers can click on “Rescan” button to trigger the scanning at anytime after the assignment is created (even before its due date).

After the scanning process finishes, a link to the report page will appears. Click on the link to see the report: The report consists of a graph of similarity rate distribution of every pairs, and a table listing similar pairs in descending order. Several options are offered to view the report, including: Similarity filter: display only the pairs having similarities above the specified value Similarity type: choosing between average similarity and maximum similarity. Since the length of each student's code may vary a lot, the percentage of the similar portions between the two codes differs. Average similarity takes the average rate between the two as the rate of the pair and maximum similarity takes the maximum rate between the two as the rate of the pair. For example, if student A has 50% of code similar to student B and student B has 30% of code similar to student A (because B's code is longer than A's code), average similarity rate is 40% and maximum similarity rate is 50%. Detector: choose between MOSS and JPlag (if the scanning is run with both detectors) Display Grouping students: a table with each row containing similarities between students having with one student in the first cell Ordered table: a simple list of pairs in descending similarity rate History: if scanning is performed multiple times, you can look back the results of previous scans.

File:report view.png

Clicking on the bars of the chart will also show the pairs of which similarity rate belong to that range. The box listed scanning in reverse chronological order. Clicking on the percentage value will bring the comparison view, which show the similarities of the students' work. Clicking on the arrows at the bottom right of the cells will show the chart of similarity history of that pair (and then click on the bars of that chart will show the comparison between the pair at the time of scanning)

File:history view.png

Comparison between two students' work

Comparison view enables to compare the similarity of a pair of students as well as similar portions of one students with all the others. Lecturers can mark a pair if they think there are too much similarities to each other.

File:comparison view.png

By ticking the checkbox "Show similarity between <someone> with other students", lecturers can also see the similar parts of that students with everyone in the class (not just pair to pair)

File:comparision others.png