celluloid/celluloid

View on GitHub

Showing 56 of 56 total issues

File celluloid.rb has 374 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "English"

require "logger"
require "set"
require "timeout"
Severity: Minor
Found in lib/celluloid.rb - About 5 hrs to fix

    Class Actor has 35 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Actor
        attr_reader :behavior, :proxy, :tasks, :links, :mailbox, :thread, :name, :timers
        attr_writer :exit_handler
    
        class << self
    Severity: Minor
    Found in lib/celluloid/actor.rb - About 4 hrs to fix

      Method parse has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

              def parse(args)
                return args if args.is_a? Configuration::Instance
                options = { args: [] }
                return { type: args } if args.is_a? Class
                if args.is_a? Hash
      Severity: Minor
      Found in lib/celluloid/supervision/deprecate/validation.rb - About 4 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 shutdown has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

            def shutdown
              actors = running
              Timeout.timeout(shutdown_timeout) do
                Internals::Logger.debug "Terminating #{actors.size} #{actors.size > 1 ? 'actors' : 'actor'}..." unless actors.empty?
      
      
      Severity: Minor
      Found in lib/celluloid/actor/system.rb - About 3 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 run has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          def run
            while @running
              begin
                @timers.wait do |interval|
                  interval = 0 if interval && interval < 0
      Severity: Minor
      Found in lib/celluloid/actor.rb - About 3 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 Pool has 23 methods (exceeds 20 allowed). Consider refactoring.
      Open

            class Pool
              include Celluloid
      
              trap_exit :__crash_handler__
              finalizer :__shutdown__
      Severity: Minor
      Found in lib/celluloid/supervision/container/pool.rb - About 2 hrs to fix

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

                def resync_accessors
                  # methods for setting and getting the usual defaults
                  Configuration.parameters(:mandatory, :optional, :plugins, :meta).each do |key|
                    self.class.instance_eval do
                      remove_method :"#{key}!" rescue nil # avoid warnings in tests
        Severity: Minor
        Found in lib/celluloid/supervision/configuration/instance.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 valid? has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

                def valid?(configuration, fails = false)
                  parameters(:mandatory).each do |k|
                    unless configuration.key? k
                      if fails
                        raise Error::Incomplete, "Missing `:#{k}` in supervision configuration."
        Severity: Minor
        Found in lib/celluloid/supervision/validation.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 linking_request has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            def linking_request(receiver, type)
              Celluloid.exclusive do
                receiver.mailbox << LinkingRequest.new(Actor.current, type)
                system_events = []
        
        
        Severity: Minor
        Found in lib/celluloid/actor.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 property has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

              def property(name, opts = {})
                default   = opts.fetch(:default, nil)
                multi     = opts.fetch(:multi, false)
                ivar_name = "@#{name}".to_sym
        
        
        Severity: Minor
        Found in lib/celluloid/internals/properties.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 dump has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

                def dump
                  string = ""
                  string << "Celluloid::Actor 0x#{id.to_s(16)}"
                  string << " [#{name}]" if name
                  string << "\n"
        Severity: Minor
        Found in lib/celluloid/internals/stack/states.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 included has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def included(klass)
              klass.send :extend,  ClassMethods
              klass.send :include, InstanceMethods
        
              klass.send :extend, Internals::Properties
        Severity: Minor
        Found in lib/celluloid.rb - About 1 hr to fix

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

              def value(timeout = nil)
                ready = result = nil
          
                begin
                  @mutex.lock
          Severity: Minor
          Found in lib/celluloid/future.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 resync_accessors has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

                def resync_accessors
                  # methods for setting and getting the usual defaults
                  Configuration.parameters(:mandatory, :optional, :plugins, :meta).each do |key|
                    [:"#{key}!", :"#{key}="].each do |m|
                      self.class.instance_eval do
          Severity: Minor
          Found in lib/celluloid/supervision/configuration.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 check has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def check(obj)
                # NOTE: don't use respond_to? here
                begin
                  meth = obj.method(@method)
                rescue NameError
          Severity: Minor
          Found in lib/celluloid/calls.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 running has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

                def running
                  actors = []
                  @group.each do |t|
                    next unless t.role == :actor
                    actor = t.actor
          Severity: Minor
          Found in lib/celluloid/actor/system.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 value has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def value(timeout = nil)
                ready = result = nil
          
                begin
                  @mutex.lock
          Severity: Minor
          Found in lib/celluloid/future.rb - About 1 hr to fix

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

                  def shutdown
                    actors = running
                    Timeout.timeout(shutdown_timeout) do
                      Internals::Logger.debug "Terminating #{actors.size} #{actors.size > 1 ? 'actors' : 'actor'}..." unless actors.empty?
            
            
            Severity: Minor
            Found in lib/celluloid/actor/system.rb - About 1 hr to fix

              Method terminate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def terminate
                    raise "Cannot terminate an exclusive task" if exclusive?
              
                    if running?
                      # !!! DO NOT INTRODUCE ADDITIONAL GLOBAL VARIABLES !!!
              Severity: Minor
              Found in lib/celluloid/task.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 respond_to? has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                      def respond_to?(meth, include_private = false)
                        # NOTE: use method() here since this class
                        # shouldn't be used directly, and method() is less
                        # likely to be "reimplemented" inconsistently
                        # with other Object.*method* methods.
              Severity: Minor
              Found in lib/celluloid/supervision/container/pool.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

              Severity
              Category
              Status
              Source
              Language