nus-mtp/sashimi-note

View on GitHub
sashimi-webapp/test/unit/specs/logic/diagramsRenderer.spec.js

Summary

Maintainability
F
3 days
Test Coverage

Function regexHelper has 83 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function regexHelper(diff, exp, act) {
  const ignoredAttr = ['id', 'marker-end', 'x1', 'x2', 'x', 'y1', 'y2', 'y', 'width',
    'height', 'd', 'dy', 'r', 'style', 'viewBox', 'transform', 'points'];
  const missedArray = [];

Severity: Major
Found in sashimi-webapp/test/unit/specs/logic/diagramsRenderer.spec.js - About 3 hrs to fix

    File diagramsRenderer.spec.js has 292 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import domCompare from 'dom-compare';
    import DiagramsRenderer from 'src/logic/renderer/diagrams';
    import documentPackager from 'src/logic/documentPackager';
    import diagramsInput from './reference/diagrams/diagramsInput.txt';
    import diagramsRenderedOutput from './reference/diagrams/diagramsRenderedOutput.txt';
    Severity: Minor
    Found in sashimi-webapp/test/unit/specs/logic/diagramsRenderer.spec.js - About 3 hrs 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 (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

              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 2 locations. Consider refactoring.
                Open

                    it('should handle drawing of flow charts', (done) => {
                      // Clears Maps
                      textActual.clear();
                      textExpected.clear();
                      // Retrieve HTML string from getHtmlData
                sashimi-webapp/test/unit/specs/logic/diagramsRenderer.spec.js on lines 386..409

                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 195.

                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

                    it('should handle drawing of mermaid diagrams', (done) => {
                      // Clears Maps
                      textActual.clear();
                      textExpected.clear();
                      // Retrieve HTML string from getHtmlData
                sashimi-webapp/test/unit/specs/logic/diagramsRenderer.spec.js on lines 336..359

                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 195.

                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

                  for (let i = 0; i < expArr.length; i+=1) {
                    expStr.concat(`${expArr[i].innerText} `);
                  }
                sashimi-webapp/test/unit/specs/logic/diagramsRenderer.spec.js on lines 66..68

                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 57.

                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

                  for (let i = 0; i < actArr.length; i+=1) {
                    actStr.concat(`${actArr[i].innerText} `);
                  }
                sashimi-webapp/test/unit/specs/logic/diagramsRenderer.spec.js on lines 63..65

                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 57.

                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

                There are no issues that match your filters.

                Category
                Status