Showing 32 of 857 total issues
Function createSubjectRow
has 220 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.planner.createSubjectRow = function(subjectName, subjectIndex) {
var $row = $('<tr class="subjectRow"></tr>');
$row.attr("data-subjectName", subjectName);
$row.attr("data-subjectIndex", subjectIndex);
File planner.js
has 504 lines of code (exceeds 250 allowed). Consider refactoring. Open
window.planner = {
currentStartDate: null,
loadState: 0,
subjectCount: 0,
saving: false,
File api_planner.js
has 488 lines of code (exceeds 250 allowed). Consider refactoring. Open
var express = require('express');
var router = express.Router();
router.get('/', global.apiCall, function(req, res, next) {
res.json({
Function context
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
var context = context || (function () {
var options = {
fadeSpeed: 100,
filter: function ($obj) {
- 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 loadWholeWeek
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
window.planner.loadWholeWeek = function(startDate, subjectIndex) {
window.api.get("planner/events/getWholeWeek/" + window.utils.formatDate_api(startDate), function(data) {
for (var announcementIndex in data.announcements) {
var announcement = data.announcements[announcementIndex];
var date = announcement.date.split("T")[0];
- 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 context
has 116 lines of code (exceeds 25 allowed). Consider refactoring. Open
var context = context || (function () {
var options = {
fadeSpeed: 100,
filter: function ($obj) {
Function addEventToList
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.hwView.addEventToList = function(ev, list) {
var tag = window.utils.getPrefix(ev.name);
var name = ev.name.split(" ");
name.splice(0, 1);
name = name.join(" ");
Function createSubjectRow
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
window.planner.createSubjectRow = function(subjectName, subjectIndex) {
var $row = $('<tr class="subjectRow"></tr>');
$row.attr("data-subjectName", subjectName);
$row.attr("data-subjectIndex", subjectIndex);
- 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 addEventToList
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
window.hwView.addEventToList = function(ev, list) {
var tag = window.utils.getPrefix(ev.name);
var name = ev.name.split(" ");
name.splice(0, 1);
name = name.join(" ");
- 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 getPrefixes
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.utils.getPrefixes = function() {
return [
{
color: "cal_hw",
words: ["HW", "Read", "Reading"],
Function graph
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.graph.graph = function(){
//get data
var days = [];
var hwResult;
File app.js
has 262 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
MyHomeworkSpace
https://myhomework.space/
https://github.com/MyHomeworkSpace/MyHomeworkSpace
Licensed under the MIT License.
Function loadWeek
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.planner.loadWeek = function(startDate) {
window.planner.loadState = 0;
window.page.showLoading();
var startDate_obj = new Date(startDate);
Function loadWholeWeek
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.planner.loadWholeWeek = function(startDate, subjectIndex) {
window.api.get("planner/events/getWholeWeek/" + window.utils.formatDate_api(startDate), function(data) {
for (var announcementIndex in data.announcements) {
var announcement = data.announcements[announcementIndex];
var date = announcement.date.split("T")[0];
Function buildMenu
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildMenu(data, id, subMenu) {
var subClass = (subMenu) ? ' dropdown-context-sub' : '',
compressed = options.compress ? ' compressed-context' : '',
$menu = $('<ul class="dropdown-menu dropdown-context' + subClass + compressed+'" id="dropdown-' + id + '"></ul>');
var i = 0, linkTarget = '';
Function loadEvents
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.hwView.loadEvents = function(callback) {
window.hwView.loadSubjects(function(data) {
window.hwView.loadStep();
window.api.get("hwView/getHw?date=" + moment().format('YYYY-MM-DD'), function(data) {
var ev = data.events;
Function Notify
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Notify(title, options) {
if (typeof title !== 'string') {
throw new Error('Notify(): first arg (title) must be a string.');
}
Function setPage
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setPage(newPage) {
$(".page.open-page").removeClass("open-page");
if ($("#" + newPage).length != 0) {
// yay, it exists. go to it
$("#" + newPage).addClass("open-page");
Function loadEvents
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
window.hwView.loadEvents = function(callback) {
window.hwView.loadSubjects(function(data) {
window.hwView.loadStep();
window.api.get("hwView/getHw?date=" + moment().format('YYYY-MM-DD'), function(data) {
var ev = data.events;
- 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 addContext
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addContext(selector, data) {
var d = new Date(),
id = d.getTime(),
$menu = buildMenu(data, id);