Showing 821 of 821 total issues
Method routeExists
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private boolean routeExists(String route) {
if (route == null) {
return false;
}
Platform platform = Platform.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 addRouteSubstitution
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private void addRouteSubstitution(String original, String replacement) {
Utility util = Utility.getInstance();
if (util.validServiceName(original) && util.validServiceName(replacement)
&& original.contains(".") && replacement.contains(".")) {
if (!original.equals(replacement) && !replacement.equals(reRoutes.get(original))) {
- 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 read
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public byte[] read() {
if (peeked != null) {
byte[] result = peeked;
peeked = null;
return result;
- 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 setTargetHost
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public AsyncHttpRequest setTargetHost(String host) {
if (host != null && (host.startsWith(HTTP_PROTOCOL) || host.startsWith(HTTPS_PROTOCOL))) {
try {
URL u = new URL(host);
if (!u.getPath().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 doGet
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
if (!ready) {
response.sendError(404, "Did you forget to do " +
"'git clone https://github.com/swagger-api/swagger-ui.git' " +
- 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 publish
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void publish(String topic, int partition, Map<String, String> headers, Object body) throws IOException {
ConnectorConfig.validateTopicName(topic);
Map<String, String> eventHeaders = headers == null? new HashMap<>() : headers;
if (eventHeaders.containsKey(EventProducer.EMBED_EVENT) && body instanceof byte[]) {
- 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 publish
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void publish(String topic, int partition, Map<String, String> headers, Object body) throws IOException {
ConnectorConfig.validateTopicName(topic);
Utility util = Utility.getInstance();
Map<String, String> eventHeaders = headers == null? new HashMap<>() : 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 sendEvent
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private void sendEvent(String topic, int partition, Map<String, String> headers, Object body) {
String realTopic = partition < 0 ? topic : topic + "." + partition;
if (ConnectorConfig.topicSubstitutionEnabled()) {
realTopic = preAllocatedTopics.getOrDefault(realTopic, realTopic);
}
- 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 topicPartitions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private int topicPartitions(String topic) {
if (topicSubstitution) {
int n = 0;
while (preAllocatedTopics.containsKey(topic+"."+n)) {
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 unpack
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private Map<String, Object> unpack(MessageUnpacker unpacker, Map<String, Object> map) throws IOException {
int n = unpacker.unpackMapHeader();
for (int i=0; i < n; i++) {
String key = unpacker.unpackString();
MessageFormat mf = unpacker.getNextFormat();
- 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 createAddress
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private void createAddress(String address, boolean isTopic) throws Exception {
if (!topicExists(address)) {
try (ClientRequestor requestor = new ClientRequestor(session, ACTIVEMQ_MANAGEMENT)) {
ClientMessage m = session.createMessage(false);
if (isTopic) {
- 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 sendEvent
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private void sendEvent(String topic, int partition, Map<String, String> headers, Object body) {
String realTopic = partition < 0 ? topic : topic + "." + partition;
if (ConnectorConfig.topicSubstitutionEnabled()) {
realTopic = preAllocatedTopics.getOrDefault(realTopic, realTopic);
}
- 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 publish
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void publish(String topic, int partition, Map<String, String> headers, Object body) throws IOException {
ConnectorConfig.validateTopicName(topic);
Map<String, String> eventHeaders = headers == null? new HashMap<>() : headers;
if (eventHeaders.containsKey(EventProducer.EMBED_EVENT) && body instanceof byte[]) {
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
public void start() {
final Platform platform = Platform.getInstance();
final PostOffice po = PostOffice.getInstance();
final Utility util = Utility.getInstance();
final PubSub ps = PubSub.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 handle
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static void handle(boolean resume, HttpServletRequest request, HttpServletResponse response)
throws IOException {
String type = resume? RESUME : SUSPEND;
String origin = request.getHeader(APP_INSTANCE);
if (origin == null) {
Method executeActuator
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private boolean executeActuator(String requestId, HttpServerRequest request, String type) {
Platform platform = Platform.getInstance();
PostOffice po = PostOffice.getInstance();
SimpleHttpUtility httpUtil = SimpleHttpUtility.getInstance();
String origin = request.getHeader(APP_INSTANCE);
Method discover
has 27 lines of code (exceeds 25 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('@');
Method start
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void start() throws IOException {
final boolean requireInitialization = offset == INITIALIZE;
if (requireInitialization) {
ServiceLifeCycle initialLoad = new ServiceLifeCycle(topic, partition, INIT_TOKEN);
initialLoad.start();
Method handleEvent
has 27 lines of code (exceeds 25 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();
Method doLoopbackTest
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private String doLoopbackTest(String topicPartition) throws AppException, IOException {
String topic = getTopic(topicPartition);
int partition = getPartition(topicPartition);
long begin = System.currentTimeMillis();
// wait for reply