File iterator.js
has 462 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {Index} from '../math/index';
import {Point2D} from '../math/point';
// doc imports
/* eslint-disable no-unused-vars */
Function getSliceIterator
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
export function getSliceIterator(
image, position, isRescaled, viewOrientation) {
const size = image.getGeometry().getSize();
// zero-ify non direction index
let dirMax2Index = 2;
- 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 getSliceIterator
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getSliceIterator(
image, position, isRescaled, viewOrientation) {
const size = image.getGeometry().getSize();
// zero-ify non direction index
let dirMax2Index = 2;
Function range3d
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function range3d(dataAccessor, start, maxIter, increment,
blockMaxIter, blockIncrement, reverse1, reverse2, isPlanar) {
const iters = [];
if (isPlanar) {
iters.push(range(
Function getVariableRegionSliceIterator
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getVariableRegionSliceIterator(
image, index, isRescaled, regions) {
if (image.getNumberOfComponents() !== 1) {
throw new Error('Unsupported number of components for region iterator: ' +
image.getNumberOfComponents());
Function range
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function range(dataAccessor, start, maxIter, increment,
blockMaxIter, blockIncrement, reverse1, reverse2) {
if (typeof reverse1 === 'undefined') {
reverse1 = false;
}
Function range
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
export function range(dataAccessor, start, maxIter, increment,
blockMaxIter, blockIncrement, reverse1, reverse2) {
if (typeof reverse1 === 'undefined') {
reverse1 = false;
}
- 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 simpleRange3d
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function simpleRange3d(
dataAccessor, start, end, increment, isPlanar) {
if (typeof increment === 'undefined') {
increment = 1;
}
Function getRegionSliceIterator
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getRegionSliceIterator(
image, index, isRescaled, min, max) {
if (image.getNumberOfComponents() !== 1) {
throw new Error('Unsupported number of components for region iterator: ' +
image.getNumberOfComponents());
Function getVariableRegionSliceIterator
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export function getVariableRegionSliceIterator(
image, index, isRescaled, regions) {
if (image.getNumberOfComponents() !== 1) {
throw new Error('Unsupported number of components for region iterator: ' +
image.getNumberOfComponents());
- 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 rangeRegions
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function rangeRegions(
dataAccessor, start, end, increment, regions) {
let nextIndex = start;
let regionCount = 0;
let regionElementCount = 0;
Function range3d
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
export function range3d(dataAccessor, start, maxIter, increment,
blockMaxIter, blockIncrement, reverse1, reverse2, isPlanar) {
Function range
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
export function range(dataAccessor, start, maxIter, increment,
blockMaxIter, blockIncrement, reverse1, reverse2) {
Function getRange
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
dataAccessor, start, maxIter, increment,
blockMaxIter, blockIncrement, reverse1, reverse2) {
Function rangeRegions
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function rangeRegions(
dataAccessor, start, end, increment, regions) {
let nextIndex = start;
let regionCount = 0;
let regionElementCount = 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
Avoid deeply nested control flow statements. Open
if (dirMax0.index === 0) {
// xzy
rangeObj = getRange(dataAccessor,
start, maxIter, 1, ncols, sliceSize, reverse1, reverse2);
} else {
Function rangeRegion
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
dataAccessor, start, end, increment, regionSize, regionOffset) {
Function simpleRange3d
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
dataAccessor, start, end, increment, isPlanar) {
Function rangeRegions
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
dataAccessor, start, end, increment, regions) {
Function getRegionSliceIterator
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
image, index, isRescaled, min, max) {
Function simpleRange3d
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function simpleRange3d(
dataAccessor, start, end, increment, isPlanar) {
if (typeof increment === 'undefined') {
increment = 1;
}
- 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 getRegionSliceIterator
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function getRegionSliceIterator(
image, index, isRescaled, min, max) {
if (image.getNumberOfComponents() !== 1) {
throw new Error('Unsupported number of components for region iterator: ' +
image.getNumberOfComponents());
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (dirMax2.index === 2) {
// axial
maxIter = ncols * nrows;
if (dirMax0.index === 0) {
// xyz
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 76.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
} else if (dirMax2.index === 1) {
// coronal
maxIter = nslices * ncols;
if (dirMax0.index === 0) {
// xzy
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 76.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 3 locations. Consider refactoring. Open
if (isRescaled) {
dataAccessor = function (offset) {
return image.getRescaledValueAtOffset(offset);
};
} else {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 59.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 3 locations. Consider refactoring. Open
if (isRescaled) {
dataAccessor = function (offset) {
return image.getRescaledValueAtOffset(offset);
};
} else {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 59.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 3 locations. Consider refactoring. Open
if (isRescaled) {
dataAccessor = function (offset) {
return image.getRescaledValueAtOffset(offset);
};
} else {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 59.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76