Tom-Alexander/regression-js

View on GitHub

Showing 7 of 10 total issues

Function polynomial has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

  polynomial(data, options) {
    const lhs = [];
    const rhs = [];
    let a = 0;
    let b = 0;
Severity: Minor
Found in src/regression.js - About 2 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 polynomial has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  polynomial(data, options) {
    const lhs = [];
    const rhs = [];
    let a = 0;
    let b = 0;
Severity: Major
Found in src/regression.js - About 2 hrs to fix

    Function gaussianElimination has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    function gaussianElimination(input, order) {
      const matrix = input;
      const n = input.length - 1;
      const coefficients = [order];
    
    
    Severity: Minor
    Found in src/regression.js - About 2 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 gaussianElimination has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function gaussianElimination(input, order) {
      const matrix = input;
      const n = input.length - 1;
      const coefficients = [order];
    
    
    Severity: Minor
    Found in src/regression.js - About 1 hr to fix

      Function exponential has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        exponential(data, options) {
          const sum = [0, 0, 0, 0, 0, 0];
      
          for (let n = 0; n < data.length; n++) {
            if (data[n][1] !== null) {
      Severity: Minor
      Found in src/regression.js - About 1 hr to fix

        Function linear has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          linear(data, options) {
            const sum = [0, 0, 0, 0, 0];
            let len = 0;
        
            for (let n = 0; n < data.length; n++) {
        Severity: Minor
        Found in src/regression.js - About 1 hr to fix

          Function power has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            power(data, options) {
              const sum = [0, 0, 0, 0, 0];
              const len = data.length;
          
              for (let n = 0; n < len; n++) {
          Severity: Minor
          Found in src/regression.js - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language