eventmachine/eventmachine

View on GitHub

Showing 147 of 147 total issues

Method send_cmd has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def send_cmd cmd, key, flags = 0, exptime = 0, bytes = 0, noreply = false
Severity: Minor
Found in lib/em/protocols/memcache.rb - About 45 mins to fix

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

        void isWritable (SelectionKey k) {
            EventableChannel ec = (EventableChannel) k.attachment();
            long b = ec.getBinding();
    
            if (ec.isWatchOnly()) {
    Severity: Minor
    Found in java/src/com/rubyeventmachine/EmReactor.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 bind_connect has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def self.bind_connect bind_addr, bind_port, server, port=nil, handler=nil, *args
    Severity: Minor
    Found in lib/eventmachine.rb - About 45 mins to fix

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

            def invoke_auth
              if @args[:auth]
                if @args[:auth][:type] == :plain
                  psw = @args[:auth][:password]
                  if psw.respond_to?(:call)
      Severity: Minor
      Found in lib/em/protocols/smtpclient.rb - 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

      Avoid deeply nested control flow statements.
      Open

                    if (m = data.match(/\A(\S*)\r\n/m))
                      data = data[m[0].length..-1]
                      @chunk_length = m[1].to_i(16)
                      @chunk_read = 0
                      if @chunk_length == 0
      Severity: Major
      Found in lib/em/protocols/httpclient.rb - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                        if (@content_length and @content_length > 0) || @chunked || @connection_close
                          @read_state = :content
                        else
                          dispatch_response
                          @read_state = :base
        Severity: Major
        Found in lib/em/protocols/httpclient.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                        if k == "content-length"
                          @content_length = v.to_i
                        end
          Severity: Major
          Found in lib/em/protocols/stomp.rb - About 45 mins to fix

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

                    def receive_chunk_header ln
                      if ln.length > 0
                        chunksize = ln.to_i(16)
                        if chunksize > 0
                          @conn.set_text_mode(ln.to_i(16))
            Severity: Minor
            Found in lib/em/protocols/httpclient2.rb - 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 connect has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def self.connect server, port=nil, handler=nil, *args, &blk
            Severity: Minor
            Found in lib/eventmachine.rb - About 35 mins to fix

              Method sendDatagram has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public void sendDatagram (long sig, byte[] data, int length, String recipAddress, int recipPort) {
              Severity: Minor
              Found in java/src/com/rubyeventmachine/EmReactor.java - About 35 mins to fix

                Method send_datagram has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def send_datagram target, data, datalength, host, port
                Severity: Minor
                Found in lib/em/pure_ruby.rb - About 35 mins to fix

                  Method sendDatagram has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public void sendDatagram(long sig, byte[] data, int length, String recipAddress, int recipPort)
                  Severity: Minor
                  Found in java/src/com/rubyeventmachine/NullEmReactor.java - About 35 mins to fix

                    Method send_datagram has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      def self.send_datagram sig, data, length, address, port
                    Severity: Minor
                    Found in lib/jeventmachine.rb - About 35 mins to fix

                      Method start_server has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        def self.start_server server, port=nil, handler=nil, *args, &block
                      Severity: Minor
                      Found in lib/eventmachine.rb - About 35 mins to fix

                        Method sendDatagram has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            void sendDatagram (long sig, byte[] data, int length, String recipAddress, int recipPort);
                        Severity: Minor
                        Found in java/src/com/rubyeventmachine/EmReactorInterface.java - About 35 mins to fix

                          Identical blocks of code found in 4 locations. Consider refactoring.
                          Open

                            def handle_username(input)
                              if input.empty?
                                send_line("Blank usernames are not allowed. Try again.")
                                ask_username
                              else
                          Severity: Major
                          Found in examples/guides/getting_started/03_simple_chat_server.rb and 3 other locations - About 35 mins to fix
                          examples/guides/getting_started/06_simple_chat_server_step_three.rb on lines 49..59
                          examples/guides/getting_started/07_simple_chat_server_step_four.rb on lines 49..59
                          examples/guides/getting_started/08_simple_chat_server_step_five.rb on lines 47..57

                          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 36.

                          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

                          Further Reading

                          Identical blocks of code found in 4 locations. Consider refactoring.
                          Open

                            def handle_username(input)
                              if input.empty?
                                send_line("Blank usernames are not allowed. Try again.")
                                ask_username
                              else
                          examples/guides/getting_started/03_simple_chat_server.rb on lines 47..57
                          examples/guides/getting_started/06_simple_chat_server_step_three.rb on lines 49..59
                          examples/guides/getting_started/08_simple_chat_server_step_five.rb on lines 47..57

                          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 36.

                          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

                          Further Reading

                          Identical blocks of code found in 4 locations. Consider refactoring.
                          Open

                            def handle_username(input)
                              if input.empty?
                                send_line("Blank usernames are not allowed. Try again.")
                                ask_username
                              else
                          examples/guides/getting_started/03_simple_chat_server.rb on lines 47..57
                          examples/guides/getting_started/06_simple_chat_server_step_three.rb on lines 49..59
                          examples/guides/getting_started/07_simple_chat_server_step_four.rb on lines 49..59

                          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 36.

                          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

                          Further Reading

                          Identical blocks of code found in 4 locations. Consider refactoring.
                          Open

                            def handle_username(input)
                              if input.empty?
                                send_line("Blank usernames are not allowed. Try again.")
                                ask_username
                              else
                          examples/guides/getting_started/03_simple_chat_server.rb on lines 47..57
                          examples/guides/getting_started/07_simple_chat_server_step_four.rb on lines 49..59
                          examples/guides/getting_started/08_simple_chat_server_step_five.rb on lines 47..57

                          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 36.

                          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

                          Further Reading

                          Method request has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                                def request args
                                  args[:host_header] = @host_header unless args.has_key?(:host_header)
                                  args[:authorization] = @authorization unless args.has_key?(:authorization)
                                  r = Request.new self, args
                                  if @closed
                          Severity: Minor
                          Found in lib/em/protocols/httpclient2.rb - About 35 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