-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
963 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,52 @@ | ||
from bs4 import BeautifulSoup | ||
import os | ||
import sys | ||
import time | ||
|
||
def log(message): | ||
timestamp = time.strftime("%Y-%m-%d %H:%M:%S") | ||
print(f"[{timestamp}] {message}") | ||
|
||
def extract_similarity_percentage(html_file): | ||
with open(html_file, 'r', encoding='utf-8') as file: | ||
soup = BeautifulSoup(file, 'html.parser') | ||
file_name_tag = soup.select_one("#textright > div > h4") | ||
if file_name_tag: | ||
percentage_text = file_name_tag.find("span", class_="text-secondary small").text.strip("()%") | ||
return int(percentage_text) | ||
else: | ||
return None | ||
try: | ||
with open(html_file, 'r', encoding='utf-8') as file: | ||
soup = BeautifulSoup(file, 'html.parser') | ||
file_name_tag = soup.select_one("#textright > div > h4") | ||
if file_name_tag: | ||
percentage_text = file_name_tag.find("span", class_="text-secondary small").text.strip("()%") | ||
return int(percentage_text) | ||
else: | ||
return None | ||
except Exception as e: | ||
log(f"Error processing file {html_file}: {e}") | ||
return None | ||
|
||
def process_html_files(directory, threshold=10): | ||
results = {} | ||
def process_html_files(directory, threshold=50): | ||
log("Processing HTML files for plagiarism results...") | ||
high_plagiarism_detected = False | ||
for filename in os.listdir(directory): | ||
if filename.endswith(".html"): | ||
file_path = os.path.join(directory, filename) | ||
percentage = extract_similarity_percentage(file_path) | ||
if percentage is not None: | ||
results[filename.replace('.html', '.js')] = percentage | ||
|
||
filtered_sorted_results = sorted( | ||
((file, percent) for file, percent in results.items() if percent >= threshold), | ||
key=lambda x: x[1], reverse=True | ||
) | ||
if percentage is not None and percentage >= threshold: | ||
log(f"High plagiarism detected - {filename.replace('.html', '.js')}: {percentage}%") | ||
high_plagiarism_detected = True | ||
|
||
with open('plagiarism_results.txt', 'w') as output_file: | ||
output_file.write("\nFiltered and Sorted Results (Above 10%):\n") | ||
for file, percent in filtered_sorted_results: | ||
output_file.write(f"{file}: {percent}%\n") | ||
return high_plagiarism_detected | ||
|
||
def main(): | ||
if len(sys.argv) != 2: | ||
log("Incorrect number of arguments provided.") | ||
print("Usage: python extract_percentages.py <saved_dir_path>") | ||
sys.exit(1) | ||
|
||
saved_dir_path = sys.argv[1] | ||
process_html_files(saved_dir_path) | ||
log(f"Received saved directory path: {saved_dir_path}") | ||
if process_html_files(saved_dir_path): | ||
log("High plagiarism percentages detected.") | ||
sys.exit(1) | ||
else: | ||
log("No high plagiarism percentages detected.") | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Sprig App Review | ||
|
||
### Triage | ||
1. Determine if there is a new app to review via ```/slacker gimme sprig games```. If there are no new Sprig games, triage is complete and you should start ```Review``` below. | ||
2. Click the github link to the Sprig game. | ||
3. Add the 'submission' tag to the PR. | ||
4. Assign the issue to yourself in github. | ||
5. Welcome the game author with an encouraging/congratulatory comment. | ||
6. Resolve the Slacker action item | ||
7. Repeat step #1 | ||
|
||
### Review | ||
1. Perform your checklist | ||
* Ensure that the author has provided their name | ||
* Ensure that the author has provided an "about" blurb for their game. | ||
* Ensure that the author has provided a brief gameplay description ("How do you play your game?") | ||
* Ensure that the title of the game is unique (see the top of ) | ||
* Ensure that the author has checked on ALL of the checkboxes in the PR template. | ||
* Ensure that name of the game file contains only alphanumeric characters (or -, or _), and does not conflict with any other game. | ||
* Ensure that the game is placed in the /games directory. | ||
* Ensure that the game screenshot is placed in the /games/img directory, and that the name of the image matches the name of the game file. | ||
* Check plagiarism script (it should comment on PRs every time code is changed). Ensure that it reports no overlaps greater than 50% with other games. | ||
* Navigate to the preview deployment of the game and ensure that the game is able to launch and displays (and is discoverable) as expected in the gallery. | ||
* Run the game. Ensure that it has >= 1 minute of novel gameplay. | ||
|
||
|
||
2. Communicate your review decision to the PR author via a code review | ||
* If you found an issue during your checklist, **Request changes** on the PR, and clearly communicate the issue or issues that the author needs to resolve before being able to land their changes. After requesting changes, add the author to the current assignees. Stop here. | ||
* If you determine that the game is ready to be landed, **Approve** the PR with a congratulatory comment. | ||
* Merge the PR to main. | ||
* Add a comment stating that if the author is a teen, they can request their Sprig device at https://sprig-order.hackclub.dev/. You can also suggest to them to share a few sentences in our #ship Slack channel. | ||
|
Oops, something went wrong.