Skip to content

0.3 release #5

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 15 commits into from
Jan 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions .github/ISSUE_TEMPLATE/----bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: "\U0001F41B Bug report"
about: Create a report to help us improve
title: ''
labels: ''
labels: 'bug'
assignees: ''

---
Expand All @@ -28,11 +28,5 @@ If applicable, add screenshots to help explain your problem.
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/---feature-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: "\U0001F680 Feature request"
about: Suggest an idea for this project
title: ''
labels: ''
labels: 'enhancement'
assignees: ''

---
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/---say-thank-you.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: "\U0001F49F Say thank you"
about: Just say thanks if you liked tutorialdb
about: Just say thanks if you liked PlagCheck
title: ''
labels: ''
assignees: ''
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,7 @@ venv.bak/

# mypy
.mypy_cache/

# custom
/submission
sample.py
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ script:
- isort --check-only --recursive plagcheck
- black --check --diff plagcheck
- flake8 plagcheck --max-line-length=88 --ignore=F401
- pylint plagcheck --disable=bad-continuation,invalid-name
- pylint plagcheck --disable=bad-continuation,invalid-name,attribute-defined-outside-init,no-self-use,too-many-locals,too-few-public-methods
after_success:
- coveralls
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Contributing to PlagCheck

:+1::tada: First off, thanks for taking the time to contribute! :tada::+1:

Make sure you follow below guidelines before contributing.

1. Raise an issue before sending any PR.
2. Make you changes to `feature` branch.
3. See if there is already an open PR for the same issue.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Bhupesh Varshney
Copyright (c) 2020 Bhupesh Varshney

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 2 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
theme: jekyll-theme-slate
show_downloads: true
18 changes: 14 additions & 4 deletions demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,25 @@
import os
import pprint
from plagcheck import plagcheck

from dotenv import load_dotenv
load_dotenv()

program_files = ["testfiles/test_python.py", "testfiles/test_python3.py"]
language = "python"
userid = os.environ["USER_ID"]

url, results = plagcheck.check(program_files, language, userid)

moss = plagcheck.check(language, userid)

moss.addFilesByWildCard("testfiles/test_python*.py")

# or moss.addFile("testfiles/test_python.py")

moss.submit()

print(url)
pprint.pprint(results)
print(moss.getHomePage())
pprint.pprint(moss.getResults())
# print frequency of each shared solution
pprint.pprint(moss.getShareScores())
# print potential distributor-culprit relationships
pprint.pprint(moss.getInsights())
17 changes: 17 additions & 0 deletions docs/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## About

plagcheck was built by :

👥 **Bhupesh Varshney**

