Showing 821 of 821 total issues
Method toBytes
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
public byte[] toBytes() throws IOException {
Map<String, Object> message = new HashMap<>();
if (id != null) {
message.put(ID_FLAG, id);
}
File TopicManager.java
has 270 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 EventConsumer.java
has 269 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 filterHeaders
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public Map<String, String> filterHeaders(HeaderInfo headerInfo, Map<String, String> headers) {
Map<String, String> result = new HashMap<>(headers);
if (headerInfo.keepHeaders != null && !headerInfo.keepHeaders.isEmpty()) {
// drop all headers except those to be kept
Map<String, String> toBeKept = 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
Method getFlatMap
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
@SuppressWarnings("unchecked")
private void getFlatMap(String prefix, Map<String, Object> src, Map<String, Object> target) {
for (String k: src.keySet()) {
String key = prefix == null? k : prefix+"."+k;
Object v = src.get(k);
- 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 18 (exceeds 5 allowed). Consider refactoring. Open
@Override
public Object handleEvent(Map<String, String> headers, Object body, int instance) throws Exception {
if (connected && !ws.isClosed()) {
if (WsEnvelope.CLOSE.equals(headers.get(WsEnvelope.TYPE))) {
connected = false;
- 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 AppStarter.java
has 265 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 toMap
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
public Map<String, Object> toMap() {
Map<String, Object> result = new HashMap<>();
if (!headers.isEmpty()) {
result.put(HTTP_HEADERS, setLowerCase(headers));
}
PubSubManager
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
public class PubSubManager implements PubSubProvider {
private static final Logger log = LoggerFactory.getLogger(PubSubManager.class);
private static final String PUBLISHER = "event.publisher";
private static final String TYPE = "type";
PubSubManager
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
public class PubSubManager implements PubSubProvider {
private static final Logger log = LoggerFactory.getLogger(PubSubManager.class);
private static final String PUBLISHER = "event.publisher";
private static final String TYPE = "type";
Method validateServiceList
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
@SuppressWarnings("unchecked")
private List<String> validateServiceList(Object svcList) {
Utility util = Utility.getInstance();
List<String> list = svcList instanceof String?
Collections.singletonList((String) svcList) : (List<String>) svcList;
- 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 parse
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
@SuppressWarnings("unchecked")
public Map<String, Object> parse(InputStream res) throws IOException {
Map<String, Object> result = new HashMap<>();
Document doc;
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 getEnv
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private Map<String, Object> getEnv() {
Map<String, Object> result = new HashMap<>();
Utility util = Utility.getInstance();
AppConfigReader reader = AppConfigReader.getInstance();
List<String> envVars = util.split(reader.getProperty(SHOW_ENV, ""), ", ");
- 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 escapeXml
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private String escapeXml(String value, TagType type) {
switch (type) {
case START:
if (value.startsWith("/") || value.startsWith("{")) {
return "node value=\""+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 handleEvent
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
@Override
public Object handleEvent(Map<String, String> headers, Object body, int instance) throws Exception {
if (headers.containsKey(TO) && body instanceof byte[]) {
List<String> destinations = getDestinations(headers);
if (!destinations.isEmpty()) {
- 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 process
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void process(EventEnvelope event) throws IOException {
/*
* The original sender is encoded in the extra field as a routing tag.
* It's value is in the format: "token_id->reply_to".
*
Method handle
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void handle(Message<byte[]> message) {
if (!stopped) {
final EventEnvelope event = new EventEnvelope();
try {
Method parse
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
@SuppressWarnings("unchecked")
public Map<String, Object> parse(InputStream res) throws IOException {
Map<String, Object> result = new HashMap<>();
Document doc;
try {
PubSubManager
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
public class PubSubManager implements PubSubProvider {
private static final Logger log = LoggerFactory.getLogger(PubSubManager.class);
private static final MsgPack msgPack = new MsgPack();
private static final String TYPE = "type";
Method handle
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void handle(HttpServerRequest request) {
Utility util = Utility.getInstance();
HttpServerResponse response = request.response();
response.putHeader(DATE, util.getHtmlDate(new Date()));