mlaccetti/JavaPNS

View on GitHub

Showing 107 of 107 total issues

Method runTest has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private static void runTest(final String[] args) {
    final String keystore = args[0];
    final String password = args[1];
    final String token = args[2];
    final boolean production = args.length >= 4 && args[3].equalsIgnoreCase("production");
Severity: Minor
Found in src/test/java/javapns/test/SpecificNotificationTests.java - About 25 mins to fix

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 readResponsePacketData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private static ResponsePacket readResponsePacketData(final InputStream input) throws IOException {
    final int command = input.read();
    if (command < 0) {
      return null;
    }
Severity: Minor
Found in src/main/java/javapns/notification/ResponsePacketReader.java - About 25 mins to fix

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 combined has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  public static PushNotificationPayload combined(final String message, final int badge, final String sound) {
    if (message == null && badge < 0 && sound == null) {
      throw new IllegalArgumentException("Must provide at least one non-null argument");
    }
    final PushNotificationPayload payload = complex();
Severity: Minor
Found in src/main/java/javapns/notification/PushNotificationPayload.java - About 25 mins to fix

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 pushSimplePayloadUsingThreads has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private static void pushSimplePayloadUsingThreads(final String keystore, final String password, final boolean production, final String token, final boolean simulation, final int devices, final int threads) {
    try {

      System.out.println("Creating PushNotificationManager and AppleNotificationServer");
      final AppleNotificationServer server = new AppleNotificationServerBasicImpl(keystore, password, production);
Severity: Minor
Found in src/test/java/javapns/test/NotificationTest.java - About 25 mins to fix

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 getDevice has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  public Device getDevice(final String id) throws UnknownDeviceException, NullIdException {
    if ((id == null) || (id.trim().equals(""))) {
      throw new NullIdException();
    } else {
      if (this.devices.containsKey(id)) {

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 getDevices has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private LinkedList<Device> getDevices(final SSLSocket socket) throws CommunicationException {

    // Compute
    LinkedList<Device> listDev = null;
    try {
Severity: Minor
Found in src/main/java/javapns/feedback/FeedbackServiceManager.java - About 25 mins to fix

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 makeGroups has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private static List<List<?>> makeGroups(final List<?> objects, final int threads) {
    final List<List<?>> groups = new ArrayList<>(threads);
    final int total = objects.size();
    int devicesPerThread = total / threads;
    if (total % threads > 0) {
Severity: Minor
Found in src/main/java/javapns/notification/transmission/NotificationThreads.java - About 25 mins to fix

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

Severity
Category
Status
Source
Language