Showing 14 of 16 total issues
Method explore
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
private void explore(Route route, Object object, Trace trace) {
for (Field field : object.getClass().getDeclaredFields()) {
if (visitable(field)) {
trace.add(field);
VisitationResult visitationResult = visitor.visit(object, field);
- 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 visit
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private void visit(Object location) {
while (legIterator.hasNext()) {
Leg leg = legIterator.next();
switch (leg.getType()) {
case ITERATE_OVER_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 explore
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void explore(Route route, Object object, Trace trace) {
for (Field field : object.getClass().getDeclaredFields()) {
if (visitable(field)) {
trace.add(field);
VisitationResult visitationResult = visitor.visit(object, field);
Method createObjectFor
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private CreationResult createObjectFor(Field field) {
Object fieldValue = null;
Class elementClass = null;
// TODO gleissc Obtain from configuration
int collectionSize = 3;
- 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 visit
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void visit(Object location) {
while (legIterator.hasNext()) {
Leg leg = legIterator.next();
switch (leg.getType()) {
case ITERATE_OVER_ARRAY:
Method createObjectFor
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private CreationResult createObjectFor(Field field) {
Object fieldValue = null;
Class elementClass = null;
// TODO gleissc Obtain from configuration
int collectionSize = 3;
Method addLeg
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public void addLeg(FieldContext fieldContext, LegType legType) {
if (LegType.RETURN.equals(legType)) {
legs.add(Leg.RETURN_LEG);
} else {
// following code tries to avoid creating a new instance of Leg when it's not necessary.
- 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 equals
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
- 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 (fieldValue instanceof Collection) {
route.addLeg(visitationResult.getFieldContext(), LegType.ITERATE_OVER_COLLECTION);
int elementIndex = 0;
for (Object fieldElement : (Collection) fieldValue) {
explore(route, fieldElement, trace.add(field, elementIndex++));
Method getFieldValue
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private Object getFieldValue(Object object, final Field field) {
Object fieldValue = null;
if (object != null) {
final boolean wasAccessible = field.isAccessible();
try {
- 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 createProducers
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public List<Producer<T>> createProducers(Class<T> type, Config config, Route route, int numberOfInstances) {
List<Producer<T>> producers = new ArrayList<Producer<T>>();
ProducerVisitorContext producerVisitorContext = new ProducerVisitorContext(config);
ProducerVisitor visitor = new ProducerVisitor(producerVisitorContext);
- 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 false;
Avoid too many return
statements within this method. Open
return true;
Method equals
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Value value = (Value) o;
- 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"