Skip to content
Snippets Groups Projects
Commit 0acfd677 authored by robinwilliam.hundt's avatar robinwilliam.hundt
Browse files

Added local prospector pre-commit hook

also removed unused arguments in delber.py that prospector didn't like
parent cdbec165
No related branches found
No related tags found
2 merge requests!15Refactor,!14Pre commit
repos: repos:
- repo: git://github.com/guykisel/prospector-mirror - repo: local
sha: '' # Use the sha / tag you want to point at test
hooks: hooks:
- id: prospector - id: prospector
name: prospector
entry: prospector --uses django
language: system
types: [python]
\ No newline at end of file
...@@ -15,7 +15,6 @@ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'grady.settings') ...@@ -15,7 +15,6 @@ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'grady.settings')
django.setup() django.setup()
unused_variable = []
def parseme(): def parseme():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
...@@ -84,7 +83,7 @@ def parseme(): ...@@ -84,7 +83,7 @@ def parseme():
return parser.parse_args() return parser.parse_args()
def handle_passwordlist(output=sys.stdout, instance="", **kwargs): def handle_passwordlist(output=sys.stdout, instance=""):
with open('/usr/share/dict/words') as words: with open('/usr/share/dict/words') as words:
choose_from = list({word.strip().lower() choose_from = list({word.strip().lower()
for word in words if 5 < len(word) < 8}) for word in words if 5 < len(word) < 8})
...@@ -102,7 +101,7 @@ def handle_passwordlist(output=sys.stdout, instance="", **kwargs): ...@@ -102,7 +101,7 @@ def handle_passwordlist(output=sys.stdout, instance="", **kwargs):
student.user.username, password, instance]) student.user.username, password, instance])
def handle_enableusers(switch, exclude, include, **kwargs): def handle_enableusers(switch, exclude, include):
if include: if include:
for user in User.objects.filter(username__in=include): for user in User.objects.filter(username__in=include):
...@@ -114,7 +113,7 @@ def handle_enableusers(switch, exclude, include, **kwargs): ...@@ -114,7 +113,7 @@ def handle_enableusers(switch, exclude, include, **kwargs):
user.save() user.save()
def handle_replaceusernames(matno2username_dict, **kwargs): def handle_replaceusernames(matno2username_dict):
matno2username = json.JSONDecoder().decode(matno2username_dict.read()) matno2username = json.JSONDecoder().decode(matno2username_dict.read())
for student in Student.objects.all(): for student in Student.objects.all():
if student.matrikel_no in matno2username: if student.matrikel_no in matno2username:
...@@ -123,12 +122,12 @@ def handle_replaceusernames(matno2username_dict, **kwargs): ...@@ -123,12 +122,12 @@ def handle_replaceusernames(matno2username_dict, **kwargs):
student.user.save() student.user.save()
def handle_extractsubmissions(output, **kwargs): def handle_extractsubmissions():
for submission in Submission.objects.filter(feedback__isnull=False).order_by('type'): for submission in Submission.objects.filter(feedback__isnull=False).order_by('type'):
print(submission.feedback.score, repr(submission.text), file=open(str(submission.type).replace(' ', '_'), 'a')) print(submission.feedback.score, repr(submission.text), file=open(str(submission.type).replace(' ', '_'), 'a'))
def handle_importer(**kwargs): def handle_importer():
util.importer.start() util.importer.start()
def main(): def main():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment