Showing 80 of 107 total issues
Avoid deeply nested control flow statements. Open
if (foundFirstFail) {
notificationsToResend.add(notification);
} else {
foundFirstFail = true;
}
Method addDevice
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public Device addDevice(final String id, String token) throws Exception {
if ((id == null) || (id.trim().equals(""))) {
throw new NullIdException();
} else if ((token == null) || (token.trim().equals(""))) {
throw new NullDeviceTokenException();
- 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 put
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
void put(final String propertyName, final Object propertyValue, final JSONObject object, final boolean opt) throws JSONException {
try {
if (isPayloadSizeEstimatedWhenAdding()) {
final int maximumPayloadSize = getMaximumPayloadSize();
final int estimatedPayloadSize = estimatePayloadSizeAfterAdding(propertyName, propertyValue);
- 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 payload
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public static PushedNotifications payload(final Payload payload, final Object keystore, final String password, final boolean production, final int numberOfThreads, final Object devices) throws Exception {
Method validateKeystoreParameter
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static void validateKeystoreParameter(Object keystore) throws InvalidKeystoreReferenceException {
if (keystore == null) {
throw new InvalidKeystoreReferenceException((Object) null);
}
if (keystore instanceof KeyStore) {
- 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 wrapKeystoreException
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
static KeystoreException wrapKeystoreException(final Exception e) {
if (e != null) {
final String msg = e.toString();
if (msg.contains("javax.crypto.BadPaddingException")) {
return new InvalidKeystorePasswordException();
- 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 payload
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static PushedNotifications payload(final Payload payload, final Object keystore, final String password, final boolean production, final Object devices) throws CommunicationException, KeystoreException {
Method sendPayload
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private static PushedNotifications sendPayload(final Payload payload, final Object keystore, final String password, final boolean production, final Object devices) throws CommunicationException, KeystoreException {
Method payloads
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static PushedNotifications payloads(final Object keystore, final String password, final boolean production, final int numberOfThreads, final Object payloadDevicePairs) throws Exception {
Method badge
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static PushedNotifications badge(final int badge, final Object keystore, final String password, final boolean production, final Object devices) throws CommunicationException, KeystoreException {
Method sound
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static PushedNotifications sound(final String sound, final Object keystore, final String password, final boolean production, final Object devices) throws CommunicationException, KeystoreException {
Method alert
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static PushedNotifications alert(final String message, final Object keystore, final String password, final boolean production, final Object devices) throws CommunicationException, KeystoreException {
Method streamKeystore
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
static InputStream streamKeystore(final Object keystore) throws InvalidKeystoreReferenceException {
validateKeystoreParameter(keystore);
try {
if (keystore instanceof InputStream) {
return (InputStream) keystore;
- 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 readResponses
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static List<ResponsePacket> readResponses(final Socket socket) {
final List<ResponsePacket> responses = new ArrayList<>();
int previousTimeout = 0;
try {
/* Set socket timeout to avoid getting stuck on read() */
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
public synchronized NotificationThreads start() {
if (started) {
return this;
}
started = 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 asPayloadsPerDevices
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static List<PayloadPerDevice> asPayloadsPerDevices(final Object rawList) {
final List<PayloadPerDevice> list = new ArrayList<>();
if (rawList == null) {
return list;
}
- 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 test_Issue102
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static void test_Issue102(final String keystore, final String password, String token, final boolean production) {
try {
System.out.println("");
System.out.println("TESTING ISSUE #102");
final int devices = 10000;
- 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
Avoid too many return
statements within this method. Open
return prefix + "None (unknown)";
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return list;