tom-weatherhead/thaw-image-processing.ts

View on GitHub

Showing 49 of 71 total issues

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

async function dispatchCompositeTest(argv: string[]): Promise<void> {
    let srcFilePath = defaultSrcFilePath;
    let dstFilePath = `test/output-files/composite-test.${dstFileExtension}`;

    if (!fs.existsSync(srcFilePath)) {
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 createAffineTransformationMatrix has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    a: number,
    b: number,
    c: number,
    d: number,
    e: number,
Severity: Minor
Found in src/processing/affine.ts - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

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

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

      async function dispatchRotate90DegreesCounterclockwise(
          argv: string[]
      ): Promise<void> {
          let srcFilePath = defaultSrcFilePath;
          let dstFilePath = `test/output-files/rotate90ccw.${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 createThAWImage has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          width: number,
          height: number,
          bytesPerPixel?: number,
          bytesPerLine?: number,
          // colourModel?: ColourModel,
      Severity: Minor
      Found in src/util/image.ts - About 35 mins to fix

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

        async function dispatchDesaturate(argv: string[]): Promise<void> {
            let srcFilePath = defaultSrcFilePath;
            let dstFilePath = `test/output-files/desaturate.${dstFileExtension}`;
        
            for (let i = 0; i < argv.length; i++) {
        Severity: Minor
        Found in src/cli.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 compositeImageFromBuffers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export function compositeImageFromBuffers(
            dstBuffer: ThAWImageBufferType,
            dstWidth: number,
            dstHeight: number,
            dstInitialRowOffset: number,
        Severity: Minor
        Found in src/util/composite.ts - 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

        Function constructor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            constructor(
                width: number,
                height: number,
                bytesPerPixel?: number,
                bytesPerLine?: number,
        Severity: Minor
        Found in src/util/image.ts - 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

        Function mapImageByCoordinatesFromBuffer has a Cognitive Complexity of 6 (exceeds 5 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 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