classrank/ClassRank

View on GitHub

Showing 20 of 20 total issues

Function post has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def post(self):
errors = dict()
success = False
form = SettingsForm(self.request.arguments)
current_user = self.decoded_username()
Severity: Minor
Found in classrank/handlers/settings.py - About 1 hr to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

def _course_in_database(course_dict, db, q):
"""Check if a course is in the database.
 
Keyword arguments:
course_dict -- a dictionary specifying the course to check
Severity: Major
Found in classrank/grouch/grouch_util.py and 1 other location - About 1 hr to fix
classrank/grouch/grouch_util.py on lines 98..108

Similar blocks of code found in 2 locations. Consider refactoring.
Open

def _school_in_database(school_dict, db, q):
"""Check if a school is in the database.
 
Keyword arguments:
school_dict -- a dictionary specifying the school to check
Severity: Major
Found in classrank/grouch/grouch_util.py and 1 other location - About 1 hr to fix
classrank/grouch/grouch_util.py on lines 111..121

Similar blocks of code found in 2 locations. Consider refactoring.
Open

@property
def pw_hash(self):
h = None
try:
h = self.password_hash.tobytes()
Severity: Major
Found in classrank/database/tables.py and 1 other location - About 1 hr to fix
classrank/database/tables.py on lines 41..48

Similar blocks of code found in 2 locations. Consider refactoring.
Open

@property
def pw_salt(self):
s = None
try:
s = self.password_salt.tobytes()
Severity: Major
Found in classrank/database/tables.py and 1 other location - About 1 hr to fix
classrank/database/tables.py on lines 32..39

Similar blocks of code found in 2 locations. Consider refactoring.
Open

course_dict = {"school_id": school_id,
"name": course['name'],
"description": course['fullname'],
"number": course['number'],
"subject": course['school']}
Severity: Major
Found in classrank/grouch/grouch_util.py and 1 other location - About 1 hr to fix
classrank/grouch/grouch_util.py on lines 48..52

Function add_to_database has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def add_to_database(grouch_output, db):
"""
Add courses from Grouch's output to a db.
 
Keyword arguments:
Severity: Minor
Found in classrank/grouch/grouch_util.py - About 1 hr to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

section_dict = {"course_id": course_id,
"semester": course['semester'],
"year": course['year'],
"name": section['section_id'],
"crn": section['crn']}
Severity: Major
Found in classrank/grouch/grouch_util.py and 1 other location - About 1 hr to fix
classrank/grouch/grouch_util.py on lines 36..40

Function createLookups has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def createLookups(self):
instanceCounter = 0
featureCounter = 0
for instance in self.dataDict:
if instance not in self.instanceLookup:
Severity: Minor
Found in classrank/filters/datawrapper.py - About 1 hr to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

school = StringField(u'school', [wtfv.required(message="Please enter a school"),
wtfv.Length(min=3, max=15, message="School must be 3-15 characters")])
Severity: Minor
Found in classrank/handlers/forms.py and 1 other location - About 45 mins to fix
classrank/handlers/forms.py on lines 32..34

Similar blocks of code found in 2 locations. Consider refactoring.
Open

username = StringField(u'username',
[wtfv.required(message="Please enter a username"),
wtfv.Length(min=3, max=25, message="Username must be 3-25 characters")])
Severity: Minor
Found in classrank/handlers/forms.py and 1 other location - About 45 mins to fix
classrank/handlers/forms.py on lines 39..40

Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def __init__(self, data=dict(), numRecommendations=1, db=None, metric="rating", school="gatech"):
Severity: Minor
Found in classrank/filters/collabfilter.py - About 35 mins to fix

    Function getRecommendation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def getRecommendation(self, instances):
    if(self.updated):
    self.sparseifyData()
    self.model = self.svd.inverse_transform(self.svd.fit_transform(self.sparsedata))
    self.updated = False
    Severity: Minor
    Found in classrank/filters/collabfilter.py - About 35 mins to fix

    Function post has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def post(self):
    errors = dict()
    form = LoginForm(self.request.arguments)
    if form.validate():
    try:
    Severity: Minor
    Found in classrank/handlers/auth.py - About 35 mins to fix

    Function post has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def post(self):
    errors = dict()
    form = RegistrationForm(self.request.arguments)
    if form.validate():
    h, s = authenticate.create_password(self.get_argument('password'))
    Severity: Minor
    Found in classrank/handlers/auth.py - About 35 mins to fix

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    rating = IntegerField(u'rating',
    [wtfv.required(message=required_field_msg),
    wtfv.NumberRange(min=0, max=5)])
    Severity: Minor
    Found in classrank/handlers/forms.py and 2 other locations - About 30 mins to fix
    classrank/handlers/forms.py on lines 52..54
    classrank/handlers/forms.py on lines 56..58

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    course = StringField(u'course',
    [wtfv.required(message=required_field_msg),
    wtfv.length(min=4, max=12)])
    Severity: Minor
    Found in classrank/handlers/forms.py and 2 other locations - About 30 mins to fix
    classrank/handlers/forms.py on lines 56..58
    classrank/handlers/forms.py on lines 66..68

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    section = StringField(u'section',
    [wtfv.required(message=required_field_msg),
    wtfv.length(min=1, max=4)])
    Severity: Minor
    Found in classrank/handlers/forms.py and 2 other locations - About 30 mins to fix
    classrank/handlers/forms.py on lines 52..54
    classrank/handlers/forms.py on lines 66..68

    Function sparseifyData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def sparseifyData(self):
    data = self.dataset.getData()
    sparsematrix = sparse.dok_matrix((len(data), len(data[0])))
    for i in range(len(data)):
    for j in range(len(data[i])):
    Severity: Minor
    Found in classrank/filters/collabfilter.py - About 25 mins to fix

    Function optionalLength has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def optionalLength(min, max, message):
    """Ensures a field is either empty, or between min-max characters"""
    def _optionalLength(form, field):
    if len(field.data) > 0:
    if len(field.data) < min or len(field.data) > max:
    Severity: Minor
    Found in classrank/handlers/forms.py - About 25 mins to fix
    Severity
    Category
    Status
    Source
    Language