Showing 49 of 49 total issues

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

      def initialize(context, gateway, db)
        @channels = Hash.new do|hash,name|
          channel = gateway.channel "##{name}", handler: Handler.new(db, name)
          channel.join_me
          hash[name] = channel
Severity: Minor
Found in lib/atig/channel/list.rb - About 1 hr to fix

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

        def http(uri, open_timeout = nil, read_timeout = 60)
          http = case
                 when @@proxy
                   Net::HTTP.new(uri.host, uri.port, @@proxy.address, @@proxy.port,
                                 @@proxy.user, @@proxy.password)
    Severity: Minor
    Found in lib/atig/http.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 initialize has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def initialize(context, api, db)
            @log = context.log
            @api = api
            @prev = nil
    
    
    Severity: Minor
    Found in lib/atig/agent/user_stream.rb - About 1 hr to fix

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

            def initialize(context, gateway, db)
              super
              @log = context.log
      
              @channel.notify "Client options: #{context.opts.marshal_dump.inspect}"
      Severity: Minor
      Found in lib/atig/channel/timeline.rb - About 1 hr to fix

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

              def call(status)
                target = short_url_regexp
                entities = (entities = status.entities).nil? ? [] : entities.urls
                status.merge text: status.text.gsub(target) {|url|
                  unless entities.nil? or entities.empty?
        Severity: Minor
        Found in lib/atig/ifilter/expand_url.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 shorten has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def shorten(url)
              return url if url =~ /bit\.ly/
              bitly = URI("http://api.bit.ly/v3/shorten")
              if @login and @key
                bitly.path  = "/shorten"
        Severity: Minor
        Found in lib/atig/bitly.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 watch has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def watch(path, query={}, &f)
              path.sub!(%r{\A/+}, "")
        
              uri = api_base
              uri.path += path
        Severity: Minor
        Found in lib/atig/stream.rb - About 1 hr to fix

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

            def initialize(context, api, db)
              @log = context.log
              @db  = db
              log :info, "initialize"
          
          
          Severity: Minor
          Found in lib/atig/agent/list_status.rb - About 1 hr to fix

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

                def req(method, uri, header = {}, credentials = nil)
                  accepts = ["*/*"]
                  types   = { "json" => "application/json", "txt" => "text/plain" }
                  ext     = uri.path[/[^.]+\z/]
                  accepts.unshift types[ext] if types.key?(ext)
            Severity: Minor
            Found in lib/atig/http.rb - About 1 hr to fix

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

                    def action(target, mesg, command, args)
                      if args.empty?
                        yield "/me #{command} [option...] blah blah"
                        return
                      end
              Severity: Minor
              Found in lib/atig/command/search.rb - About 1 hr to fix

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

                      def initialize(name)
                        @db = Sql.new name
                        @roman = Roman.new
                
                        unless File.exist? name then
                Severity: Minor
                Found in lib/atig/db/statuses.rb - About 1 hr to fix

                  Method levenshtein has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def levenshtein(a, b)
                          case
                          when a.empty?
                            b.length
                          when b.empty?
                  Severity: Minor
                  Found in lib/atig/levenshtein.rb - About 1 hr to fix

                    Method action has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def action(target, mesg, command,args)
                            if args.empty?
                              yield "/me #{command} <ID>"
                              return
                            end
                    Severity: Minor
                    Found in lib/atig/command/version.rb - About 1 hr to fix

                      Method action has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            def action(target, mesg, command, args)
                              if args.empty?
                                yield "/me #{command} <ID1> <ID2> ..."
                                return
                              end
                      Severity: Minor
                      Found in lib/atig/command/destroy.rb - About 1 hr to fix

                        Method encode_www_form has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def encode_www_form(enum, enc=nil, separator: -'&')
                              enum.map do |k,v|
                                if v.nil?
                                  encode_www_form_component(k, enc)
                                elsif v.respond_to?(:to_ary)
                        Severity: Minor
                        Found in lib/atig/url_escape.rb - About 55 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 exist_uri? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def exist_uri?(uri, limit = 1)
                                ret = nil
                                #raise "Not supported." unless uri.is_a?(URI::HTTP)
                                return ret if limit.zero? or uri.nil? or not uri.is_a?(URI::HTTP)
                                @log.debug uri.inspect
                        Severity: Minor
                        Found in lib/atig/ofilter/escape_url.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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def initialize(context, api, db)
                                @log = context.log
                                @api = api
                                @prev = nil
                        
                        
                        Severity: Minor
                        Found in lib/atig/agent/stream_follow.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 init has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def init
                                return if @queue
                        
                                debug "transaction thread start"
                                @queue = SizedQueue.new 10
                        Severity: Minor
                        Found in lib/atig/db/transaction.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def initialize(context, gateway, db)
                                @channels = Hash.new do|hash,name|
                                  channel = gateway.channel "##{name}", handler: Handler.new(db, name)
                                  channel.join_me
                                  hash[name] = channel
                        Severity: Minor
                        Found in lib/atig/channel/list.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

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

                            def method_missing(mid, *args) # :nodoc:
                              mname = mid.id2name
                              len = args.length
                              if mname =~ /=$/
                                if len != 1
                        Severity: Minor
                        Found in lib/atig/option.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