Showing 1,068 of 1,068 total issues
Method getPluginImplementationViaProperty
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
/* test */ static Object getPluginImplementationViaProperty(Class<?> pluginClass, Properties propsIn) {
// Make a defensive clone because traversal may fail with ConcurrentModificationException
// if the properties get changed by something outside RxJava.
Properties props = (Properties)propsIn.clone();
- 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 call
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void call(final Subscriber<? super T> child) {
// when true is a marker to say we are ready to resubscribe to source
final AtomicBoolean resumeBoundary = new AtomicBoolean(true);
- 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 drain
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
private void drain() {
if (wip.getAndIncrement() == 0) {
final Subscriber<? super T> c = child;
final Queue<Object> q = queue;
do {
- 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 drain
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
private void drain() {
if (wip.getAndIncrement() == 0) {
final Subscriber<? super T> c = child;
final Queue<Object> q = queue;
- 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 emitLoop
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
void emitLoop() {
final Subscriber<? super T> c = child;
long toRequest = 0L;
Producer requestFrom = null;
File OnSubscribeCombineLatest.java
has 328 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Copyright 2015 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
Method amb
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static Completable amb(final Iterable<? extends Completable> sources) {
requireNonNull(sources);
return create(new OnSubscribe() {
@Override
OnSubscribeRedo
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
public final class OnSubscribeRedo<T> implements OnSubscribe<T> {
final Observable<T> source;
private final Func1<? super Observable<? extends Notification<?>>, ? extends Observable<?>> controlHandlerFunction;
final boolean stopOnComplete;
final boolean stopOnError;
OneItemPerf
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.SECONDS)
@State(Scope.Thread)
public class OneItemPerf {
Method drain
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
void drain() {
if (wip.getAndIncrement() != 0) {
return;
}
File TestSubscriber.java
has 323 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Copyright 2014 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Method emitLoop
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public void emitLoop() {
for (;;) {
long localRequested;
long localProduced;
Producer localProducer;
- 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 tryEnableCancelPolicy
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public static boolean tryEnableCancelPolicy(ScheduledExecutorService executor) {
if (SHOULD_TRY_ENABLE_CANCEL_POLICY) { // NOPMD
final boolean isInstanceOfScheduledThreadPoolExecutor = executor instanceof ScheduledThreadPoolExecutor;
Method methodToCall;
- 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 dispatch
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
void dispatch() {
// standard construct of emitter loop (blocking)
// if there is an emission going on, indicate that more work needs to be done
// the exact nature of this work needs to be determined from other data structures
synchronized (this) {
Method call
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void call(final CompletableSubscriber s) {
final CompositeSubscription set = new CompositeSubscription();
s.onSubscribe(set);
AtomicPerf
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
@BenchmarkMode(Mode.Throughput)
@OutputTimeUnit(TimeUnit.SECONDS)
public class AtomicPerf {
@State(Scope.Thread)
public static class Times {
File OperatorSwitch.java
has 317 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Copyright 2014 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
Method drain
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
void drain() {
if (wip.getAndIncrement() != 0) {
return;
}
int missed = 1;
Method init
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
@SuppressWarnings({ "rawtypes", "unchecked", "deprecation"})
static void init() {
onError = new Action1<Throwable>() {
@Override
public void call(Throwable e) {
Similar blocks of code found in 2 locations. Consider refactoring. Open
@SuppressWarnings("unchecked")
void remove(ReplayProducer<T> rp) {
for (;;) {
ReplayProducer<T>[] a = get();
if (a == TERMINATED || a == EMPTY) {
- 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 210.
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