nadoka/nadoka

View on GitHub

Showing 69 of 69 total issues

Method log_format_message has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def log_format_message msgfmts, msgobj
      type   = msgobj[:type]
      format = msgfmts.fetch(type, @config[:default_log][:message_format][type])

      if format.kind_of? Proc
Severity: Minor
Found in ndk/config.rb - About 1 hr to fix

    Method login has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def login
          pass = nil
          nick = nil
          @username = nil
          
    Severity: Minor
    Found in ndk/client.rb - About 1 hr to fix

      Method load_bots has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def load_bots
            # for compatibility
            return load_bots_old if @config[:botconfig].kind_of? Hash
            @bots = @config[:botconfig].map{|bot|
              if bot.kind_of? Hash
      Severity: Minor
      Found in ndk/config.rb - 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 load_bots_old has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def load_bots_old
            (@config[:botfiles] + (@config[:defaultbotfiles]||[])).each{|file|
              load_botfile file
            }
            
      Severity: Minor
      Found in ndk/config.rb - 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 start has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def start
            send_thread = Thread.new{
              begin
                while q = @queue.pop
                  begin
      Severity: Minor
      Found in ndk/client.rb - 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 send_to_bot has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def send_to_bot msg, *arg
      
            selector = 'on_' +
              if msg.respond_to? :command
                if /^\d+$/ =~ msg.command
      Severity: Minor
      Found in ndk/server.rb - About 1 hr to fix

        Method logging has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def logging msg
              user = @manager.nick_of(msg)
              rch = msg.params[0]
              ch = @config.canonical_channel_name(rch)
        
        
        Severity: Minor
        Found in ndk/logger.rb - About 1 hr to fix

          Method start has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def start
                send_thread = Thread.new{
                  begin
                    while q = @queue.pop
                      begin
          Severity: Minor
          Found in ndk/client.rb - About 1 hr to fix

            Method login has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def login
                  pass = nil
                  nick = nil
                  @username = nil
                  
            Severity: Minor
            Found in ndk/client.rb - 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 channel_setting has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def channel_setting
                  # treat with channel information
                  if chs = @config[:channel_info]
                    dchs = []
                    lchs = []
            Severity: Minor
            Found in ndk/config.rb - 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 recv_from_client has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def recv_from_client
                  while !@sock.closed?
                    begin
                      str = @sock.gets
                      if str
            Severity: Minor
            Found in ndk/client.rb - 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 open_conn has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def open_conn
                  @conn.synchronize do
                    conn = TCPSocket.new(@server, @port)
                    if ssl_params
                      context = OpenSSL::SSL::SSLContext.new
            Severity: Minor
            Found in rice/irc.rb - 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 to_s has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def to_s
                  str = ''
                  if @prefix
                    str << ':'
                    str << @prefix
            Severity: Minor
            Found in rice/irc.rb - 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 parse has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def self.parse(str)
                  unless PATTERN::MESSAGE_PATTERN =~ str
                    raise InvalidMessage, "Invalid message: #{str.inspect}"
            
                  else
            Severity: Minor
            Found in rice/irc.rb - 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 enter_away has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def enter_away
                  return if @exitting || !@connected
                  
                  send_to_server Cmd.away(@config.away_message) if @config.away_message
            
            
            Severity: Minor
            Found in ndk/server.rb - 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 read_thread has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def read_thread(read_q, eol)
                  begin
                    read_q.clear
                    Thread.stop
            
            
            Severity: Minor
            Found in rice/irc.rb - About 1 hr to fix

              Method filter_message has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def filter_message filter, msg
                    return msg if filter.nil? || filter.empty?
                    
                    begin
                      if filter.respond_to? :each
              Severity: Minor
              Found in ndk/server.rb - About 1 hr to fix

                Method initialize has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def initialize(server, port, eol = "\r\n", ssl_params = nil)
                      @conn = []
                      @conn.extend(MonitorMixin)
                      @main_th = nil
                
                
                Severity: Minor
                Found in rice/irc.rb - About 1 hr to fix

                  Method start has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def start(max_retry = 3, retry_wait = 30)
                        @client_th = Thread.current # caller thread
                        if alive?
                          #sleep retry_wait
                          return nil
                  Severity: Minor
                  Found in rice/irc.rb - About 1 hr to fix

                    Method remove_previous_setting has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def remove_previous_setting
                          # remove setting class
                          base_klass = ConfigClass.shift
                          while klass = ConfigClass.shift
                            Object.module_eval{
                    Severity: Minor
                    Found in ndk/config.rb - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language