astuanax/funmatrix

View on GitHub

Showing 6 of 17 total issues

File matrix.js has 376 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { curry, map, fold, max, min, reduce, equals, not, flatMap, identity } from 'fun.js'
import concat from './util/concat'
import empty from './util/empty'
import dot from './util/dot'
import matrixIdentity from './util/identity'
Severity: Minor
Found in src/matrix.js - About 5 hrs to fix

    Function rref has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    Matrix.prototype.rref = function () {
      let lead = 0
      const resultMatrix = this.clone()
    
      for (let r = 0; r < this.getRows(); ++r) {
    Severity: Minor
    Found in src/matrix.js - About 3 hrs 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 rref has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Matrix.prototype.rref = function () {
      let lead = 0
      const resultMatrix = this.clone()
    
      for (let r = 0; r < this.getRows(); ++r) {
    Severity: Minor
    Found in src/matrix.js - About 1 hr to fix

      Function kronecker has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      Matrix.prototype.kronecker = function (M) {
        const m = this.getRows()
        const n = this.getCols()
        const p = M.getRows()
        const q = M.getCols()
      Severity: Minor
      Found in src/matrix.js - About 1 hr 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 lu has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      Matrix.prototype.lu = function () {
        const n = this.getRows()
        const tol = 1e-6
        const A = this.clone()
        const L = this.zeros()
      Severity: Minor
      Found in src/matrix.js - About 1 hr 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 divide has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      Matrix.prototype.divide = function (M) {
        if (M instanceof Matrix) {
          if (this.getCols() !== M.getCols() || this.getRows() !== M.getRows()) {
            throw new Error('Matrices do not match, cannot create division')
          }
      Severity: Minor
      Found in src/matrix.js - About 25 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

      Severity
      Category
      Status
      Source
      Language