Showing 57 of 76 total issues
Function generateBar
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function generateBar(id) {
let weight = 0;
let barHTML = '';
for (const exam in subjects[id].evaluations[subjects[id].selectedEvaluation]
.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 findIdentifiersTree
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function findIdentifiersTree(tree, identifiers, types, id, evaluation) {
Function saveEditSubject
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function saveEditSubject() {
let newSubject = readSubjectFromPopup(editSubjectPopup);
let id = newSubject.id;
if (newSubject.shortName != subjects[id].shortName)
- 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 findIdentifiersTree
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function findIdentifiersTree(tree, identifiers, types, id, evaluation) {
switch (tree.type) {
case 'LogicalExpression':
case 'BinaryExpression':
if (
- 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 editGridFadeOrUnfade
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function editGridFadeOrUnfade(grid, element, check = ['exam', 'evaluation']) {
for (const type of check) {
if (
element.dataset[type] != undefined &&
parseInt(element.dataset[type]) < parseInt(grid.dataset[type + 's'])
- 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 completeSubject
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function completeSubject(...subjects) {
let subject = Object.assign(
{
evaluations: {},
grades: {},
- 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;
Avoid too many return
statements within this function. Open
if (!now && values[tree['left'].name] == undefined) return true;
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
return (values[tree['left'].name] || 0) < tree['lerightft'].value;
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return false;
Function updateFinalMark
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
updateFinalMark() {
for (const evaluation in this.evaluations) {
this.finalMark[evaluation] = 0;
for (const exam in this.evaluations[evaluation].exams) {
if (!this.isExamUndone(exam)) this.finalMark[evaluation] += this.grades[exam] * this.evaluations[evaluation].exams[exam].weight;
- 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 sortSubjectExams
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function sortSubjectExams(subject) {
let newSubject = { ...subject };
for (const evaluation in subject.evaluations) {
const examsSortedArray = Object.keys(subject.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 updateCardGrades
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function updateCardGrades(id) {
let card = getCard(id);
for (let div of card.getElementsByClassName('subject-bar')[0].children) {
div.classList.add('scolN');
}
- 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"