nus-mtp/sashimi-note

View on GitHub

Showing 117 of 330 total issues

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

DiagramsRenderer.prototype.process = function process(ele) {
  const observerConfig = { childList: true };
  // get all pre tags with class name = sequence
  const seqDiagrams = ele.querySelectorAll('pre.sequence');
  // get all pre tags with class name = flow
Severity: Minor
Found in sashimi-webapp/src/logic/renderer/diagrams.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 (mxnestingd===0 && pos.length>0 && matrix) {
            for (i=0; i<pos.length-1; i+=1) {
              let subarr;
              if (i>0) mxout += '\\\\';
              if (i===0) {
Severity: Major
Found in sashimi-webapp/src/logic/documentPackager/plugins/ASCIIMathTeXImg.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

              for (i=1; i<len-1; i+=1) {
                if (newFrag.charAt(i)===left) mxnestingd+=1;
                if (newFrag.charAt(i)===right) {
                  mxnestingd-=1;
                  if (mxnestingd===0 && newFrag.charAt(i+2)===',' && newFrag.charAt(i+3)==='{') {
    Severity: Major
    Found in sashimi-webapp/src/logic/documentPackager/plugins/ASCIIMathTeXImg.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                if (matrix) { newFrag = mxout; }
      Severity: Major
      Found in sashimi-webapp/src/logic/documentPackager/plugins/ASCIIMathTeXImg.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                } else if (ignoredAttr.indexOf(arr1[2]) === -1) {
                  if (arr1[3] !== arr1[4]) {
                    errorArray.push(line);
                  }
                }
        Severity: Major
        Found in sashimi-webapp/test/unit/specs/logic/diagramsRenderer.spec.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                if (!textExpected.has(key) && !textActual.has(key)) {
                  // If don't have, use helper function to find the contents in the respective
                  // and compare
                  if (!helper(key, exp, act)) {
                    errorArray.push(line);
          Severity: Major
          Found in sashimi-webapp/test/unit/specs/logic/diagramsRenderer.spec.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                      if (config.AMusedelimiter2) {
                        arr[i]=arr[i].replace(/AMescape2/g, config.AMdelimiter2).replace(/AMescape1/g, config.AMdelimiter1);
                      } else {
                        arr[i]=arr[i].replace(/AMescape1/g, config.AMdelimiter1);
                      }
            Severity: Major
            Found in sashimi-webapp/src/logic/documentPackager/plugins/ASCIIMathTeXImg.js - About 45 mins to fix

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

                resolveElement(targetReference, altDocument) {
                  if (typeof targetReference === 'string') {
                    const doc = altDocument || document;
                    return doc.getElementById(targetReference);
                  } else if (targetReference.window === targetReference) {
              Severity: Minor
              Found in sashimi-webapp/src/helpers/elementUtils.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 (pos !== -1) {
                        // Ignore, not an actual error
                        missedArray.splice(pos, 1);
                      } else if (arr3[1] !== 'element') {
                        errorArray.push(line);
              Severity: Major
              Found in sashimi-webapp/test/unit/specs/logic/diagramsRenderer.spec.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                          if (arr1[3].indexOf('raphael-marker-endblock33-obj') !== -1
                              && arr1[4].indexOf('raphael-marker-endblock33-obj') !== -1) {
                                // Ignore, not an actual error. Just randomly generated id value
                          } else if ((arr1[3].indexOf('arrowhead') !== -1
                              && arr1[4].indexOf('arrowhead') !== -1)) {
                Severity: Major
                Found in sashimi-webapp/test/unit/specs/logic/diagramsRenderer.spec.js - About 45 mins to fix

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

                  function AMparseMath(str) {
                   // DLMOD to remove &nbsp;, which editor adds on multiple spaces
                    str = str.replace(/(&nbsp;|\u00a0|&#160;)/g, '');
                    str = str.replace(/&gt;/g, '>');
                    str = str.replace(/&lt;/g, '<');
                  Severity: Minor
                  Found in sashimi-webapp/src/logic/documentPackager/plugins/ASCIIMathTeXImg.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 (textExpected.get(key) !== textActual.get(key)) {
                              errorArray.push(line);
                            }
                  Severity: Major
                  Found in sashimi-webapp/test/unit/specs/logic/diagramsRenderer.spec.js - About 45 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                      if ((integ && k>1) || k>2) {
                        st = str.slice(0, k-1);
                        tagst = 'mn';
                      } else {
                        k = 2;
                    Severity: Major
                    Found in sashimi-webapp/src/logic/documentPackager/plugins/ASCIIMathTeXImg.js - About 40 mins to fix

                      Consider simplifying this complex logical expression.
                      Open

                        if (state.src.charCodeAt(pos + 1) !== 61  /* = */||
                            state.src.charCodeAt(pos + 2) !== 62 /* > */ ||
                            state.src.charCodeAt(pos + 3) !== 104 /* h */ ||
                            state.src.charCodeAt(pos + 4) !== 105 /* i */ ||
                            state.src.charCodeAt(pos + 5) !== 100 /* d */ ||

                        Consider simplifying this complex logical expression.
                        Open

                          if (state.src.charCodeAt(start) !== 61 /* = */ ||
                              state.src.charCodeAt(start + 1) !== 62 /* > */ ||
                              state.src.charCodeAt(start + 2) !== 104 /* h */ ||
                              state.src.charCodeAt(start + 3) !== 105 /* i */ ||
                              state.src.charCodeAt(start + 4) !== 100 /* d */ ||

                          Function createNewFile has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          function createNewFile(organizationId, filePath, folderId, newFileId, newFileName) {
                          Severity: Minor
                          Found in sashimi-webapp/src/database/data-modifier/dataAdd.js - About 35 mins to fix

                            Function createNewFolder has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            function createNewFolder(organizationId, folderPath, currentFolderId, newFolderId, newFolderName) {
                            Severity: Minor
                            Found in sashimi-webapp/src/database/data-modifier/dataAdd.js - About 35 mins to fix

                              Function injectDataLine has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              function injectDataLine(tokens, idx, options, env, slf) {

                                Function setPrimaryKeys has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  static setPrimaryKeys(...primaryKeys) {
                                    if (isTableInitializedForCreation) {
                                      sqlCreateTableString = stringManipulator.stringConcat(sqlCreateTableString, 'PRIMARY KEY(');
                                      for (let index = 0; index < primaryKeys.length; index += 1) {
                                        if (index === primaryKeys.length - 1) {
                                Severity: Minor
                                Found in sashimi-webapp/src/database/create/tableCreator.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 setUnique has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  static setUnique(...uniqueKeys) {
                                    if (isTableInitializedForCreation) {
                                      sqlCreateTableString = stringManipulator.stringConcat(sqlCreateTableString, 'UNIQUE(');
                                      for (let index = 0; index < uniqueKeys.length; index += 1) {
                                        if (index === uniqueKeys.length - 1) {
                                Severity: Minor
                                Found in sashimi-webapp/src/database/create/tableCreator.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

                                Severity
                                Category
                                Status
                                Source
                                Language