Showing 75 of 2,705 total issues
Function onload
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
window.onload = function () {
var chart = new CanvasJS.Chart("quota-demand-chart",
{
animationEnabled: true,
- 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 replace_empty_quota_with_symbols
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def replace_empty_quota_with_symbols(mounting_plan):
'''
Replace all quota values with '-' (if not mounted)
or '?' (if mounted)
'''
- 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_oversub_mod
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def get_oversub_mod():
'''
Retrieves a list of modules which are oversubscribed.
Returns module code, module name, AY/Sem, quota, number students interested
i.e. has more students interested than the quota
- 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 highlightErrorFieldsPrerequisite
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function highlightErrorFieldsPrerequisite(data) {
var modulesWithErrors = data;
var rows = document.getElementsByTagName("tbody")[0].children;
var message_start = "<p><b>";
- 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_modules_with_modified_mounting
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get_modules_with_modified_mounting(self):
'''
Get all modules whose mounting has been modified in a future AY.
Return the module code, current AY-Sem, target AY-Sem, and mounting change
'''
- 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 12 (exceeds 5 allowed). Consider refactoring. Open
def GET(self, *test_data):
'''
Retrieve and display the pairs of modules that have
at least 1 student who has taken module A
prior to taking module B
- 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 populate_module_ay_sem_data
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def populate_module_ay_sem_data(self):
'''
Populate each subplan with sem 1 and sem 2 mounting values, quotas,
and numbers of students taking
'''
- 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 replaceNilQuotasWithNumbers
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function replaceNilQuotasWithNumbers(elementID){
var table = $(elementID).DataTable();
var data = table
.rows()
.data();
Function saveChangesPrerequisite
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function saveChangesPrerequisite() {
attachListenersToInputs(2);
// Submit data to backend for updating the prerequisites for module.
var modulePrerequisites = convertToDataPrerequisite();
Function saveChangesPreclusion
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function saveChangesPreclusion() {
attachListenersToInputs(1);
// Submit data to backend for updating the preclusions for module.
var modulePreclusions = convertToDataPreclusion();
Function load_student_enrollments
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def load_student_enrollments(self, module_code, ay_sem):
'''
Retrieve the number of students in each year of study,
and the number of students in each focus area,
that are taking this module
- 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 convert_list_of_prereqs_to_string
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def convert_list_of_prereqs_to_string(prereq_list):
'''
Converts given list of lists (prereq_list) into string form of prereqs.
Pre-condition: Given list must have the rows' first index sorted.
Example: [['0', 'CS1010'], ['0', 'CS1231'], ['1', 'CS2105']] will yield
- 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 POST
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def POST(self):
'''
Handles the deletion of a module
'''
# Verify that module exists
- 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 resetMountingAndQuota
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
function resetMountingAndQuota(sem1Mounting, sem2Mounting, sem1Quota, sem2Quota,
sem1MountingOption, sem2MountingOption,
sem1QuotaInput, sem2QuotaInput) {
Function POST
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def POST(self, *test_data):
'''
Handles the submission of the 'Edit General Module Info' page
'''
if test_data: # for testing purposes
- 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 deeply nested control flow statements. Open
if test_data:
return False
else:
return Outcome().POST("edit_all_mountings_and_quotas", False, None)
except ValueError: # quota is not an integer
Avoid deeply nested control flow statements. Open
if test_data:
return False
else:
return Outcome().POST("edit_all_mountings_and_quotas", False, None)
except ValueError: # quota is not an integer
Function append_missing_year_of_study
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def append_missing_year_of_study(initial_table):
'''
Helper function to append missing years of study to the
given initial table.
initial_table given in lists of (year, number of students)
- 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_prerequisite_units
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_prerequisite_units(module_code):
'''
Retrieves all the prerequisite of given module_code as a list
of lists. The list will be a list of units having the "and" relationship.
Each unit is a list of modules having the "or" relationship.
- 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 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,