Showing 75 of 2,705 total issues
Avoid deeply nested control flow statements. Open
if sem2_quota == '?' or sem2_quota == '-':
oversub_amount = sem2_num_students
else:
oversub_amount = sem2_num_students - sem2_quota
list_of_oversub_mod.append((module_code, module_name, target_ay_sem,
Function convertToDataPrerequisite
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function convertToDataPrerequisite() {
var prerequisites = [];
// For iterating through units comprising of
// [[Module-columns],[AND-column]]
var rows = document.getElementsByTagName("tbody")[0].children;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function validate_input
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def validate_input(input_data, input_types, is_future=False,
Avoid deeply nested control flow statements. Open
if not outcome:
is_successful = False
error_code_and_msg = [module, ERROR_MSG_MODULE_DOESNT_EXIST]
error_list.append(error_code_and_msg)
else:
Function validate_input
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def validate_input(input_data, input_types, is_future=False,
Avoid deeply nested control flow statements. Open
if outcome == "has_mounting":
outcome_message += "Module " + module_code + " has " +\
"mountings that refer to it. " +\
"Please remove all mountings before deleting " +\
"the module."
Avoid deeply nested control flow statements. Open
if sem1_quota == '?' or sem1_quota == '-':
oversub_amount = sem1_num_students
else:
oversub_amount = sem1_num_students - sem1_quota
list_of_oversub_mod.append((module_code, module_name, target_ay_sem,
Avoid deeply nested control flow statements. Open
if sem1_quota == '?' or sem1_quota == '-':
oversub_amount = sem1_num_students
else:
oversub_amount = sem1_num_students - sem1_quota
list_of_oversub_mod.append((module_code, module_name, target_ay_sem,
Consider simplifying this complex logical expression. Open
if ((sem2_quota != '?' and sem2_quota != '-') \
and sem2_num_students > sem2_quota) \
or ((sem2_quota == '?' or sem2_quota == '-') and sem2_num_students > 0):
if sem2_quota == '?' or sem2_quota == '-':
oversub_amount = sem2_num_students
Consider simplifying this complex logical expression. Open
if ((sem1_quota != '?' and sem1_quota != '-') \
and sem1_num_students > sem1_quota) \
or ((sem1_quota == '?' or sem1_quota == '-') and sem1_num_students > 0):
if sem1_quota == '?' or sem1_quota == '-':
oversub_amount = sem1_num_students
Consider simplifying this complex logical expression. Open
if ((sem1_quota != '?' and sem1_quota != '-') \
and sem1_num_students > sem1_quota) \
or ((sem1_quota == '?' or sem1_quota == '-') and sem1_num_students > 0):
if sem1_quota == '?' or sem1_quota == '-':
oversub_amount = sem1_num_students
Consider simplifying this complex logical expression. Open
if ((sem2_quota != '?' and sem2_quota != '-') \
and sem2_num_students > sem2_quota) \
or ((sem2_quota == '?' or sem2_quota == '-') and sem2_num_students > 0):
if sem2_quota == '?' or sem2_quota == '-':
oversub_amount = sem2_num_students
Function checkMountingChange
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function checkMountingChange(element, oldMounting, oldQuota, mountingID, quotaID) {
Function add_module
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_module(code, name, description, module_credits, status):
Function add_module
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_module(code, name, description, module_credits, status):
Function get_all_mods_taken_together
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_all_mods_taken_together(aysem=None):
'''
Retrieves the list of all modules taken together in the same semester.
Returns a table of lists. Each list contains
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_mods_no_one_take
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_mods_no_one_take(aysem):
'''
Retrieves the list of all modules which no student take together
in the specified semester.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function GET
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def GET(self):
'''
This function is called when /starModule is accessed.
'''
web.header('X-Frame-Options', 'SAMEORIGIN')
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_mod_specified_class_size
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_mod_specified_class_size(given_aysem, quota_lower, quota_higher):
'''
Retrieves the list of modules with quota/class size in the
specified AY-Semester if the quota falls within the given range
of quota_lower <= retrieved module quota <= quota_higher
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this function. Open
return False