nus-mtp/sashimi-note

View on GitHub

Showing 330 of 330 total issues

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

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                      it('should throw an error for invalid source conversion type', () => {
                        expect(() => {
                          unitConverter.get('21', 'px');
                        }).to.throw(Error);
                      });
                  Severity: Major
                  Found in sashimi-webapp/test/unit/specs/helpers/unitConverter.spec.js and 2 other locations - About 40 mins to fix
                  sashimi-webapp/test/unit/specs/helpers/unitConverter.spec.js on lines 32..36
                  sashimi-webapp/test/unit/specs/helpers/unitConverter.spec.js on lines 38..42

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 49.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                      it('should throw an error for invalid input value', () => {
                        expect(() => {
                          unitConverter.get('a1b', 'px');
                        }).to.throw(Error);
                      });
                  Severity: Major
                  Found in sashimi-webapp/test/unit/specs/helpers/unitConverter.spec.js and 2 other locations - About 40 mins to fix
                  sashimi-webapp/test/unit/specs/helpers/unitConverter.spec.js on lines 38..42
                  sashimi-webapp/test/unit/specs/helpers/unitConverter.spec.js on lines 44..48

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 49.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                        const observer = new MutationObserver((mutations) => {
                          if (mutations.length !== 0) {
                            observer.disconnect();
                            resolve('Finished drawing!');
                          }
                  Severity: Minor
                  Found in sashimi-webapp/src/logic/renderer/diagrams.js and 1 other location - About 40 mins to fix
                  sashimi-webapp/src/logic/renderer/diagrams.js on lines 64..69

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 49.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                        const observer = new MutationObserver((mutations) => {
                          if (mutations.length !== 0) {
                            observer.disconnect();
                            resolve('Finished drawing!');
                          }
                  Severity: Minor
                  Found in sashimi-webapp/src/logic/renderer/diagrams.js and 1 other location - About 40 mins to fix
                  sashimi-webapp/src/logic/renderer/diagrams.js on lines 44..49

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 49.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                      it('should throw an error for invalid target conversion type', () => {
                        expect(() => {
                          unitConverter.get('21cm', 'pk');
                        }).to.throw(Error);
                      });
                  Severity: Major
                  Found in sashimi-webapp/test/unit/specs/helpers/unitConverter.spec.js and 2 other locations - About 40 mins to fix
                  sashimi-webapp/test/unit/specs/helpers/unitConverter.spec.js on lines 32..36
                  sashimi-webapp/test/unit/specs/helpers/unitConverter.spec.js on lines 44..48

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 49.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                    folderOnly: function folderOnly(searchString) {
                      return searchDB(searchString)
                      .then(() => {
                        searchFolder.childFolderList = searchFolderList;
                        return searchFolder;
                  Severity: Minor
                  Found in sashimi-webapp/src/logic/filemanager/operations/search.js and 1 other location - About 40 mins to fix
                  sashimi-webapp/src/logic/filemanager/operations/search.js on lines 50..56

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 49.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                    fileOnly: function fileOnly(searchString) {
                      return searchDB(searchString)
                      .then(() => {
                        searchFolder.childFileList = searchFileList;
                        return searchFolder;
                  Severity: Minor
                  Found in sashimi-webapp/src/logic/filemanager/operations/search.js and 1 other location - About 40 mins to fix
                  sashimi-webapp/src/logic/filemanager/operations/search.js on lines 64..70

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 49.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  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 */ ||
                        Severity
                        Category
                        Status
                        Source
                        Language