Showing 821 of 821 total issues
Avoid deeply nested control flow statements. Open
if (f.delete()) {
log.info("Outdated {} deleted", f);
}
Avoid deeply nested control flow statements. Open
if (current.getNodeType() == Node.ELEMENT_NODE) {
String nodeName = current.getNodeName();
int counter = childCounts.getOrDefault(nodeName, 0);
current.setUserData(INDEX, counter, null);
childCounts.put(nodeName, ++counter);
Avoid deeply nested control flow statements. Open
for (String k: map.keySet()) {
j.addParameter(k, map.get(k));
}
Method unpackValue
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private Object unpackValue(MessageUnpacker unpacker, MessageFormat mf) throws IOException {
ValueType type = mf.getValueType();
switch (type) {
case STRING:
return unpacker.unpackString();
- 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 unpack
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public Object unpack(byte[] bytes, int offset, int length) throws IOException {
MessageUnpacker unpacker = null;
try {
unpacker = MessagePack.newDefaultUnpacker(bytes, offset, length);
if (unpacker.hasNext()) {
- 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 (to.contains(TO_MONITOR)) {
message.setTo(to.substring(0, to.indexOf(TO_MONITOR)));
}
Avoid deeply nested control flow statements. Open
if (util.portReady(host, port, 10000)) {
reachable = true;
}
Method getRoutingTable
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@SuppressWarnings("unchecked")
private Map<String, Object> getRoutingTable() throws AppException, TimeoutException {
Platform platform = Platform.getInstance();
if (hasCloudConnector &&
(platform.hasRoute(ServiceDiscovery.SERVICE_QUERY) || platform.hasRoute(CLOUD_CONNECTOR))) {
- 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 (util.portReady(host, port, 10000)) {
reachable = true;
}
Method permittedDataModel
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private boolean permittedDataModel(String clsName) {
// accept all types if safe.data.models feature is not enabled
if (safeModels.isEmpty()) {
// feature not enabled
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 (util.portReady(host, port, 10000)) {
reachable = true;
}
Avoid deeply nested control flow statements. Open
for (TopicPartition tp : p) {
long earliest = getEarliest(tp);
long latest = getLatest(tp);
if (offset < 0) {
consumer.seek(tp, latest);
Method getReplicationFactor
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private int getReplicationFactor() {
if (topicSubstitution) {
return 1;
}
if (replicationFactor == -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
Avoid deeply nested control flow statements. Open
for (String appOrigin: connections.keySet()) {
Map<String, Object> metadata = connections.get(appOrigin);
MonitorService.updateNodeInfo(appOrigin, metadata);
if (metadata.containsKey(TOPIC)) {
po.send(MainApp.TOPIC_CONTROLLER, new Kv(TYPE, ALIVE), new Kv(NAME, metadata.get(NAME)),
Avoid deeply nested control flow statements. Open
if (client != null) {
if (client.getState() == State.OPEN) {
if (LOGIN.equals(type) && event.containsKey(API_KEY)
&& event.get(API_KEY).equals(apiKey)) {
client.setState(State.AUTHENTICATED);
Avoid deeply nested control flow statements. Open
if (map.containsKey(TOPIC)) {
String peerTopic = map.get(TOPIC).toString();
if (myTopic.equals(peerTopic)) {
log.warn("{} rejected because {} already assigned to {}", origin, peer, peerTopic);
return true;
Avoid deeply nested control flow statements. Open
if (listener.getPartition() < 0) {
all = true;
} else {
subscribed.add(listener.getPartition());
}
Avoid deeply nested control flow statements. Open
if (partition >= 0 && all) {
throw new IllegalArgumentException("Cannot subscribe "+route+" to partition "+partition+
" because all partitions of "+topic+" have been subscribed");
}
Avoid deeply nested control flow statements. Open
if (partition < 0 && !subscribed.isEmpty()) {
throw new IllegalArgumentException("Cannot subscribe "+route+" to all partitions " +
"because some partitions of topic "+topic+" has been subscribed");
}
Avoid deeply nested control flow statements. Open
if (listener.hasRoute(route)) {
listener.removeRoute(route);
success = true;
int partition = listener.getPartition();
if (partition < 0) {