eventmachine/eventmachine

View on GitHub
java/src/com/rubyeventmachine/EventableSocketChannel.java

Summary

Maintainability
D
1 day
Test Coverage

EventableSocketChannel has 31 methods (exceeds 20 allowed). Consider refactoring.
Open

public class EventableSocketChannel implements EventableChannel {
    Selector selector;
    SelectionKey channelKey;
    SocketChannel channel;

Severity: Minor
Found in java/src/com/rubyeventmachine/EventableSocketChannel.java - About 3 hrs to fix

    File EventableSocketChannel.java has 289 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * $Id$
     * 
     * Author:: Francis Cianfrocca (gmail: blackhedd)
     * Homepage::  http://rubyeventmachine.com
    Severity: Minor
    Found in java/src/com/rubyeventmachine/EventableSocketChannel.java - About 2 hrs to fix

      Method writeOutboundData has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          public boolean writeOutboundData() throws IOException {
              ByteBuffer[] bufs = new ByteBuffer[64];
              int i;
              long written, toWrite;
              while (!outboundQ.isEmpty()) {
      Severity: Minor
      Found in java/src/com/rubyeventmachine/EventableSocketChannel.java - About 2 hrs 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 currentEvents has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          private int currentEvents() {
              int events = 0;
      
              if (bWatchOnly)
              {
      Severity: Minor
      Found in java/src/com/rubyeventmachine/EventableSocketChannel.java - About 1 hr 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 writeOutboundData has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public boolean writeOutboundData() throws IOException {
              ByteBuffer[] bufs = new ByteBuffer[64];
              int i;
              long written, toWrite;
              while (!outboundQ.isEmpty()) {
      Severity: Minor
      Found in java/src/com/rubyeventmachine/EventableSocketChannel.java - About 1 hr to fix

        Method scheduleOutboundData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public void scheduleOutboundData (ByteBuffer bb) {
                if (!bCloseScheduled && bb.remaining() > 0) {
                    if (sslEngine != null) {
                        try {
                            ByteBuffer b = ByteBuffer.allocate(32*1024); // TODO, preallocate this buffer.
        Severity: Minor
        Found in java/src/com/rubyeventmachine/EventableSocketChannel.java - About 45 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 dispatchInboundData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public ByteBuffer dispatchInboundData (ByteBuffer bb) throws SSLException {
                if (sslEngine != null) {
                    if (true) throw new RuntimeException ("TLS currently unimplemented");
                    System.setProperty("javax.net.debug", "all");
                    ByteBuffer w = ByteBuffer.allocate(32*1024); // TODO, WRONG, preallocate this buffer.
        Severity: Minor
        Found in java/src/com/rubyeventmachine/EventableSocketChannel.java - About 45 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 close has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public void close() {
                if (channelKey != null) {
                    channelKey.cancel();
                    channelKey = null;
                }
        Severity: Minor
        Found in java/src/com/rubyeventmachine/EventableSocketChannel.java - About 45 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

        There are no issues that match your filters.

        Category
        Status