Showing 57 of 76 total issues
File script.js
has 2062 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
/* ------------------------------ START UP ------------------------------ */
var dashboard = document.getElementById('dashboard');
var editSubjectPopup = document.getElementById('edit-popup-content');
var viewSubjectPopup = document.getElementById('view-popup-content');
Function generateEditSubjectUIHTML
has 169 lines of code (exceeds 25 allowed). Consider refactoring. Open
function generateEditSubjectUIHTML(id, subject, popup) {
let exams = toNewEval(subject.evaluations);
let evaluations = Object.keys(subject.evaluations);
let grid = '';
let newEvals = '';
Function readSubjectFromPopup
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
function readSubjectFromPopup(popup) {
let id = popup.querySelector('input[name="id"]').value;
let newEval = {};
let grid = popup.querySelector('.edit-popup-grid');
- 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 editUIUpdateGrid
has 140 lines of code (exceeds 25 allowed). Consider refactoring. Open
function editUIUpdateGrid(grid, e, popup) {
const input = e.target;
const elem = input.parentNode == grid ? input : input.parentNode;
const conditionsElem = grid.parentNode.lastElementChild;
let conditions = '';
Function gradeCalcAllEqual
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
function gradeCalcAllEqual(id, evaluation) {
let sumUndoneExams = 0;
let exams = [];
let expectedMark = 0;
for (const exam in subjects[id].evaluations[evaluation].exams) {
- 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 evaluationTree
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
function evaluationTree(tree, values, now) {
switch (tree.type) {
case 'LogicalExpression':
switch (tree.operator) {
case '&&':
- 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 getAndDisplayUserSubjects
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getAndDisplayUserSubjects() {
if (isAnonymous) {
console.warn('To get user info you need to sign in');
showToast(
'Para guardar tus notas en la nube',
Function updateNecesaryMark
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
function updateNecesaryMark(id) {
let evaluation = subjects[id].selectedEvaluation;
let identifiers = getConditionIdentifiers(id, evaluation);
for (const exam in subjects[id].necesaryMarks[evaluation]) {
subjects[id].necesaryMarks[evaluation][exam] = undefined;
- 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 editUIUpdateGrid
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
function editUIUpdateGrid(grid, e, popup) {
const input = e.target;
const elem = input.parentNode == grid ? input : input.parentNode;
const conditionsElem = grid.parentNode.lastElementChild;
let conditions = '';
- 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 generateEditSubjectUIHTML
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
function generateEditSubjectUIHTML(id, subject, popup) {
let exams = toNewEval(subject.evaluations);
let evaluations = Object.keys(subject.evaluations);
let grid = '';
let newEvals = '';
- 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 isValidSubjectFromPopup
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function isValidSubjectFromPopup(subject) {
// console.log(subject);
// console.log(isEmpty(subject));
let wrongValue = '';
- 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 evaluationTree
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
function evaluationTree(tree, values, now) {
switch (tree.type) {
case 'LogicalExpression':
switch (tree.operator) {
case '&&':
Function readSubjectFromPopup
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
function readSubjectFromPopup(popup) {
let id = popup.querySelector('input[name="id"]').value;
let newEval = {};
let grid = popup.querySelector('.edit-popup-grid');
Function isValidSubjectFromPopup
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
function isValidSubjectFromPopup(subject) {
// console.log(subject);
// console.log(isEmpty(subject));
let wrongValue = '';
Function gradeCalcAllEqual
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function gradeCalcAllEqual(id, evaluation) {
let sumUndoneExams = 0;
let exams = [];
let expectedMark = 0;
for (const exam in subjects[id].evaluations[evaluation].exams) {
Function generateInputs
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function generateInputs(id) {
let html = '';
let types = {};
for (const examName in subjects[id].evaluations[
Function generateInputs
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function generateInputs(id) {
let html = '';
let types = {};
for (const examName in subjects[id].evaluations[
- 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 generateBar
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function generateBar(id) {
let weight = 0;
let barHTML = '';
for (const exam in subjects[id].evaluations[subjects[id].selectedEvaluation]
.exams) {
Function editGridFade
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function editGridFade(grid, type, n) {
let removed = false;
for (let element of grid.querySelectorAll(`*[data-${type}]`)) {
if (parseInt(element.dataset[type]) == n) {
element.classList.add(`edit-new-${type}`);
- 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 displayNecesaryMark
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function displayNecesaryMark(id) {
let card = getCard(id);
let barUndone = card.getElementsByClassName('scolN');
let inUndone = card.getElementsByClassName('scolN2');