src/matrix.js
Function matrixForQuery
has a Cognitive Complexity of 97 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports.matrixForQuery = function (
dom,
query,
vx,
vy,
- Read upRead up
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
Open
module.exports.matrixForQuery = function (
dom,
query,
vx,
vy,
Function clearOldCells
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var clearOldCells = function () {
var row, cell
var colsUsed = []
var rowsUsed = []
Function columnNumberFor
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
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++) {
Function rowFor
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
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'))
Function matrixForQuery
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
dom,
query,
vx,
vy,
vvalue,
Consider simplifying this complex logical expression. Open
Open
if (
(y > ele.dataValueNT && options && options.yDecreasing) ||
(y < ele.dataValueNT && !(options && options.yDecreasing))
) {
return matrix.insertBefore(tr, ele) // return the tr