BaseWorkspaceMgr
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
@Slf4j
public abstract class BaseWorkspaceMgr<T extends Enum<T>> implements WorkspaceMgr<T> {
private static final boolean DISABLE_LEVERAGE = false; //Mainly for debugging/optimization purposes
protected final Set<T> scopeOutOfWs;
File BaseWorkspaceMgr.java
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
Method validateArrayLocation
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
@Override
public INDArray validateArrayLocation(@NonNull T arrayType, @NonNull INDArray array, boolean migrateIfInvalid, boolean exceptionIfDetached) {
validateConfig(arrayType);
if(scopeOutOfWs.contains(arrayType)){
- 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
Method leverageTo
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
@Override
public INDArray leverageTo(@NonNull T arrayType, @NonNull INDArray array) {
if(array == null || !array.isAttached()){
return array;
}
- 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
Method validateArrayLocation
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public INDArray validateArrayLocation(@NonNull T arrayType, @NonNull INDArray array, boolean migrateIfInvalid, boolean exceptionIfDetached) {
validateConfig(arrayType);
if(scopeOutOfWs.contains(arrayType)){
Method castTo
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
@Override
public INDArray castTo(@NonNull T arrayType, @NonNull DataType dataType, @NonNull INDArray toCast, boolean dupIfCorrectType) {
if(toCast.dataType() == dataType) {
if(!dupIfCorrectType) {
//Check if we can avoid duping... if not in workspace, or already in correct workspace
- 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 too many return
statements within this method. Open
return array;