tom-weatherhead/thaw-image-processing.ts

View on GitHub

Showing 49 of 71 total issues

Function resampleImage has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function resampleImage(
    srcImage: IThAWImage,
    dstWidth: number,
    dstHeight: number,
    mode: number
Severity: Minor
Found in src/processing/resample.ts - About 1 hr to fix

    Function convolve1D has 11 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        dstBuffer: ThAWImageBufferType,
        dstInitialOffset: number,
        numDstPixels: number,
        dstPixelStride: number,
        srcBuffer: ThAWImageBufferType,
    Severity: Major
    Found in src/util/convolve.ts - About 1 hr to fix

      Function mapImageByCoordinatesFromBuffer has 11 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          dstBuffer: ThAWImageBufferType,
          dstWidth: number,
          dstHeight: number,
          dstInitialRowOffset: number,
          dstRowStride: number,
      Severity: Major
      Found in src/util/map-coordinates.ts - About 1 hr to fix

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

        export function compositeTest(srcImage: IThAWImage): IThAWImage {
            // const dstImage = generateTestImage_RedGreenGradient(srcImage.width, srcImage.height, fnCreateImage);
        
            const red = 255;
            const green = 0;
        Severity: Minor
        Found in src/util/composite.ts - About 1 hr to fix

          Function fill has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public fill(
                  dstRow: number,
                  dstColumn: number,
                  width: number,
                  height: number,
          Severity: Minor
          Found in src/util/image.ts - About 1 hr to fix

            Function fill has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                public fill(
                    dstRow: number,
                    dstColumn: number,
                    width: number,
                    height: number,
            Severity: Minor
            Found in src/util/image.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 resample1DNearestNeighbour has 9 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                dstBuffer: ThAWImageBufferType,
                dstInitialOffset: number,
                numDstPixels: number,
                dstPixelStride: number,
                srcBuffer: ThAWImageBufferType,
            Severity: Major
            Found in src/processing/resample.ts - About 1 hr to fix

              Function resample1DBilinear has 9 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  dstBuffer: ThAWImageBufferType,
                  dstInitialOffset: number,
                  numDstPixels: number,
                  dstPixelStride: number,
                  srcBuffer: ThAWImageBufferType,
              Severity: Major
              Found in src/processing/resample.ts - About 1 hr to fix

                Function resample1DBicubic has 9 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    dstBuffer: ThAWImageBufferType,
                    dstInitialOffset: number,
                    numDstPixels: number,
                    dstPixelStride: number,
                    srcBuffer: ThAWImageBufferType,
                Severity: Major
                Found in src/processing/resample.ts - About 1 hr to fix

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

                  function resample1DBilinear(
                      dstBuffer: ThAWImageBufferType,
                      dstInitialOffset: number,
                      numDstPixels: number,
                      dstPixelStride: number,
                  Severity: Minor
                  Found in src/processing/resample.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 mapImageByCoordinatesFromBuffer has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function mapImageByCoordinatesFromBuffer(
                      dstBuffer: ThAWImageBufferType,
                      dstWidth: number,
                      dstHeight: number,
                      dstInitialRowOffset: number,
                  Severity: Minor
                  Found in src/util/map-coordinates.ts - About 1 hr to fix

                    Function constructor has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        constructor(
                            width: number,
                            height: number,
                            bytesPerPixel?: number,
                            bytesPerLine?: number,
                    Severity: Minor
                    Found in src/util/image.ts - About 1 hr to fix

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

                      async function dispatchPixelate(argv: string[]): Promise<void> {
                          let srcFilePath = defaultSrcFilePath;
                          let dstFilePath = `test/output-files/pixelate.${dstFileExtension}`;
                          let pixelWidth = 8;
                          let pixelHeight = 8;
                      Severity: Minor
                      Found in src/cli.ts - About 1 hr to fix

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

                        function resample1DNearestNeighbour(
                            dstBuffer: ThAWImageBufferType,
                            dstInitialOffset: number,
                            numDstPixels: number,
                            dstPixelStride: number,
                        Severity: Minor
                        Found in src/processing/resample.ts - About 1 hr to fix

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

                          async function dispatchGaussianBlur(argv: string[]): Promise<void> {
                              let srcFilePath = defaultSrcFilePath;
                              let dstFilePath = `test/output-files/gaussian-blur.${dstFileExtension}`;
                              // let sigma = 1.0;
                              let sigma = 4.0;
                          Severity: Minor
                          Found in src/cli.ts - About 1 hr to fix

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

                                dstImage: IThAWImage,
                                srcImage: IThAWImage,
                                matrix: IAffineTransformationMatrix,
                                dstLeft?: number,
                                dstRight?: number,
                            Severity: Major
                            Found in src/processing/affine.ts - About 50 mins to fix

                              Function dispatchRotate90DegreesClockwise has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                              async function dispatchRotate90DegreesClockwise(
                                  argv: string[]
                              ): Promise<void> {
                                  let srcFilePath = defaultSrcFilePath;
                                  let dstFilePath = `test/output-files/rotate90cw.${dstFileExtension}`;
                              Severity: Minor
                              Found in src/cli.ts - About 45 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 generateTestImage_SingleRGBAColour has 6 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  width: number,
                                  height: number,
                                  red: number,
                                  green: number,
                                  blue: number,
                              Severity: Minor
                              Found in src/util/composite.ts - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                    switch (srcImage.bytesPerPixel) {
                                                        case 4:
                                                            accumulator3 +=
                                                                srcImage.data[srcPixelOffset2 + 3];
                                                        case 3:
                                Severity: Major
                                Found in src/processing/pixelate.ts - About 45 mins to fix

                                  Function dispatchRotate180Degrees has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  async function dispatchRotate180Degrees(argv: string[]): Promise<void> {
                                      let srcFilePath = defaultSrcFilePath;
                                      let dstFilePath = `test/output-files/rotate180.${dstFileExtension}`;
                                  
                                      for (let i = 0; i < argv.length; i++) {
                                  Severity: Minor
                                  Found in src/cli.ts - About 45 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