qlik-oss/sn-scatter-plot

View on GitHub
src/utils/text-helper.js

Summary

Maintainability
B
6 hrs
Test Coverage
A
100%

File text-helper.js has 264 lines of code (exceeds 250 allowed). Consider refactoring.
Open

let dummyContext;

function setDummyContext() {
  dummyContext = dummyContext || document.createElement('canvas').getContext('2d');
}
Severity: Minor
Found in src/utils/text-helper.js - About 2 hrs to fix

    Consider simplifying this complex logical expression.
    Open

        if (Array.isArray(maxNumLines)) {
          maxNumLines.forEach((v) => {
            totalMaxNumLines += Number.isNaN(v) || v <= 0 || !v ? 0 : v;
          });
    
    
    Severity: Major
    Found in src/utils/text-helper.js - About 1 hr to fix

      Function tokenize has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        tokenize(text, font, ellipsis, maxNumLines, maxWidth, maxHeight, lineHeightMultiplicator = 1) {
      Severity: Major
      Found in src/utils/text-helper.js - About 50 mins to fix

        Avoid deeply nested control flow statements.
        Open

                    if (
                      textHelper.measureTextWidth(`${remainder} ${cLines[i + 1]}`) > width &&
                      result.length + cLines.length - i <= maxNumLines
                    ) {
                      // If adding to the next line will force that to break as well and we are not close to the max limit, then create a new line inbetween instead
        Severity: Major
        Found in src/utils/text-helper.js - About 45 mins to fix

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

            wrapText(text, maxWidth, font, maxNumLines, ellipsis) {
          Severity: Minor
          Found in src/utils/text-helper.js - About 35 mins to fix

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

              wordWrap(lines, width, font, maxNumLines, ellipsis) {
            Severity: Minor
            Found in src/utils/text-helper.js - About 35 mins to fix

              There are no issues that match your filters.

              Category
              Status