Showing 821 of 821 total issues
Method handleEvent
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
@SuppressWarnings("unchecked")
@Override
public Object handleEvent(Map<String, String> headers, Object body, int instance) throws IOException {
PostOffice po = PostOffice.getInstance();
String myOrigin = Platform.getInstance().getOrigin();
Method handleEvent
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public void handleEvent(AssignedRoute route, String requestId, int status, String error) {
AsyncContextHolder holder = contexts.get(requestId);
if (holder != null) {
HttpServerRequest request = holder.request;
SimpleHttpUtility httpUtil = SimpleHttpUtility.getInstance();
- 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 toMap
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public Map<String, Object> toMap() {
Map<String, Object> result = new HashMap<>();
if (!headers.isEmpty()) {
result.put(HTTP_HEADERS, setLowerCase(headers));
}
- 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 request
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public List<EventEnvelope> request(final List<EventEnvelope> events, long timeout) throws IOException {
if (events == null || events.isEmpty()) {
throw new IllegalArgumentException(MISSING_EVENT);
}
List<TargetRoute> destinations = new ArrayList<>();
- 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 str2localtime
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public LocalDateTime str2localtime(String str, boolean throwException) {
if (str == null) {
if (throwException) {
throw new IllegalArgumentException("time string cannot be null");
} else {
- 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 discover
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public TargetRoute discover(String to, boolean endOfRoute) throws IOException {
boolean checkCloud = !endOfRoute && !to.equals(CLOUD_CONNECTOR);
Platform platform = Platform.getInstance();
if (to.contains("@")) {
int at = to.indexOf('@');
- 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 asyncRequest
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public Future<List<EventEnvelope>> asyncRequest(final List<EventEnvelope> events, long timeout) throws IOException {
if (events == null || events.isEmpty()) {
throw new IllegalArgumentException(MISSING_EVENT);
}
List<TargetRoute> destinations = new ArrayList<>();
- 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 getClusterProperties
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public static Properties getClusterProperties(String location) {
// default location is cloud.client.properties
Properties properties = allProperties.get(location);
if (properties == null) {
ConfigReader clusterConfig = 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 decode
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public Object decode(TypedPayload typed) throws ClassNotFoundException {
String type = typed.getType();
if (NOTHING.equals(type)) {
return 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 handleEvent
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
@Override
public Object handleEvent(Map<String, String> headers, Object body, int instance) throws IOException {
if (headers.containsKey(TYPE)) {
if (LIST.equals(headers.get(TYPE))) {
return listTopics();
- 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 isTopicAssigned
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
@SuppressWarnings("unchecked")
private boolean isTopicAssigned(String origin, Map<String, Object> info) {
if (info.containsKey(TOPIC)) {
String myTopic = info.get(TOPIC).toString();
Map<String, Object> allConnections = getConnections();
- 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 handleEvent
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
@SuppressWarnings("unchecked")
@Override
public Object handleEvent(Map<String, String> headers, Object body, int instance) throws IOException {
Platform platform = Platform.getInstance();
PostOffice po = PostOffice.getInstance();
- 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
File PubSubManager.java
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
Copyright 2018-2023 Accenture Technology
Licensed under the Apache License, Version 2.0 (the "License");
File TopicManager.java
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
Copyright 2018-2023 Accenture Technology
Licensed under the Apache License, Version 2.0 (the "License");
File MultiLevelMap.java
has 287 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
Copyright 2018-2023 Accenture Technology
Licensed under the Apache License, Version 2.0 (the "License");
Method onStartup
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void onStartup(ServletContext servletContext) {
if (!loaded) {
// guarantee to do once
loaded = true;
Method onMessage
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
@SuppressWarnings("unchecked")
@Override
public void onMessage(Message<Map<String, Object>> evt) {
Utility util = Utility.getInstance();
PostOffice po = PostOffice.getInstance();
Method initialize
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static void initialize() throws IOException {
if (apiKey == null) {
apiKey = getApiKey();
log.info("Started");
LambdaFunction registry = (headers, body, instance) -> {
Similar blocks of code found in 2 locations. Consider refactoring. Open
/*
Copyright 2018-2023 Accenture Technology
Licensed under the Apache License, Version 2.0 (the "License");
- 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 178.
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
/*
Copyright 2018-2023 Accenture Technology
Licensed under the Apache License, Version 2.0 (the "License");
- 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 178.
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