- Twitter: [@bhupeshimself](https://twitter.com/bhupeshimself)
- DEV: [bhupesh](https://dev.to/bhupesh)
- GitHub: [Bhupesh-V](https://github.com/Bhupesh-V)

## 📝 License

This project is licensed under the MIT License. See the [LICENSE](https://github.com/codeclassroom/PlagCheck/blob/master/LICENSE) file for details.

## 👋 Contributing

Please read the [CONTRIBUTING](https://github.com/codeclassroom/PlagCheck/blob/master/CONTRIBUTING.md) guidelines for the process of submitting pull requests to us.
26 changes: 26 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Changelog


## [0.3] - Dec x, 2019

### Added
- New methods: `getHomePage()`, `submit()`, `getResults()`, `addBaseCode()`. See Documentation for usage.
- Percentage Matches of both files are returned now.

### Changed
- The plagcheck module is now more modularised. `check` is now a class.
- `__get_line_numbers()` now runs in a new thread.

### Removed
- `requests` as a dependency, network requests are now 50% faster.


## [0.2] - Nov 9, 2019
- Minor Improvements


## [0.1] - Nov 3, 2019
- Initial Release

# Releases
See releases on [PyPi](https://pypi.org/project/plagcheck/#history)
9 changes: 9 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# PlagCheck ✅

![PyPI](https://img.shields.io/pypi/v/plagcheck?color=blue)
[![Build Status](https://travis-ci.org/codeclassroom/PlagCheck.svg?branch=master)](https://travis-ci.org/codeclassroom/PlagCheck)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/plagcheck)
[![GitHub license](https://img.shields.io/github/license/codeclassroom/PlagCheck)](https://github.com/codeclassroom/CodeRunner/blob/master/LICENSE)
![PyPI - Downloads](https://img.shields.io/pypi/dm/plagcheck?color=blue)
[![GitHub issues](https://img.shields.io/github/issues/codeclassroom/PlagCheck?color=blueviolet)](https://github.com/codeclassroom/CodeRunner/issues)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-orange.svg)](http://makeapullrequest.com)
17 changes: 17 additions & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Installation

Installing plagcheck is pretty simple, just run

`pip install plagcheck`

Install a specific verison

`pip install plagcheck==0.2`

or directly from GitHub if you cannot wait to test new features

`pip install git+https://github.com/codeclassroom/PlagCheck.git`

If you have already installed it and want to update

`pip install --upgrade plagcheck`
10 changes: 4 additions & 6 deletions docs/docs.md → docs/moss.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## PlagCheck Usage Guide
## Moss
> Derived from [Reading the Results](http://moss.stanford.edu/general/format.html).

*PlagCheck* returns the following list of dictionaries:
Expand Down Expand Up @@ -35,8 +35,6 @@ It is the the percentage of the code in one file considered to match code in the

> For both measures(*lines_matched* & *percentage*), higher numbers mean more code matches.

- **url** :
The homepage link of the results for each submission to MOSS.


## [Tips](http://moss.stanford.edu/general/tips.html)
Expand All @@ -47,12 +45,12 @@ The homepage link of the results for each submission to MOSS.

- Moss can be more accurate if a base file is supplied. The -b option to Moss supplies a base file of code that should be ignored if it appears in programs; Moss never considers code that appears in a base file to match any other code. If your results include many unintended matches, then it is best to place all legitimately shared code in a base file (e.g., instructor-supplied code, common libraries, etc.) and resubmit the query to the server.

- Moss is a computer program that detects structural similarities in programs and nothing more; it has no idea why programs may be structurally similar. As noted above, there are reasons besides plagiarism that two programs may appear the same (e.g., they are both based on the same third program, such as instructor-supplied code for an assignment). Results from Moss cannot be taken as direct evidence of plagiarism---it is still necessary for someone to examine the programs and make a judgment.
- Moss detects structural similarities in programs and nothing more; it has no idea why programs may be structurally similar. As noted above, there are reasons besides plagiarism that two programs may appear the same (e.g., they are both based on the same third program, such as instructor-supplied code for an assignment). Results from Moss cannot be taken as direct evidence of plagiarism---it is still necessary for someone to examine the programs and make a judgment.

## Credits
Moss was written and is maintained by Alex Aiken, aiken@cs.stanford.edu.

The HTML interface was conceived of and designed by Guido Malpohl (s_malpoh@ira.uka.de), the author of JPlag, a plagiarism detection system for Java programs.

PlagCheck extracts information from the webpages for easier storing of results.
Contact [varshneybhupesh@gmail.com]() for more info.
PlagCheck extracts information from the webpages for easier storing & analysis of results.
Contact [varshneybhupesh@gmail.com](mailto:varshneybhupesh@gmail.com) for more info.
87 changes: 87 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Usage

plagcheck provides the following class constructors

### check(files, lang, user_id)

* **Parameters** :
- files : Program Files.
- lang : The Programming Language.
- output : Moss UserID.


**Demo**:
```python

"""Usage example"""
import os
import pprint
from plagcheck import plagcheck
from dotenv import load_dotenv
load_dotenv()

program_files = [
"testfiles/test_python.py",
"testfiles/test_python3.py",
"testfiles/test_python2.py"
]

language = "python"
userid = os.environ["USER_ID"]


cheat = plagcheck.check(program_files, language, userid)

# cheat.addBaseCode("submission/a01.py")

cheat.submit()

print(cheat.getHomePage())
pprint.pprint(cheat.getResults())

```

### 1. submit()
**Parameters** : `None` <br>
**Return Type** : `None` <br>
**Description**: Submits the program on Moss.<br>
**Demo**:
```python

c.submit()

```

### 2. getHomePage()
**Parameters** : `None` <br>
**Return Type** : `String` <br>
**Description**: Returns the Moss Result HomePage<br>
**Demo**:
```python

c.getHomePage()

```

### 3. getResults()
**Parameters** : `None` <br>
**Return Type** : `List` <br>
**Description**: Returns the scraped data from Moss Results .<br>
**Demo**:
```python

c.getResults()
"""
[
{
"file1":"filename1.py",
"file2":"filename2.py",
"percentage": 34,
"no_of_lines_matched": 3,
"lines_matched":[["2-3", "10-11"]]
},
....
]
"""

```
17 changes: 17 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
site_name: PlagCheck
site_url: https://codeclassroom.github.io/PlagCheck/
repo_url: https://github.com/codeclassroom/PlagCheck
site_author: Bhupesh Varshney
site_description: PlagCheck v0.3 Documentation
copyright: © 2019, Bhupesh Varshney
nav:
- Documentation: index.md
- Installation: installation.md
- Usage: usage.md
- Moss: moss.md
- Changelog: changelog.md
- About: about.md
theme: readthedocs
markdown_extensions:
- toc:
permalink: "#"
Loading