michielbdejong/solid-ui

View on GitHub
src/matrix.js

Summary

Maintainability
F
3 days
Test Coverage

Function matrixForQuery has a Cognitive Complexity of 97 (exceeds 5 allowed). Consider refactoring.
Open

module.exports.matrixForQuery = function (
  dom,
  query,
  vx,
  vy,
Severity: Minor
Found in src/matrix.js - About 1 day 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 matrixForQuery has 185 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports.matrixForQuery = function (
  dom,
  query,
  vx,
  vy,
Severity: Major
Found in src/matrix.js - About 7 hrs to fix

    Function clearOldCells has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      var clearOldCells = function () {
        var row, cell
        var colsUsed = []
        var rowsUsed = []
    
    
    Severity: Minor
    Found in src/matrix.js - About 1 hr to fix

      Function columnNumberFor has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        var columnNumberFor = function (x1) {
          var xNT = x1.toNT() // xNT is a NT string
          var col = null
          // These are data columns (not headings)
          for (var i = 0; i < columns.length; i++) {
      Severity: Minor
      Found in src/matrix.js - About 1 hr to fix

        Function rowFor has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          var rowFor = function (y1) {
            var y = y1.toNT()
            if (rows[y]) return rows[y]
            var tr = dom.createElement('tr')
            var header = tr.appendChild(dom.createElement('td'))
        Severity: Minor
        Found in src/matrix.js - About 1 hr to fix

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

            dom,
            query,
            vx,
            vy,
            vvalue,
          Severity: Major
          Found in src/matrix.js - About 50 mins to fix

            Consider simplifying this complex logical expression.
            Open

                  if (
                    (y > ele.dataValueNT && options && options.yDecreasing) ||
                    (y < ele.dataValueNT && !(options && options.yDecreasing))
                  ) {
                    return matrix.insertBefore(tr, ele) // return the tr
            Severity: Major
            Found in src/matrix.js - About 40 mins to fix

              There are no issues that match your filters.

              Category
              Status