Showing 821 of 821 total issues
Method exists
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public boolean exists(String... routes) {
if (routes == null || routes.length == 0) {
return false;
}
if (routes.length == 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
Method getFlatList
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@SuppressWarnings("unchecked")
private void getFlatList(String prefix, List<Object> src, Map<String, Object> target) {
int n = 0;
for (Object v: src) {
String key = prefix+"["+n+"]";
- 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 getException
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public Throwable getException() {
if (!exRestored) {
if (exceptionBytes != null) {
try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(exceptionBytes))) {
exception = (Throwable) in.readObject();
- 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 handle
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void handle(ServerWebSocket ws) {
String uri = ws.path().trim();
String path = findPath(uri);
if (path == null) {
- 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 saveResponse
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private void saveResponse(String sender, String inboxId, EventEnvelope reply) {
AsyncMultiInbox holder = (AsyncMultiInbox) inboxes.get(inboxId);
if (holder != null) {
float diff = (float) (System.nanoTime() - holder.begin) / PostOffice.ONE_MILLISECOND;
// adjust precision to 3 decimal points
- 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 generateRsaKey
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public KeyPair generateRsaKey(int keySize) {
if (allowedRsaKeySize(keySize)) {
try {
KeyPairGenerator kg = KeyPairGenerator.getInstance(RSA);
kg.initialize(keySize);
- 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 mapToString
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private String mapToString(Map<String, String> map) {
if (map == null || map.isEmpty()) {
return "";
}
StringBuilder sb = new StringBuilder();
- 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 getConnection
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static synchronized Connection getConnection(String domain, Properties properties) throws Exception {
Connection connection = allConnections.get(domain);
if (connection == null) {
final ConnectionFactory factory;
final boolean jndi = "true".equalsIgnoreCase(properties.getProperty(JNDI));
- 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 pack
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public byte[] pack(Object obj) throws IOException {
if (obj instanceof Map || obj instanceof List) {
// select low level processing for faster performance
ByteArrayOutputStream out = new ByteArrayOutputStream();
MessagePacker packer = null;
- 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 typedNumber
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public Object typedNumber(JsonPrimitive p) {
/*
* Type information is lost for numbers.
* This is the best effort to keep int/long and float/double value.
*
- 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 unsubscribe
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void unsubscribe(String topic, int partition) throws IOException {
String topicPartition = (topic + (partition < 0? "" : "." + partition)).toLowerCase();
Platform platform = Platform.getInstance();
if (platform.hasRoute(topicPartition) && subscribers.containsKey(topicPartition)) {
- 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 start
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void start(String[] args) throws InterruptedException {
if (zkRunning()) {
log.error("Application quits because another standalone instance is running");
System.exit(-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
Method toString
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(name);
sb.append('=');
- 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 unsubscribe
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void unsubscribe(String topic, int partition) throws IOException {
String topicPartition = (topic + (partition < 0? "" : "." + partition)).toLowerCase();
Platform platform = Platform.getInstance();
if (platform.hasRoute(topicPartition) && subscribers.containsKey(topicPartition)) {
- 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 run
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void run() {
try (InputStream stream = EmbeddedKafka.class.getResourceAsStream("/server.properties")) {
if (stream == null) {
throw new IOException("server.properties is not available as resource");
- 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 addParameter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public ScheduledJob addParameter(String key, Object value) {
if (key != null) {
String v;
// null value is transported as an empty string
if (value == null) {
- 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 unsubscribe
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void unsubscribe(String topic, int partition) throws IOException {
String topicPartition = (topic + (partition < 0? "" : "." + partition)).toLowerCase();
Platform platform = Platform.getInstance();
if (platform.hasRoute(topicPartition) && subscribers.containsKey(topicPartition)) {
- 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 sendMyRoutes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private void sendMyRoutes(boolean exchange) throws IOException {
long now = System.currentTimeMillis();
if (!exchange && now - lastBroadcastAdd < 100) {
log.debug("Duplicated broadcast add ignored");
return;
- 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 removeStalledPeers
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private void removeStalledPeers() throws IOException {
long now = System.currentTimeMillis();
Utility util = Utility.getInstance();
String myOrigin = Platform.getInstance().getOrigin();
List<String> peers = new ArrayList<>(cloudOrigins.keySet());
- 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 removeRoute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private void removeRoute(String origin, String route) {
boolean deleted = false;
if (cloudRoutes.containsKey(route)) {
ConcurrentMap<String, String> originMap = cloudRoutes.get(route);
if (originMap.containsKey(origin)) {
- 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"