mauriciabad/GradeCalc

View on GitHub

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) {
Severity: Minor
Found in src/scripts/script.js - About 45 mins to fix

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) {
Severity: Minor
Found in src/scripts/script.js - About 35 mins to fix

    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'])
    Severity: Minor
    Found in src/scripts/script.js - About 35 mins to fix

    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 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)
    Severity: Minor
    Found in src/scripts/script.js - About 35 mins to fix

    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: {},
    Severity: Minor
    Found in src/scripts/script.js - About 35 mins to fix

    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 (
    Severity: Minor
    Found in src/scripts/script.js - About 35 mins to fix

    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;
    Severity: Major
    Found in src/scripts/script.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  if (!now && values[tree['left'].name] == undefined) return true;
      Severity: Major
      Found in src/scripts/script.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return false;
        Severity: Major
        Found in src/scripts/script.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return false;
          Severity: Major
          Found in src/scripts/script.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

              return true;
            Severity: Major
            Found in src/scripts/script.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                            return (values[tree['left'].name] || 0) < tree['lerightft'].value;
              Severity: Major
              Found in src/scripts/script.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return false;
                Severity: Major
                Found in src/scripts/script.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return false;
                  Severity: Major
                  Found in src/scripts/script.js - About 30 mins to fix

                    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;
                    Severity: Minor
                    Found in src/scripts/subject.js - About 25 mins to fix

                    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)
                    Severity: Minor
                    Found in src/scripts/script.js - About 25 mins to fix

                    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');
                      }
                    Severity: Minor
                    Found in src/scripts/script.js - About 25 mins to fix

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language