obartra/ssim

View on GitHub

Showing 14 of 32 total issues

Function fastPadding has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

function fastPadding(
  A: Matrix,
  [padHeight, padWidth]: [number, number]
): Matrix {
  const width = A.width + padWidth * 2
Severity: Minor
Found in src/matlab/padarray.ts - 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 fastPadding has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function fastPadding(
  A: Matrix,
  [padHeight, padWidth]: [number, number]
): Matrix {
  const width = A.width + padWidth * 2
Severity: Minor
Found in src/matlab/padarray.ts - About 1 hr to fix

    Function mxConv2 has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    function mxConv2(
      { data: ref, width: refWidth, height: refHeight }: Matrix,
      b: Matrix,
      shape: Shape = 'full'
    ): Matrix {
    Severity: Minor
    Found in src/matlab/conv2.ts - 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 weberSsim has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function weberSsim(
      pixels1: ImageMatrix,
      pixels2: ImageMatrix,
      options: Options
    ): MSSIMMatrix {
    Severity: Minor
    Found in src/weberSsim.ts - About 1 hr to fix

      Function originalSsim has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function originalSsim(
        pixels1: Matrix,
        pixels2: Matrix,
        options: Options
      ): Matrix {
      Severity: Minor
      Found in src/originalSsim.ts - About 1 hr to fix

        Function genSSIM has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          μ12: Matrix,
          σ12: Matrix,
          μ1Sq: Matrix,
          μ2Sq: Matrix,
          σ1Sq: Matrix,
        Severity: Major
        Found in src/ssim.ts - About 1 hr to fix

          Function genUQI has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            μ12: Matrix,
            σ12: Matrix,
            μ1Sq: Matrix,
            μ2Sq: Matrix,
            σ1Sq: Matrix,
          Severity: Minor
          Found in src/ssim.ts - About 45 mins to fix

            Function reshape has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              c: Matrix,
              shape: Shape,
              ma: number,
              mb: number,
              na: number,
            Severity: Minor
            Found in src/matlab/conv2.ts - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                        for (let j = 0; j < refWidth; j++) {
                          data[(i + r1) * cWidth + j + c1] += ref[i * refWidth + j] * br1c1
                        }
              Severity: Major
              Found in src/matlab/conv2.ts - About 45 mins to fix

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

                  { data: ref, width: refWidth }: Matrix,
                  x: number,
                  height: number,
                  y: number,
                  width: number
                Severity: Minor
                Found in src/matlab/sub.ts - About 35 mins to fix

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

                    pixels1: ImageMatrix,
                    pixels2: ImageMatrix,
                    sums1: any,
                    sums2: any,
                    windowSize: number
                  Severity: Minor
                  Found in src/weberSsim.ts - About 35 mins to fix

                    Function validateOptions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function validateOptions(options: Options) {
                      Object.keys(options).forEach((option) => {
                        if (!(option in defaults)) {
                          throw new Error(`"${option}" is not a valid option`)
                        }
                    Severity: Minor
                    Found in src/index.ts - About 35 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

                    Function windowMatrix has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export function windowMatrix(
                      sumMatrix: any,
                      windowSize: number,
                      divisor: number
                    ) {
                    Severity: Minor
                    Found in src/weberSsim.ts - About 35 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

                    Function padMatrix has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function padMatrix(
                      A: Matrix,
                      frows: number,
                      fcols: number,
                      pad: PaddingValue
                    Severity: Minor
                    Found in src/matlab/imfilter.ts - About 35 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