Showing 49 of 71 total issues
Function pixelateImage
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
export function pixelateImage(
srcImage: IThAWImage,
pixelWidth: number,
pixelHeight?: number
): IThAWImage {
- Read upRead up
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
File resample.ts
has 309 lines of code (exceeds 250 allowed). Consider refactoring. Open
// thaw-image-processing.ts/src/resample.ts
// See http://entropymine.com/imageworsener/bicubic/ :
// Cubic resampling
Function convolve1D
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
function convolve1D(
dstBuffer: ThAWImageBufferType,
dstInitialOffset: number,
numDstPixels: number,
dstPixelStride: number,
Function resample1DBicubic
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
function resample1DBicubic(
dstBuffer: ThAWImageBufferType,
dstInitialOffset: number,
numDstPixels: number,
dstPixelStride: number,
Function pixelateImage
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function pixelateImage(
srcImage: IThAWImage,
pixelWidth: number,
pixelHeight?: number
): IThAWImage {
File cli.ts
has 276 lines of code (exceeds 250 allowed). Consider refactoring. Open
// thaw-image-processing.ts/src/cli.ts
// E.g. : npm start -- -sc -w 235 -h 763 in.jpg out.jpg -q 34
import * as fs from 'fs';
Function dispatchResample
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
async function dispatchResample(argv: string[]): Promise<void> {
let srcFilePath = defaultSrcFilePath;
let dstFilePath = `test/output-files/resample.${dstFileExtension}`;
let dstWidth = 0;
let dstHeight = 0;
- Read upRead up
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 resample1DBilinear
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
function resample1DBilinear(
dstBuffer: ThAWImageBufferType,
dstInitialOffset: number,
numDstPixels: number,
dstPixelStride: number,
Function doAffineTransformation
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function doAffineTransformation(
dstImage: IThAWImage,
srcImage: IThAWImage,
matrix: IAffineTransformationMatrix,
dstLeft?: number,
Function resample1DBicubic
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function resample1DBicubic(
dstBuffer: ThAWImageBufferType,
dstInitialOffset: number,
numDstPixels: number,
dstPixelStride: number,
- Read upRead up
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 convolve1D
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function convolve1D(
dstBuffer: ThAWImageBufferType,
dstInitialOffset: number,
numDstPixels: number,
dstPixelStride: number,
- Read upRead up
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 15 arguments (exceeds 4 allowed). Consider refactoring. Open
dstBuffer: ThAWImageBufferType,
dstWidth: number,
dstHeight: number,
dstInitialRowOffset: number,
dstRowStride: number,
Function dispatchResample
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function dispatchResample(argv: string[]): Promise<void> {
let srcFilePath = defaultSrcFilePath;
let dstFilePath = `test/output-files/resample.${dstFileExtension}`;
let dstWidth = 0;
let dstHeight = 0;
Function compositeImageFromBuffers
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function compositeImageFromBuffers(
dstBuffer: ThAWImageBufferType,
dstWidth: number,
dstHeight: number,
dstInitialRowOffset: number,
Function generateKernel
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function generateKernel(sigma: number, kernelSize: number): number[] {
// sigma must be a positive number.
// kernelSize must be an odd positive integer smaller than 999.
const sampleCount = 1000.0;
Function convolveImageFromBuffer
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function convolveImageFromBuffer(
srcImage: IThAWImage,
kernel: number[]
// sigma: number,
// kernelSize: number /*, fnCreateImage */
Function dispatch
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function dispatch(argv: string[]): Promise<void> {
const command = argv.shift();
switch (command) {
case 'c':
Function dispatchPixelate
has a Cognitive Complexity of 12 (exceeds 5 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;
- Read upRead up
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 doAffineTransformation
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export function doAffineTransformation(
dstImage: IThAWImage,
srcImage: IThAWImage,
matrix: IAffineTransformationMatrix,
dstLeft?: number,
- Read upRead up
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 dispatchGaussianBlur
has a Cognitive Complexity of 12 (exceeds 5 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;
- Read upRead up
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"