Showing 821 of 821 total issues
Method handleEvent
has a Cognitive Complexity of 23 (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 checkServices
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
@SuppressWarnings("unchecked")
private boolean checkServices(List<Map<String, Object>> upstream, List<String> healthServices, boolean required) {
PostOffice po = PostOffice.getInstance();
boolean up = true;
for (String route: healthServices) {
- 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 getNextAvailable
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
private String getNextAvailable(List<String> targetList) {
List<String> available = new ArrayList<>();
for (String target: targetList) {
if (ServiceRegistry.destinationExists(target)) {
available.add(target);
- 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 23 (exceeds 5 allowed). Consider refactoring. Open
@Override
@SuppressWarnings("unchecked")
public Object handleEvent(Map<String, String> headers, Object body, int instance) throws Exception {
if (INFO.equals(headers.get(TYPE))) {
Map<String, Object> result = new HashMap<>();
- 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
Platform
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
public class Platform {
private static final Logger log = LoggerFactory.getLogger(Platform.class);
private static final ManagedCache cache = ManagedCache.createCache("system.log.cache", 30000);
private static final CryptoApi crypto = new CryptoApi();
private static final ConcurrentMap<String, BlockingQueue<Boolean>> serviceTokens = new ConcurrentHashMap<>();
Method handle
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void handle(HttpServerRequest request) {
PostOffice po = PostOffice.getInstance();
Utility util = Utility.getInstance();
HttpServerResponse response = request.response();
File MonitorService.java
has 298 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 sendRequestToService
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public void sendRequestToService(HttpServerRequest request, HttpRequestEvent requestEvent) {
SimpleHttpUtility httpUtil = SimpleHttpUtility.getInstance();
PostOffice po = PostOffice.getInstance();
if (requestEvent.authService != null) {
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 handle
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void handle(HttpServerRequest request) {
PostOffice po = PostOffice.getInstance();
Utility util = Utility.getInstance();
HttpServerResponse response = request.response();
- 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 getTibcoProperties
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public static synchronized Properties getTibcoProperties(String location) {
// default location is cloud.client.properties
Properties properties = allProperties.get(location);
if (properties == null) {
properties = new Properties();
- 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 22 (exceeds 5 allowed). Consider refactoring. Open
@Override
public Object handleEvent(Map<String, String> headers, Object body, int instance) throws Exception {
if (headers.containsKey(TYPE)) {
String type = headers.get(TYPE);
if (LIVENESS_PROBE.equals(type)) {
- 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 22 (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
File PubSubManager.java
has 295 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 WorkerQueue.java
has 294 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 handle
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void handle(ServerWebSocket ws) {
String uri = ws.path().trim();
String path = findPath(uri);
if (path == null) {
Method load
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
@SuppressWarnings("unchecked")
public void load(byte[] bytes) throws IOException {
Object o = msgPack.unpack(bytes);
if (o instanceof Map) {
Map<String, Object> message = (Map<String, Object>) o;
Method handleEvent
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public Object handleEvent(Map<String, String> headers, Object body, int instance) throws Exception {
Utility util = Utility.getInstance();
PostOffice po = PostOffice.getInstance();
String myOrigin = Platform.getInstance().getOrigin();
File PresenceConnector.java
has 291 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
Copyright 2018-2023 Accenture Technology
Licensed under the Apache License, Version 2.0 (the "License");
Identical blocks of code found in 2 locations. Consider refactoring. Open
@Override
public void subscribe(String topic, int partition, LambdaFunction listener, String... parameters) throws IOException {
ConnectorConfig.validateTopicName(topic);
String topicPartition = (topic + (partition < 0? "" : "." + partition)).toLowerCase();
if (parameters.length == 2 || parameters.length == 3) {
- 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 189.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
@Override
public void subscribe(String topic, int partition, LambdaFunction listener, String... parameters) throws IOException {
ConnectorConfig.validateTopicName(topic);
String topicPartition = (topic + (partition < 0? "" : "." + partition)).toLowerCase();
if (parameters.length == 2 || parameters.length == 3) {
- 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 189.
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