mauriciabad/GradeCalc

View on GitHub

Showing 57 of 76 total issues

Function editGridFade has 34 lines of code (exceeds 25 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}`);
Severity: Minor
Found in src/scripts/script.js - About 1 hr to fix

    Function completeSubject has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function completeSubject(...subjects) {
      let subject = Object.assign(
        {
          evaluations: {},
          grades: {},
    Severity: Minor
    Found in src/scripts/script.js - About 1 hr to fix

      Function updateNecesaryMark has 32 lines of code (exceeds 25 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;
      Severity: Minor
      Found in src/scripts/script.js - About 1 hr to fix

        Function autoUpdate has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function autoUpdate(id) {
          if (
            subjects[id].evaluation != undefined ||
            subjects[id].evaluations == undefined
          ) {
        Severity: Minor
        Found in src/scripts/script.js - About 1 hr to fix

          Function autoUpdate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          function autoUpdate(id) {
            if (
              subjects[id].evaluation != undefined ||
              subjects[id].evaluations == undefined
            ) {
          Severity: Minor
          Found in src/scripts/script.js - About 1 hr 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 shape has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var shape = function shape(element) {
            var list = [
            // Square
            function (e) {
              var size = Math.round((Math.random() + 0.5) * 10) + 'px';
          Severity: Minor
          Found in lib/confetti.js - About 1 hr to fix

            Function editGridUnfade has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            function editGridUnfade(grid, type, n) {
              for (let element of grid.querySelectorAll(`*[data-${type}='${n}'`)) {
                if (
                  (element.dataset.evaluation == undefined ||
                    parseInt(element.dataset.evaluation) <
            Severity: Minor
            Found in src/scripts/script.js - About 55 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 gradeCalcAllEqual has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              gradeCalcAllEqual(evaluation = this.selectedEvaluation) {
                const passMark = this.evaluations[evaluation].passMark || 5;
                let sumUndoneExams = 0;
                let exams = [];
                let currentFinalMark = 0;
            Severity: Minor
            Found in src/scripts/subject.js - About 55 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 toNewEval has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            function toNewEval(evaluations) {
              let newEval = {};
              for (const evaluation in evaluations) {
                for (const exam in evaluations[evaluation].exams) {
                  if (!newEval[exam]) newEval[exam] = {};
            Severity: Minor
            Found in src/scripts/script.js - About 55 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 confetti has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            window.confetti = function (root)
            
            
            
            
            
            Severity: Minor
            Found in lib/confetti.js - About 55 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 deeply nested control flow statements.
            Open

                      if (exam && examType && weight) {
                        if (!newEval[evaluation]) newEval[evaluation] = {};
                        if (!newEval[evaluation].exams) newEval[evaluation].exams = {};
                        if (!newEval[evaluation].exams[exam])
                          newEval[evaluation].exams[exam] = {};
            Severity: Major
            Found in src/scripts/script.js - About 45 mins to fix

              Function updateFinalMark has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              function updateFinalMark(id, confetti = true) {
                for (const evaluation in subjects[id].evaluations) {
                  subjects[id].finalMark[evaluation] = 0;
                  for (const exam in subjects[id].evaluations[evaluation].exams) {
                    if (!isUndone(id, exam))
              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 uploadToDB has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              function uploadToDB(db, ref, value) {
                if (!isAnonymous) {
                  let obj = {};
                  if (ref) {
                    if (
              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

              Avoid deeply nested control flow statements.
              Open

                                if (!userInfo.subjects[id]) userInfo.subjects[id] = {};
              Severity: Major
              Found in src/scripts/script.js - About 45 mins to fix

                Function displayNecesaryMark has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                function displayNecesaryMark(id) {
                  let card = getCard(id);
                  let barUndone = card.getElementsByClassName('scolN');
                  let inUndone = card.getElementsByClassName('scolN2');
                
                
                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

                Avoid deeply nested control flow statements.
                Open

                            if (
                              subjects[id].necesaryMarks[evaluation][exam] !== undefined &&
                              subjects[id].necesaryMarks[evaluation][exam] <
                                identifiers.types[type].value
                            ) {
                Severity: Major
                Found in src/scripts/script.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                    if (!subjects[id]) subjects[id] = {};
                  Severity: Major
                  Found in src/scripts/script.js - About 45 mins to fix

                    Function addSubjects has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function addSubjects() {
                      showLoader('Cargando tus asignaturas', 'dashboard');
                      document.getElementById('search-subject-input').value = '';
                    
                      for (let id in subjectsToAdd) {
                    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 toNewEvalNeeeeeeeeew has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function toNewEvalNeeeeeeeeew(evaluations) {
                      var evaluationNew = {};
                      for (let evaluation in evaluations) {
                        if (evaluations[evaluation].exams) return evaluations;
                        evaluationNew[evaluation] = {};
                    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

                    Avoid deeply nested control flow statements.
                    Open

                              if (canPass === false) {
                                subjects[id].necesaryMarks[evaluation][exam] = null;
                              } else {
                                subjects[id].necesaryMarks[evaluation][exam] = Math.max(
                                  0,
                    Severity: Major
                    Found in src/scripts/script.js - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language