Showing 14 of 44 total issues
File timetable.js
has 640 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* This file contains the events and functions applied to
* the timetable
*/
Function initializeTimetable
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
window.initializeTimetable = () => {
var timetable;
$('#timetable tr').slice(2).hide();
$('#timetable tr td:not(:first-child)').remove();
- 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 initializeTimetable
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.initializeTimetable = () => {
var timetable;
$('#timetable tr').slice(2).hide();
$('#timetable tr td:not(:first-child)').remove();
Function checkSlotClash
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
function checkSlotClash() {
$('#timetable tr td').removeClass('clash');
$('#course-list tr').removeClass('table-danger');
const $theoryHours = $('#theory td:not(.lunch)');
Function addCourseToCourseList
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
window.addCourseToCourseList = (courseData) => {
var $courseListItem = $(
`<tr
data-course="course${courseData.courseId}"
data-is-project="${courseData.isProject}"
- 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 initializeQuickVisualization
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initializeQuickVisualization() {
/*
Click event for the quick visualization buttons
*/
$('.quick-buttons *[class*="-tile"]').on('click', function () {
Function removeTouchHoverCSSRule
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export function removeTouchHoverCSSRule() {
if ('createTouch' in document) {
try {
var ignore = /:hover/;
- 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 addCourseToCourseList
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.addCourseToCourseList = (courseData) => {
var $courseListItem = $(
`<tr
data-course="course${courseData.courseId}"
data-is-project="${courseData.isProject}"
Function addSlotButtons
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.addSlotButtons = (courseCode) => {
$('#slot-buttons').html('');
resetFilters();
var theorySlotGroup = [];
Function addTableToPicker
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addTableToPicker(tableId, tableName) {
$('#tt-picker-dropdown').append(
`<li>
<table class="dropdown-item">
<td class="tt-picker-label">
Function removeCourseFromTimetable
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
window.removeCourseFromTimetable = (course) => {
$(`#timetable tr td div[data-course="${course}"]`)
.parent()
.each(function () {
if ($(this).children().length != 1) {
- 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 appendHeader
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function appendHeader($layout, width) {
const $header = $('<div></div>')
.css({
width: width,
'margin-bottom': '1rem',
Function removeCourseFromTimetable
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.removeCourseFromTimetable = (course) => {
$(`#timetable tr td div[data-course="${course}"]`)
.parent()
.each(function () {
if ($(this).children().length != 1) {
Avoid deeply nested control flow statements. Open
while (index >= $quickButtons.find('tr').length) {
$quickButtons.find('table').append('<tr></tr>');
}