Showing 49 of 49 total issues

Method api has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    def api(path, query = {}, opts = {})
      path.sub!(%r{\A/+}, "")

      uri = api_base
      uri.path += path
Severity: Minor
Found in lib/atig/basic_twitter.rb - About 6 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 escape_http_urls has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

      def escape_http_urls(text)
        original_text = text.encoding!("UTF-8").dup

        if defined? ::Punycode
          # TODO: Nameprep
Severity: Minor
Found in lib/atig/ofilter/escape_url.rb - About 6 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

Class Session has 26 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Session < Net::IRC::Server::Session
      include Util

      class << self
        def self.class_writer(*ids)
Severity: Minor
Found in lib/atig/gateway/session.rb - About 3 hrs to fix

    File session.rb has 282 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'fileutils'
    require 'atig/util'
    require "ostruct"
    require "time"
    require 'yaml'
    Severity: Minor
    Found in lib/atig/gateway/session.rb - About 2 hrs to fix

      Method resolve_http_redirect has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

            def resolve_http_redirect(uri, limit = 3)
              return uri if limit.zero? or uri.nil?
              log :debug, uri.inspect
              req = @http.req :head, uri
              @http.http(uri, 3, 2).request(req) do |res|
      Severity: Minor
      Found in lib/atig/ifilter/expand_url.rb - 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 initialize has a Cognitive Complexity of 20 (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/user_stream.rb - 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 watch has a Cognitive Complexity of 19 (exceeds 5 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 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 on_user has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

            def on_user(m)
              super
              @thread_group = ThreadGroup.new
              @thread_group.add Thread.current
              @ctcp_actions = {}
      Severity: Minor
      Found in lib/atig/gateway/session.rb - 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 start has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.start(opt={})
          opt = DEFAULTS.dup.merge(opt)
      
          Thread.new do
            prev = Hash.new(0)
      Severity: Minor
      Found in lib/memory_profiler.rb - 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 on_user has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def on_user(m)
              super
              @thread_group = ThreadGroup.new
              @thread_group.add Thread.current
              @ctcp_actions = {}
      Severity: Major
      Found in lib/atig/gateway/session.rb - About 2 hrs to fix

        Method latest has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            def latest
              unless git? then
                []
              else
                cs      = commits
        Severity: Minor
        Found in lib/atig/update_checker.rb - 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 api has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def api(path, query = {}, opts = {})
              path.sub!(%r{\A/+}, "")
        
              uri = api_base
              uri.path += path
        Severity: Major
        Found in lib/atig/basic_twitter.rb - About 2 hrs to fix

          Method action has a Cognitive Complexity of 17 (exceeds 5 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/whois.rb - 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 req has a Cognitive Complexity of 17 (exceeds 5 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 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 parse! has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def parse!(argv)
                  opts = {
                    port: 16668,
                    host: "localhost",
                    log: nil,
          Severity: Major
          Found in lib/atig/optparse.rb - About 2 hrs to fix

            Method initialize has a Cognitive Complexity of 16 (exceeds 5 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 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 action has a Cognitive Complexity of 15 (exceeds 5 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

            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 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def self.start(opt={})
                opt = DEFAULTS.dup.merge(opt)
            
                Thread.new do
                  prev = Hash.new(0)
            Severity: Minor
            Found in lib/memory_profiler.rb - About 1 hr to fix

              Method update has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def update(users)
                      @db.execute do|db|
                        may_notify :join, users.select{|u|
                          not exists?(db,
                                      "screen_name = ?",
              Severity: Minor
              Found in lib/atig/db/followings.rb - About 1 hr to fix

                Method escape_http_urls has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def escape_http_urls(text)
                        original_text = text.encoding!("UTF-8").dup
                
                        if defined? ::Punycode
                          # TODO: Nameprep
                Severity: Minor
                Found in lib/atig/ofilter/escape_url.rb - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language